mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/lsp: fix tinymist implementation and update options
This commit is contained in:
parent
95361fda3c
commit
94535b24a2
3 changed files with 72 additions and 32 deletions
|
@ -126,6 +126,9 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
tinymist = {
|
||||||
|
settingsOptions = import ./tinymist-settings.nix { inherit lib; };
|
||||||
|
};
|
||||||
vls = {
|
vls = {
|
||||||
extraOptions = {
|
extraOptions = {
|
||||||
autoSetFiletype = mkOption {
|
autoSetFiletype = mkOption {
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
{ lib, helpers }:
|
{ lib }:
|
||||||
with lib;
|
|
||||||
# https://github.com/Myriad-Dreamin/tinymist/blob/main/editors/neovim/Configuration.md
|
# https://github.com/Myriad-Dreamin/tinymist/blob/main/editors/neovim/Configuration.md
|
||||||
|
let
|
||||||
|
inherit (lib.nixvim) defaultNullOpts mkNullOrOption mkNullOrStr;
|
||||||
|
inherit (lib) types;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
outputPath = helpers.defaultNullOpts.mkStr "$dir/$name" ''
|
outputPath = defaultNullOpts.mkStr "$dir/$name" ''
|
||||||
The path pattern to store Typst artifacts, you can use `$root` or `$dir` or `$name` to do magic
|
The path pattern to store Typst artifacts, you can use `$root` or `$dir` or `$name` to do magic
|
||||||
configuration, e.g. `$dir/$name` (default) and `$root/target/$dir/$name`.
|
configuration, e.g. `$dir/$name` (default) and `$root/target/$dir/$name`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
exportPdf =
|
exportPdf =
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
defaultNullOpts.mkEnumFirstDefault
|
||||||
[
|
[
|
||||||
"auto"
|
"auto"
|
||||||
"never"
|
"never"
|
||||||
|
@ -27,12 +31,12 @@ with lib;
|
||||||
- `onDocumentHasTitle`: Export PDFs when a document has a title (and save a file), which is useful to filter out template files.
|
- `onDocumentHasTitle`: Export PDFs when a document has a title (and save a file), which is useful to filter out template files.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
rootPath = helpers.mkNullOrStr ''
|
rootPath = mkNullOrStr ''
|
||||||
Configure the root for absolute paths in typst.
|
Configure the root for absolute paths in typst.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
semanticTokens =
|
semanticTokens =
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
defaultNullOpts.mkEnumFirstDefault
|
||||||
[
|
[
|
||||||
"enable"
|
"enable"
|
||||||
"disable"
|
"disable"
|
||||||
|
@ -44,22 +48,22 @@ with lib;
|
||||||
- `disable`: Do not use semantic tokens for syntax highlighting
|
- `disable`: Do not use semantic tokens for syntax highlighting
|
||||||
'';
|
'';
|
||||||
|
|
||||||
systemFonts = helpers.defaultNullOpts.mkBool true ''
|
systemFonts = defaultNullOpts.mkBool true ''
|
||||||
A flag that determines whether to load system fonts for Typst compiler, which is useful for
|
A flag that determines whether to load system fonts for Typst compiler, which is useful for
|
||||||
ensuring reproducible compilation.
|
ensuring reproducible compilation.
|
||||||
If set to null or not set, the extension will use the default behavior of the Typst compiler.
|
If set to null or not set, the extension will use the default behavior of the Typst compiler.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
fontPaths = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
fontPaths = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Font paths, which doesn't allow for dynamic configuration.
|
Font paths, which doesn't allow for dynamic configuration.
|
||||||
Note: you can use vscode variables in the path, e.g. `$\{workspaceFolder}/fonts`.
|
Note: you can use vscode variables in the path, e.g. `$\{workspaceFolder}/fonts`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
compileStatus =
|
compileStatus =
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
defaultNullOpts.mkEnumFirstDefault
|
||||||
[
|
[
|
||||||
"enable"
|
|
||||||
"disable"
|
"disable"
|
||||||
|
"enable"
|
||||||
]
|
]
|
||||||
''
|
''
|
||||||
In VSCode, enable compile status meaning that the extension will show the compilation status in
|
In VSCode, enable compile status meaning that the extension will show the compilation status in
|
||||||
|
@ -69,7 +73,7 @@ with lib;
|
||||||
server level.
|
server level.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
typstExtraArgs = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
typstExtraArgs = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
You can pass any arguments as you like, and we will try to follow behaviors of the
|
You can pass any arguments as you like, and we will try to follow behaviors of the
|
||||||
**same version** of typst-cli.
|
**same version** of typst-cli.
|
||||||
|
|
||||||
|
@ -77,24 +81,8 @@ with lib;
|
||||||
For example, `--font-path` will be overridden by `tinymist.fontPaths`.
|
For example, `--font-path` will be overridden by `tinymist.fontPaths`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
serverPath = helpers.mkNullOrStr ''
|
|
||||||
The extension can use a local tinymist executable instead of the one bundled with the extension.
|
|
||||||
This setting controls the path to the executable.
|
|
||||||
'';
|
|
||||||
|
|
||||||
"trace.server" =
|
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
|
||||||
[
|
|
||||||
"off"
|
|
||||||
"messages"
|
|
||||||
"verbose"
|
|
||||||
]
|
|
||||||
''
|
|
||||||
Traces the communication between VS Code and the language server.
|
|
||||||
'';
|
|
||||||
|
|
||||||
formatterMode =
|
formatterMode =
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
defaultNullOpts.mkEnumFirstDefault
|
||||||
[
|
[
|
||||||
"disable"
|
"disable"
|
||||||
"typstyle"
|
"typstyle"
|
||||||
|
@ -108,10 +96,54 @@ with lib;
|
||||||
- `typstfmt`: Use typstfmt formatter.
|
- `typstfmt`: Use typstfmt formatter.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
formatterPrintWidth = helpers.defaultNullOpts.mkUnsignedInt 120 ''
|
formatterPrintWidth = defaultNullOpts.mkUnsignedInt 120 ''
|
||||||
Set the print width for the formatter, which is a **soft limit** of characters per line.
|
Set the print width for the formatter, which is a **soft limit** of characters per line.
|
||||||
See [the definition of *Print Width*](https://prettier.io/docs/en/options.html#print-width).
|
See [the definition of *Print Width*](https://prettier.io/docs/en/options.html#print-width).
|
||||||
|
|
||||||
Note: this has lower priority than the formatter's specific configurations.
|
Note: this has lower priority than the formatter's specific configurations.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
completion = {
|
||||||
|
triggerOnSnippetPlaceholders = mkNullOrOption types.bool ''
|
||||||
|
Whether to trigger completions on arguments (placeholders) of snippets.
|
||||||
|
|
||||||
|
For example, `box` will be completed to `box(|)`, and server will request the editor (lsp
|
||||||
|
client) to request completion after moving cursor to the placeholder in the snippet.
|
||||||
|
|
||||||
|
Note: this has no effect if the editor doesn't support `editor.action.triggerSuggest` or
|
||||||
|
`tinymist.triggerSuggestAndParameterHints` command.
|
||||||
|
|
||||||
|
Hint: Restarting the editor is required to change this setting.
|
||||||
|
'';
|
||||||
|
|
||||||
|
postfix = defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable postfix code completion.
|
||||||
|
For example, `[A].box|` will be completed to `box[A]|`.
|
||||||
|
|
||||||
|
Hint: Restarting the editor is required to change this setting.
|
||||||
|
'';
|
||||||
|
|
||||||
|
postfixUfcs = defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable UFCS-style completion.
|
||||||
|
|
||||||
|
For example, `[A].box|` will be completed to `box[A]|`.
|
||||||
|
Hint: Restarting the editor is required to change this setting.
|
||||||
|
'';
|
||||||
|
|
||||||
|
postfixUfcsLeft = defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable left-variant UFCS-style completion.
|
||||||
|
|
||||||
|
For example, `[A].table|` will be completed to `table(|)[A]`.
|
||||||
|
|
||||||
|
Hint: Restarting the editor is required to change this setting.
|
||||||
|
'';
|
||||||
|
|
||||||
|
postfixUfcsRight = defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable right-variant UFCS-style completion.
|
||||||
|
|
||||||
|
For example, `[A].table|` will be completed to `table([A], |)`.
|
||||||
|
|
||||||
|
Hint: Restarting the editor is required to change this setting.
|
||||||
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,17 @@
|
||||||
semanticTokens = "enable";
|
semanticTokens = "enable";
|
||||||
systemFonts = true;
|
systemFonts = true;
|
||||||
fontPaths = [ ];
|
fontPaths = [ ];
|
||||||
compileStatus = "enable";
|
compileStatus = "disable";
|
||||||
typstExtraArgs = [ ];
|
typstExtraArgs = [ ];
|
||||||
serverPath = null;
|
|
||||||
"trace.server" = "off";
|
|
||||||
formatterMode = "disable";
|
formatterMode = "disable";
|
||||||
formatterPrintWidth = 120;
|
formatterPrintWidth = 120;
|
||||||
|
completion = {
|
||||||
|
triggerOnSnippetPlaceholders = null;
|
||||||
|
postfix = true;
|
||||||
|
postfixUfcs = true;
|
||||||
|
postfixUfcsLeft = true;
|
||||||
|
postfixUfcsRight = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue