Added diagnostic options for texlab

This commit is contained in:
isaacST08 2025-01-26 18:56:41 -07:00
commit 934eed8181

View file

@ -1,8 +1,6 @@
# TODO: # TODO:
# - Add Texlab LSP settings: # - Add Texlab LSP settings:
# - chktex # - chktex
# - diagnosticsDelay
# - diagnostics
# - symbols # - symbols
# - formatterLineLength # - formatterLineLength
# - bibtexFormatter # - bibtexFormatter
@ -19,7 +17,7 @@
}: let }: let
inherit (lib.options) mkOption; inherit (lib.options) mkOption;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.types) listOf package str attrs; inherit (lib.types) listOf package str attrs ints;
inherit inherit
(builtins) (builtins)
attrNames attrNames
@ -90,6 +88,37 @@ in {
}; };
}; };
diagnostics = {
delay = mkOption {
type = ints.positive;
default = 300;
description = "Delay in milliseconds before reporting diagnostics.";
};
allowedPatterns = mkOption {
type = listOf str;
default = [];
description = ''
A list of regular expressions used to filter the list of reported diagnostics.
If specified, only diagnostics that match at least one of the specified patterns are sent to the client.
See also texlab.diagnostics.ignoredPatterns.
Hint: If both allowedPatterns and ignoredPatterns are set, then allowed patterns are applied first.
Afterwards, the results are filtered with the ignored patterns.
'';
};
ignoredPatterns = mkOption {
type = listOf str;
default = [];
description = ''
A list of regular expressions used to filter the list of reported diagnostics.
If specified, only diagnostics that match none of the specified patterns are sent to the client.
See also texlab.diagnostics.allowedPatterns.
'';
};
};
extraLuaSettings = mkOption { extraLuaSettings = mkOption {
type = attrs; type = attrs;
default = {}; default = {};
@ -125,7 +154,15 @@ in {
# Create texlab settings section # Create texlab settings section
setupConfig.settings.texlab = ( setupConfig.settings.texlab = (
{} # -- General Settings --
# -- Diagnostics --
{
diagnosticsDelay = texlabCfg.diagnostics.delay;
diagnostics = {
allowedPatterns = texlabCfg.diagnostics.allowedPatterns;
ignoredPatterns = texlabCfg.diagnostics.ignoredPatterns;
};
}
# -- Forward Search -- # -- Forward Search --
// ( // (
if texlabCfg.forwardSearch.enable if texlabCfg.forwardSearch.enable