mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-10 07:25:30 +00:00
Cleaned up documentation and other performed other code cleanups
This commit is contained in:
parent
5b616f7907
commit
c3c720f4a2
13 changed files with 343 additions and 213 deletions
|
|
@ -4,24 +4,34 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) attrs either enum ints listOf nullOr package path str submodule;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
inherit (builtins) isString map;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
inherit (lib.options) mkOption mkPackageOption;
|
||||
inherit
|
||||
(lib.types)
|
||||
attrs
|
||||
either
|
||||
enum
|
||||
ints
|
||||
listOf
|
||||
nullOr
|
||||
package
|
||||
path
|
||||
str
|
||||
submodule
|
||||
;
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
texlabCfg = cfg.lsp.texlab;
|
||||
builderCfg = cfg.build.builder;
|
||||
in {
|
||||
options.vim.languages.tex.lsp.texlab = {
|
||||
enable = mkBool config.vim.languages.enableLSP "Whether to enable Tex LSP support (texlab)";
|
||||
enable = mkBool config.vim.languages.enableLSP ''
|
||||
Whether to enable Tex LSP support (texlab).
|
||||
'';
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = pkgs.texlab;
|
||||
description = "texlab package";
|
||||
};
|
||||
package = mkPackageOption pkgs "texlab" {};
|
||||
|
||||
chktex = {
|
||||
enable = mkBool false "Whether to enable linting via chktex";
|
||||
|
|
@ -35,7 +45,9 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
onOpenAndSave = mkBool false "Lint using chktex after opening and saving a file.";
|
||||
onOpenAndSave = mkBool false ''
|
||||
Lint using chktex after opening and saving a file.
|
||||
'';
|
||||
|
||||
onEdit = mkBool false "Lint using chktex after editing a file.";
|
||||
|
||||
|
|
@ -43,7 +55,8 @@ in {
|
|||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Additional command line arguments that are passed to chktex after editing a file.
|
||||
Additional command line arguments that are passed to chktex after
|
||||
editing a file.
|
||||
Don't redefine the `-I` and `-f` flags as they are set by the server.
|
||||
'';
|
||||
};
|
||||
|
|
@ -58,11 +71,15 @@ in {
|
|||
];
|
||||
default = "fuzzy-ignore-case";
|
||||
description = ''
|
||||
Modifies the algorithm used to filter the completion items returned to the client. Possibles values are:
|
||||
- fuzzy: Fuzzy string matching (case sensitive)
|
||||
- fuzzy-ignore-case: Fuzzy string matching (case insensitive)
|
||||
- prefix: Filter out items that do not start with the search text (case sensitive)
|
||||
- prefix-ignore-case: Filter out items that do not start with the search text (case insensitive)
|
||||
Modifies the algorithm used to filter the completion items returned to
|
||||
the client.
|
||||
Possibles values are:
|
||||
- `fuzzy`: Fuzzy string matching (case sensitive).
|
||||
- `fuzzy-ignore-case`: Fuzzy string matching (case insensitive).
|
||||
- `prefix`: Filter out items that do not start with the search text
|
||||
(case sensitive).
|
||||
- `prefix-ignore-case`: Filter out items that do not start with the
|
||||
search text (case insensitive).
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -77,13 +94,16 @@ in {
|
|||
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.
|
||||
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.
|
||||
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.
|
||||
Hint: If both allowedPatterns and ignoredPatterns are set, then
|
||||
allowed patterns are applied first. Afterwards, the results are
|
||||
filtered with the ignored patterns.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -91,35 +111,48 @@ in {
|
|||
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.
|
||||
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.
|
||||
See also `texlab.diagnostics.allowedPatterns`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
experimental = {
|
||||
followPackageLinks = mkBool false "If set to true, dependencies of custom packages are resolved and included in the dependency graph.";
|
||||
followPackageLinks = mkBool false ''
|
||||
If set to `true`, dependencies of custom packages are resolved and
|
||||
included in the dependency graph.
|
||||
'';
|
||||
|
||||
mathEnvironments = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Allows extending the list of environments which the server considers as math environments (for example `align*` or `equation`).";
|
||||
description = ''
|
||||
Allows extending the list of environments which the server considers
|
||||
as math environments (for example `align*` or `equation`).
|
||||
'';
|
||||
};
|
||||
|
||||
enumEnvironments = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Allows extending the list of environments which the server considers as enumeration environments (for example `enumerate` or `itemize`).";
|
||||
description = ''
|
||||
Allows extending the list of environments which the server considers
|
||||
as enumeration environments (for example `enumerate` or `itemize`).
|
||||
'';
|
||||
};
|
||||
|
||||
verbatimEnvironments = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Allows extending the list of environments which the server considers as verbatim environments (for example `minted` or `lstlisting`).
|
||||
This can be used to suppress diagnostics from environments that do not contain LaTeX code.
|
||||
Allows extending the list of environments which the server considers
|
||||
as verbatim environments (for example `minted` or `lstlisting`).
|
||||
This can be used to suppress diagnostics from environments that do
|
||||
not contain LaTeX code.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -127,9 +160,11 @@ in {
|
|||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Allows extending the list of commands which the server considers as citation commands (for example `\cite`).
|
||||
Allows extending the list of commands which the server considers as
|
||||
citation commands (for example `\cite`).
|
||||
|
||||
Hint: Additional commands need to be written without a leading `\` (e. g. `foo` instead of `\foo`).
|
||||
Hint: Additional commands need to be written without a leading `\`
|
||||
(e.g. `foo` instead of `\foo`).
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -139,7 +174,8 @@ in {
|
|||
description = ''
|
||||
Allows extending the list of `\label`-like commands.
|
||||
|
||||
Hint: Additional commands need to be written without a leading `\` (e. g. `foo` instead of `\foo`).
|
||||
Hint: Additional commands need to be written without a leading `\`
|
||||
(e.g. `foo` instead of `\foo`).
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -149,7 +185,8 @@ in {
|
|||
description = ''
|
||||
Allows extending the list of `\ref`-like commands.
|
||||
|
||||
Hint: Additional commands need to be written without a leading `\` (e. g. `foo` instead of `\foo`).
|
||||
Hint: Additional commands need to be written without a leading `\`
|
||||
(e.g. `foo` instead of `\foo`).
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -159,7 +196,8 @@ in {
|
|||
description = ''
|
||||
Allows extending the list of `\crefrange`-like commands.
|
||||
|
||||
Hint: Additional commands need to be written without a leading `\` (e. g. `foo` instead of `\foo`).
|
||||
Hint: Additional commands need to be written without a leading `\`
|
||||
(e.g. `foo` instead of `\foo`).
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -167,13 +205,16 @@ in {
|
|||
type = listOf (listOf str);
|
||||
default = [];
|
||||
description = ''
|
||||
Allows associating a label definition command with a custom prefix. Consider,
|
||||
Allows associating a label definition command with a custom prefix.
|
||||
Consider,
|
||||
```
|
||||
\newcommand{\theorem}[1]{\label{theorem:#1}}
|
||||
\theorem{foo}
|
||||
```
|
||||
Then setting `texlab.experimental.labelDefinitionPrefixes` to `[["theorem", "theorem:"]]` and adding "theorem"
|
||||
to `texlab.experimental.labelDefinitionCommands` will make the server recognize the `theorem:foo` label.
|
||||
Then setting `texlab.experimental.labelDefinitionPrefixes` to
|
||||
`[["theorem", "theorem:"]]` and adding `theorem` to
|
||||
`texlab.experimental.labelDefinitionCommands` will make the server
|
||||
recognize the `theorem:foo` label.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -195,7 +236,8 @@ in {
|
|||
baz = 314;
|
||||
};
|
||||
description = ''
|
||||
For any options that do not have options provided through nvf this can be used to add them.
|
||||
For any options that do not have options provided through nvf this can
|
||||
be used to add them.
|
||||
Options already declared in nvf config will NOT be overridden.
|
||||
|
||||
Options will be placed in:
|
||||
|
|
@ -218,10 +260,12 @@ in {
|
|||
enable = mkBool false ''
|
||||
Whether to enable forward search.
|
||||
|
||||
Enable this option if you want to have the compiled document appear in your chosen PDF viewer.
|
||||
Enable this option if you want to have the compiled document appear in
|
||||
your chosen PDF viewer.
|
||||
|
||||
For some options see [here](https://github.com/latex-lsp/texlab/wiki/Previewing).
|
||||
Note this is not all the options, but can act as a guide to help you along with custom configs.
|
||||
Note this is not all the options, but can act as a guide to help you
|
||||
along with custom configs.
|
||||
'';
|
||||
|
||||
package = mkOption {
|
||||
|
|
@ -239,7 +283,8 @@ in {
|
|||
type = str;
|
||||
default = cfg.pdfViewer.executable;
|
||||
description = ''
|
||||
Defines the executable of the PDF previewer. The previewer needs to support SyncTeX.
|
||||
Defines the executable of the PDF previewer. The previewer needs to
|
||||
support SyncTeX.
|
||||
|
||||
By default it is set to the executable of the pdfViewer option.
|
||||
'';
|
||||
|
|
@ -249,28 +294,37 @@ in {
|
|||
type = listOf str;
|
||||
default = cfg.pdfViewer.args;
|
||||
description = ''
|
||||
Defines additional arguments that are passed to the configured previewer to perform the forward search.
|
||||
The placeholders %f, %p, %l will be replaced by the server.
|
||||
Defines additional arguments that are passed to the configured
|
||||
previewer to perform the forward search.
|
||||
The placeholders `%f`, `%p`, `%l` will be replaced by the server.
|
||||
|
||||
By default it is set to the args of the pdfViewer option.
|
||||
|
||||
Placeholders:
|
||||
- %f: The path of the current TeX file.
|
||||
- %p: The path of the current PDF file.
|
||||
- %l: The current line number.
|
||||
- `%f`: The path of the current TeX file.
|
||||
- `%p`: The path of the current PDF file.
|
||||
- `%l`: The current line number.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
formatter = {
|
||||
formatterLineLength = mkOption {
|
||||
type = ints.positive;
|
||||
type = ints.unsigned;
|
||||
default = 80;
|
||||
description = "Defines the maximum amount of characters per line (0 = disable) when formatting BibTeX files.";
|
||||
description = ''
|
||||
Defines the maximum amount of characters per line when formatting
|
||||
BibTeX files.
|
||||
|
||||
Setting this value to 0 will disable this option.
|
||||
'';
|
||||
};
|
||||
|
||||
bibtexFormatter = mkOption {
|
||||
type = enum ["texlab" "latexindent"];
|
||||
type = enum [
|
||||
"texlab"
|
||||
"latexindent"
|
||||
];
|
||||
default = "texlab";
|
||||
description = ''
|
||||
Defines the formatter to use for BibTeX formatting.
|
||||
|
|
@ -279,7 +333,10 @@ in {
|
|||
};
|
||||
|
||||
latexFormatter = mkOption {
|
||||
type = enum ["texlab" "latexindent"];
|
||||
type = enum [
|
||||
"texlab"
|
||||
"latexindent"
|
||||
];
|
||||
default = "latexindent";
|
||||
description = ''
|
||||
Defines the formatter to use for LaTeX formatting.
|
||||
|
|
@ -290,14 +347,23 @@ in {
|
|||
};
|
||||
|
||||
inlayHints = {
|
||||
labelDefinitions = mkBool true "When enabled, the server will return inlay hints for `\\label`-like commands.";
|
||||
labelDefinitions = mkBool true ''
|
||||
When enabled, the server will return inlay hints for `\label`-like
|
||||
commands.
|
||||
'';
|
||||
|
||||
labelReferences = mkBool true "When enabled, the server will return inlay hints for `\\ref``-like commands.";
|
||||
labelReferences = mkBool true ''
|
||||
When enabled, the server will return inlay hints for `\ref`-like
|
||||
commands.
|
||||
'';
|
||||
|
||||
maxLength = mkOption {
|
||||
type = nullOr ints.positive;
|
||||
default = null;
|
||||
description = "When set, the server will truncate the text of the inlay hints to the specified length.";
|
||||
description = ''
|
||||
When set, the server will truncate the text of the inlay hints to the
|
||||
specified length.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -307,25 +373,33 @@ in {
|
|||
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.
|
||||
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.
|
||||
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"]);
|
||||
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
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
|
@ -338,15 +412,18 @@ in {
|
|||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
A list of regular expressions used to filter the list of reported document symbols.
|
||||
If specified, only symbols that match at least one of the specified patterns are sent to the client.
|
||||
Symbols are filtered recursively so nested symbols can still be sent to the client even though the
|
||||
parent node is removed from the results.
|
||||
A list of regular expressions used to filter the list of reported
|
||||
document symbols.
|
||||
If specified, only symbols that match at least one of the specified
|
||||
patterns are sent to the client.
|
||||
Symbols are filtered recursively so nested symbols can still be sent
|
||||
to the client even though the parent node is removed from the results.
|
||||
|
||||
See also `texlab.symbols.ignoredPatterns`.
|
||||
|
||||
Hint: If both allowedPatterns and ignoredPatterns are set, then allowed patterns are applied first.
|
||||
Afterwards, the results are filtered with the ignored patterns.
|
||||
Hint: If both `allowedPatterns` and `ignoredPatterns` are set, then
|
||||
allowed patterns are applied first. Afterwards, the results are
|
||||
filtered with the ignored patterns.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -354,8 +431,10 @@ in {
|
|||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
A list of regular expressions used to filter the list of reported document symbols.
|
||||
If specified, only symbols that match none of the specified patterns are sent to the client.
|
||||
A list of regular expressions used to filter the list of reported
|
||||
document symbols.
|
||||
If specified, only symbols that match none of the specified patterns
|
||||
are sent to the client.
|
||||
|
||||
See also `texlab.symbols.allowedPatterns`.
|
||||
'';
|
||||
|
|
@ -371,10 +450,14 @@ in {
|
|||
displayName = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "The name shown in the document symbols. Defaults to the value of `name`.";
|
||||
description = ''
|
||||
The name shown in the document symbols.
|
||||
Defaults to the value of `name`.
|
||||
'';
|
||||
};
|
||||
label = mkBool false ''
|
||||
If set, the server will try to match a label to environment and append its number.
|
||||
If set to `true`, the server will try to match a label to
|
||||
environment and append its number.
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
|
@ -387,9 +470,10 @@ in {
|
|||
}
|
||||
];
|
||||
description = ''
|
||||
A list of objects that allows extending the list of environments that are part of the document symbols.
|
||||
A list of objects that allows extending the list of environments that
|
||||
are part of the document symbols.
|
||||
|
||||
See also texlab.symbols.allowedPatterns.
|
||||
See also `texlab.symbols.allowedPatterns`.
|
||||
|
||||
Type: listOf submodule:
|
||||
- name:
|
||||
|
|
@ -402,11 +486,12 @@ in {
|
|||
- default: <name>
|
||||
- label:
|
||||
- type: boolean
|
||||
- description: If set, the server will try to match a label to environment and append its number.
|
||||
- description: If set, the server will try to match a label to
|
||||
environment and append its number.
|
||||
- default: false
|
||||
|
||||
Note: This functionality may not be working, please follow https://github.com/latex-lsp/texlab/pull/1311
|
||||
for status updates.
|
||||
Note: This functionality may not be working, please follow
|
||||
https://github.com/latex-lsp/texlab/pull/1311 for status updates.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue