Cleaned up documentation and other performed other code cleanups

This commit is contained in:
isaacST08 2025-02-11 21:14:24 -07:00
commit c3c720f4a2
13 changed files with 343 additions and 213 deletions

View file

@ -6,8 +6,7 @@
}: let
inherit (lib.options) mkOption;
inherit (lib.types) enum listOf package str;
inherit (lib.nvim.config) mkBool;
inherit (builtins) attrNames filter isAttrs hasAttr elemAt length;
inherit (builtins) attrNames;
cfg = config.vim.languages.tex;
in {

View file

@ -29,7 +29,10 @@ in (
executable = mkOption {
type = str;
default = "latexmk";
description = "The executable name from the build package that will be used to build/compile the tex.";
description = ''
The executable name from the build package that will be used to
build/compile the tex.
'';
};
# Flag options

View file

@ -12,7 +12,7 @@
inherit (lib) optionals;
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
inherit (lib.types) enum ints listOf str;
inherit (lib.types) enum ints listOf str nullOr;
inherit (lib.nvim.config) mkBool;
inherit (builtins) concatLists elem map toString;
@ -29,23 +29,32 @@ in (
executable = mkOption {
type = str;
default = "tectonic";
description = "The executable name from the build package that will be used to build/compile the tex.";
description = ''
The executable name from the build package that will be used to
build/compile the tex.
'';
};
# -- Flags --
keepIntermediates = mkBool false ''
Whether to keep the intermediate files generated during processing.
If texlab is reporting build errors when there shouldn't be, disable this option.
If texlab is reporting build errors when there shouldn't be, disable
this option.
'';
keepLogs = mkBool true ''
Whether to keep the log files generated during processing.
Without the keepLogs flag, texlab won't be able to report compilation warnings.
Without the keepLogs flag, texlab won't be able to report compilation
warnings.
'';
onlyCached = mkBool false ''
Whether to use only resource files cached locally
'';
onlyCached = mkBool false "Whether to use only resource files cached locally";
synctex = mkBool true "Whether to generate SyncTeX data";
untrustedInput = mkBool false "Whether to input is untrusted -- disable all known-insecure features";
untrustedInput = mkBool false ''
Whether to diable all known-insecure features if the input is untrusted
'';
# -- Options --
reruns = mkOption {
@ -62,28 +71,37 @@ in (
};
bundle = mkOption {
type = str;
default = "";
description = "Use this directory or Zip-format bundle file to find resource files instead of the default";
type = nullOr str;
default = null;
description = ''
Use this directory or Zip-format bundle file to find resource files
instead of the default.
'';
};
webBundle = mkOption {
type = str;
default = "";
description = "Use this URL to find resource files instead of the default";
type = nullOr str;
default = null;
description = ''
Use this URL to find resource files instead of the default.
'';
};
outfmt = mkOption {
type = enum [
type = nullOr (enum [
"pdf"
"html"
"xdv"
"aux"
"fmt"
""
];
default = "";
description = "The kind of output to generate";
]);
default = null;
description = ''
The kind of output to generate.
Setting this to `null` (default) will let tectonic decide the most
appropriate output format, which usually be a pdf.
'';
};
hidePaths = mkOption {
@ -93,23 +111,27 @@ in (
"./secrets.tex"
"./passwords.tex"
];
description = "Tell the engine that no file at <hide_path> exists, if it tries to read it.";
description = ''
Tell the engine that no file at `<path/to/hide>` exists, if it tries
to read it.
'';
};
format = mkOption {
type = str;
default = "";
description = "The name of the \"format\" file used to initialize the TeX engine";
type = nullOr str;
default = null;
description = ''
The name of the \"format\" file used to initialize the TeX engine.
'';
};
color = mkOption {
type = enum [
type = nullOr (enum [
"always"
"auto"
"never"
""
];
default = "";
]);
default = null;
example = "always";
description = "Enable/disable colorful log output";
};
@ -118,8 +140,10 @@ in (
type = listOf str;
default = [];
description = ''
Add extra command line options to include in the tectonic build command.
Extra options added here will not overwrite the options set in as nvf options.
Add extra command line options to include in the tectonic build
command.
Extra options added here will not overwrite the options set in as nvf
options.
'';
};
};
@ -139,12 +163,12 @@ in (
++ (optionals builderCfg.untrustedInput ["--untrusted"])
# Options
++ (optionals (builderCfg.reruns > 0) ["--reruns" "${toString builderCfg.reruns}"])
++ (optionals (builderCfg.bundle != "") ["--bundle" "${toString builderCfg.bundle}"])
++ (optionals (builderCfg.webBundle != "") ["--web-bundle" "${toString builderCfg.webBundle}"])
++ (optionals (builderCfg.outfmt != "") ["--outfmt" "${toString builderCfg.outfmt}"])
++ (optionals (builderCfg.bundle != null) ["--bundle" "${toString builderCfg.bundle}"])
++ (optionals (builderCfg.webBundle != null) ["--web-bundle" "${toString builderCfg.webBundle}"])
++ (optionals (builderCfg.outfmt != null) ["--outfmt" "${toString builderCfg.outfmt}"])
++ (concatLists (map (x: ["--hide" x]) builderCfg.hidePaths))
++ (optionals (builderCfg.format != "") ["--format" "${toString builderCfg.format}"])
++ (optionals (builderCfg.color != "") ["--color" "${toString builderCfg.color}"])
++ (optionals (builderCfg.format != null) ["--format" "${toString builderCfg.format}"])
++ (optionals (builderCfg.color != null) ["--color" "${toString builderCfg.color}"])
# Still options but these are not defined by builder specific options but
# instead synchronize options between the global build options and builder
# specific options

View file

@ -3,11 +3,11 @@
lib,
...
}: let
inherit (lib.options) mkOption;
inherit (lib.modules) mkIf;
inherit (lib.types) str nullOr;
inherit (builtins) filter isAttrs hasAttr attrNames length elemAt;
inherit (lib.modules) mkIf;
inherit (lib.nvim.config) mkBool;
inherit (lib.options) mkOption;
inherit (lib.types) str nullOr;
cfg = config.vim.languages.tex;
@ -48,20 +48,28 @@ in {
];
options.vim.languages.tex.build = {
enable =
mkBool (enabledBuildersCount == 1) ''
Whether to enable configuring the builder.
enable = mkBool (enabledBuildersCount == 1) ''
Whether to enable configuring the builder.
By enabling any of the builders, this option will be automatically set.
If you enable more than one builder then an error will be thrown.
'';
By enabling any of the builders, this option will be automatically set.
If you enable more than one builder then an error will be thrown.
'';
forwardSearchAfter = mkBool false "Set this property to true if you want to execute a forward search after a build.";
forwardSearchAfter = mkBool false ''
Set this property to `true` if you want to execute a forward search after
a build.
onSave = mkBool false "Set this property to true if you want to compile the project after saving a file.";
This can also be thought of as enabling auto updating for your pdf viewer.
'';
onSave = mkBool false ''
Set this property to `true` if you want to compile the project after
saving a file.
'';
useFileList = mkBool false ''
When set to `true`, the server will use the `.fls` files produced by the TeX engine as an additional input for the project detection.
When set to `true`, the server will use the `.fls` files produced by the
TeX engine as an additional input for the project detection.
Note that enabling this property might have an impact on performance.
'';
@ -70,10 +78,12 @@ in {
type = str;
default = ".";
description = ''
When not using latexmk, provides a way to define the directory containing the .aux files.
Note that you need to set the aux directory in latex.build.args too.
When not using latexmk, provides a way to define the directory
containing the `.aux` files.
Note that you need to set the aux directory in `latex.build.args` too.
When using a latexmkrc file, texlab will automatically infer the correct setting.
When using a latexmkrc file, texlab will automatically infer the correct
setting.
'';
};
@ -81,10 +91,13 @@ in {
type = str;
default = ".";
description = ''
When not using latexmk, provides a way to define the directory containing the build log files.
Note that you need to change the output directory in your build arguments too.
When not using latexmk, provides a way to define the directory
containing the build log files.
Note that you need to change the output directory in your build
arguments too.
When using a latexmkrc file, texlab will automatically infer the correct setting.
When using a latexmkrc file, texlab will automatically infer the correct
setting.
'';
};
@ -92,10 +105,13 @@ in {
type = str;
default = ".";
description = ''
When not using latexmk, provides a way to define the directory containing the output files.
Note that you need to set the output directory in latex.build.args too.
When not using latexmk, provides a way to define the directory
containing the output files.
Note that you need to set the output directory in `latex.build.args`
too.
When using a latexmkrc file, texlab will automatically infer the correct setting.
When using a latexmkrc file, texlab will automatically infer the correct
setting.
'';
};
@ -104,17 +120,20 @@ in {
default = null;
description = ''
Allows overriding the default file name of the build artifact.
This setting is used to find the correct PDF file to open during forward search.
This setting is used to find the correct PDF file to open during forward
search.
'';
};
};
config = mkIf (enabledBuildersCount > 0) {
assertions = [
{
assertion = (enabledBuildersCount < 2);
message = "The nvf-tex-language implementation does not support having more than 1 builders enabled.";
assertion = enabledBuildersCount < 2;
message = ''
The nvf-tex-language implementation does not support having more than
1 builders enabled.
'';
}
];
};