Added latexindent options to texlab

This commit is contained in:
isaacST08 2025-01-26 19:26:06 -07:00
commit 68c3610848

View file

@ -2,7 +2,6 @@
# - Add Texlab LSP settings: # - Add Texlab LSP settings:
# - chktex # - chktex
# - symbols # - symbols
# - latexindent
# - completion # - completion
# - inlayHints # - inlayHints
# - experimental # - experimental
@ -14,7 +13,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 ints enum; inherit (lib.types) listOf package str attrs ints enum either path nullOr;
inherit (lib.nvim.config) mkBool; inherit (lib.nvim.config) mkBool;
cfg = config.vim.languages.tex; cfg = config.vim.languages.tex;
@ -103,6 +102,34 @@ in {
}; };
}; };
latexindent = {
local = mkOption {
type = nullOr (either str path);
default = null;
description = ''
Defines the path of a file containing the latexindent configuration.
This corresponds to the --local=file.yaml flag of latexindent.
By default the configuration inside the project root directory is used.
'';
};
modifyLineBreaks = mkBool false ''
Modifies linebreaks before, during, and at the end of code blocks when formatting with latexindent.
This corresponds to the --modifylinebreaks flag of latexindent.
'';
replacement = mkOption {
type = nullOr (enum ["-r" "-rv" "-rr"]);
default = null;
description = ''
Defines an additional replacement flag that is added when calling latexindent. This can be one of the following:
- "-r"
- "-rv"
- "-rr"
- null
By default no replacement flag is passed.
'';
};
};
formatterLineLength = mkOption { formatterLineLength = mkOption {
type = ints.positive; type = ints.positive;
default = 80; default = 80;
@ -178,6 +205,14 @@ in {
ignoredPatterns = texlabCfg.diagnostics.ignoredPatterns; ignoredPatterns = texlabCfg.diagnostics.ignoredPatterns;
}; };
} }
# -- Latex Indent --
// {
latexindent = {
local = texlabCfg.latexindent.local;
modifyLineBreaks = texlabCfg.latexindent.modifyLineBreaks;
replacement = texlabCfg.latexindent.replacement;
};
}
# -- Forward Search -- # -- Forward Search --
// ( // (
if texlabCfg.forwardSearch.enable if texlabCfg.forwardSearch.enable