mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +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 = {
|
||||
extraOptions = {
|
||||
autoSetFiletype = mkOption {
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
{ lib, helpers }:
|
||||
with lib;
|
||||
{ lib }:
|
||||
|
||||
# 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
|
||||
configuration, e.g. `$dir/$name` (default) and `$root/target/$dir/$name`.
|
||||
'';
|
||||
|
||||
exportPdf =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"auto"
|
||||
"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.
|
||||
'';
|
||||
|
||||
rootPath = helpers.mkNullOrStr ''
|
||||
rootPath = mkNullOrStr ''
|
||||
Configure the root for absolute paths in typst.
|
||||
'';
|
||||
|
||||
semanticTokens =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"enable"
|
||||
"disable"
|
||||
|
@ -44,22 +48,22 @@ with lib;
|
|||
- `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
|
||||
ensuring reproducible compilation.
|
||||
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.
|
||||
Note: you can use vscode variables in the path, e.g. `$\{workspaceFolder}/fonts`.
|
||||
'';
|
||||
|
||||
compileStatus =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"enable"
|
||||
"disable"
|
||||
"enable"
|
||||
]
|
||||
''
|
||||
In VSCode, enable compile status meaning that the extension will show the compilation status in
|
||||
|
@ -69,7 +73,7 @@ with lib;
|
|||
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
|
||||
**same version** of typst-cli.
|
||||
|
||||
|
@ -77,24 +81,8 @@ with lib;
|
|||
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 =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"disable"
|
||||
"typstyle"
|
||||
|
@ -108,10 +96,54 @@ with lib;
|
|||
- `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.
|
||||
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.
|
||||
'';
|
||||
|
||||
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.
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue