mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-10 15:35:30 +00:00
Created function to simplify converting a string into lua format and removed null default values
This commit is contained in:
parent
97b4dd88ef
commit
23f2b22ae7
1 changed files with 8 additions and 4 deletions
|
|
@ -152,7 +152,7 @@ in
|
||||||
};
|
};
|
||||||
filename = mkOption {
|
filename = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = null;
|
default = "";
|
||||||
description = ''
|
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.
|
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.
|
||||||
'';
|
'';
|
||||||
|
|
@ -269,12 +269,16 @@ in
|
||||||
;
|
;
|
||||||
tl = cfg.lsp.texlab;
|
tl = cfg.lsp.texlab;
|
||||||
build = tl.build;
|
build = tl.build;
|
||||||
|
|
||||||
listToLua =
|
listToLua =
|
||||||
list: nullOnEmpty:
|
list: nullOnEmpty:
|
||||||
if length list == 0 then
|
if length list == 0 then
|
||||||
if nullOnEmpty then "null" else "{ }"
|
if nullOnEmpty then "null" else "{ }"
|
||||||
else
|
else
|
||||||
"{ ${concatStringsSep ", " (map (x: ''"${toString x}"'') list)} }";
|
"{ ${concatStringsSep ", " (map (x: ''"${toString x}"'') list)} }";
|
||||||
|
|
||||||
|
stringToLua =
|
||||||
|
string: nullOnEmpty: if string == "" then if nullOnEmpty then "null" else "" else ''"${string}"'';
|
||||||
in
|
in
|
||||||
(mkIf tl.enable {
|
(mkIf tl.enable {
|
||||||
vim.lsp.lspconfig.sources.texlab = ''
|
vim.lsp.lspconfig.sources.texlab = ''
|
||||||
|
|
@ -287,9 +291,9 @@ in
|
||||||
forwardSearchAfter = ${toString build.forwardSearchAfter},
|
forwardSearchAfter = ${toString build.forwardSearchAfter},
|
||||||
onSave = ${toString build.onSave},
|
onSave = ${toString build.onSave},
|
||||||
useFileList = ${toString build.useFileList},
|
useFileList = ${toString build.useFileList},
|
||||||
auxDirectory = "${toString build.auxDirectory}",
|
auxDirectory = ${stringToLua build.auxDirectory true},
|
||||||
logDirectory = "${toString build.logDirectory}",
|
logDirectory = ${stringToLua build.logDirectory true},
|
||||||
pdfDirectory = "${toString build.pdfDirectory}",
|
pdfDirectory = ${stringToLua build.pdfDirectory true},
|
||||||
${if build.filename != null then ''filename = "${build.filename}",'' else ""}
|
${if build.filename != null then ''filename = "${build.filename}",'' else ""}
|
||||||
},
|
},
|
||||||
forwardSearch = {
|
forwardSearch = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue