mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/lsp: modernize implem of language-servers
This commit is contained in:
parent
57464f22bb
commit
e6018ac195
12 changed files with 618 additions and 598 deletions
|
@ -1,18 +1,18 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
|
||||||
let
|
let
|
||||||
cfg = config.plugins.lsp.servers.ccls;
|
cfg = config.plugins.lsp.servers.ccls;
|
||||||
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
inherit (lib) types;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Options: https://github.com/MaskRay/ccls/wiki/Customization#initialization-options
|
# Options: https://github.com/MaskRay/ccls/wiki/Customization#initialization-options
|
||||||
options.plugins.lsp.servers.ccls.initOptions = {
|
options.plugins.lsp.servers.ccls.initOptions = {
|
||||||
cache = {
|
cache = {
|
||||||
directory = helpers.defaultNullOpts.mkStr ".ccls-cache" ''
|
directory = defaultNullOpts.mkStr ".ccls-cache" ''
|
||||||
If your project is `/a/b`, cache directories will be created at `/a/b/.ccls-cache/@a@b/`
|
If your project is `/a/b`, cache directories will be created at `/a/b/.ccls-cache/@a@b/`
|
||||||
(files under the project root) `/a/b/.ccls-cache/@@a@b/` (files outside the project root,
|
(files under the project root) `/a/b/.ccls-cache/@@a@b/` (files outside the project root,
|
||||||
e.g. /usr/include/stdio.h).
|
e.g. /usr/include/stdio.h).
|
||||||
|
@ -36,7 +36,7 @@ in
|
||||||
Example: `"/tmp/ccls-cache"`
|
Example: `"/tmp/ccls-cache"`
|
||||||
'';
|
'';
|
||||||
|
|
||||||
format = helpers.defaultNullOpts.mkStr "binary" ''
|
format = defaultNullOpts.mkStr "binary" ''
|
||||||
Specify the format of the cached index files.
|
Specify the format of the cached index files.
|
||||||
Binary is a compact binary serialization format.
|
Binary is a compact binary serialization format.
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
retainInMemory =
|
retainInMemory =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
0
|
0
|
||||||
1
|
1
|
||||||
|
@ -69,13 +69,13 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
clang = {
|
clang = {
|
||||||
extraArgs = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
extraArgs = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Additional arguments for `compile_commands.json` entries.
|
Additional arguments for `compile_commands.json` entries.
|
||||||
|
|
||||||
Example: `["-frounding-math"]`
|
Example: `["-frounding-math"]`
|
||||||
'';
|
'';
|
||||||
|
|
||||||
excludeArgs = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
excludeArgs = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Excluded arguments for `compile_commands.json` entries.
|
Excluded arguments for `compile_commands.json` entries.
|
||||||
|
|
||||||
If your compiler is not Clang and it supports arguments which Clang doesn't understand, then
|
If your compiler is not Clang and it supports arguments which Clang doesn't understand, then
|
||||||
|
@ -84,7 +84,7 @@ in
|
||||||
Example: `["-frounding-math"]`
|
Example: `["-frounding-math"]`
|
||||||
'';
|
'';
|
||||||
|
|
||||||
pathMappings = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
pathMappings = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
A list of `src>dest` path conversions used to remap the paths of files in the project.
|
A list of `src>dest` path conversions used to remap the paths of files in the project.
|
||||||
This can be used to move a project to a new location without re-indexing.
|
This can be used to move a project to a new location without re-indexing.
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ in
|
||||||
`/tmp/remote` paths any more.
|
`/tmp/remote` paths any more.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
resourceDir = helpers.defaultNullOpts.mkStr "" ''
|
resourceDir = defaultNullOpts.mkStr "" ''
|
||||||
The clang resource directory (something like `.../lib/clang/9.0.0`) is hard-coded into ccls
|
The clang resource directory (something like `.../lib/clang/9.0.0`) is hard-coded into ccls
|
||||||
at compile time.
|
at compile time.
|
||||||
You should be able to find `<resourceDir>/include/stddef.h`.
|
You should be able to find `<resourceDir>/include/stddef.h`.
|
||||||
|
@ -115,7 +115,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
client = {
|
client = {
|
||||||
snippetSupport = helpers.defaultNullOpts.mkBool true ''
|
snippetSupport = defaultNullOpts.mkBool true ''
|
||||||
`client.snippetSupport` and `completion.placeholder` (default: true) decide the completion
|
`client.snippetSupport` and `completion.placeholder` (default: true) decide the completion
|
||||||
style.
|
style.
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
completion = {
|
completion = {
|
||||||
placeholder = helpers.defaultNullOpts.mkBool false ''
|
placeholder = defaultNullOpts.mkBool false ''
|
||||||
`client.snippetSupport` and `completion.placeholder` (default: true) decide the completion
|
`client.snippetSupport` and `completion.placeholder` (default: true) decide the completion
|
||||||
style.
|
style.
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ in
|
||||||
forced to `false`.
|
forced to `false`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
detailedLabel = helpers.defaultNullOpts.mkBool true ''
|
detailedLabel = defaultNullOpts.mkBool true ''
|
||||||
When this option is enabled, `label` and `detailed` are re-purposed:
|
When this option is enabled, `label` and `detailed` are re-purposed:
|
||||||
|
|
||||||
- `label`: detailed function signature, e.g. `foo(int a, int b) -> bool`
|
- `label`: detailed function signature, e.g. `foo(int a, int b) -> bool`
|
||||||
|
@ -151,7 +151,7 @@ in
|
||||||
context is `S`.
|
context is `S`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
filterAndSort = helpers.defaultNullOpts.mkBool true ''
|
filterAndSort = defaultNullOpts.mkBool true ''
|
||||||
`ccls` filters and sorts completions to try to be nicer to clients that can't handle big
|
`ccls` filters and sorts completions to try to be nicer to clients that can't handle big
|
||||||
numbers of completion candidates.
|
numbers of completion candidates.
|
||||||
This behaviour can be disabled by specifying `false` for the option.
|
This behaviour can be disabled by specifying `false` for the option.
|
||||||
|
@ -160,7 +160,7 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
compilationDatabaseDirectory = helpers.defaultNullOpts.mkStr "" ''
|
compilationDatabaseDirectory = defaultNullOpts.mkStr "" ''
|
||||||
If not empty, look for `compile_commands.json` in it, otherwise the file is retrieved in the
|
If not empty, look for `compile_commands.json` in it, otherwise the file is retrieved in the
|
||||||
project root.
|
project root.
|
||||||
|
|
||||||
|
@ -171,12 +171,12 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
onOpen = helpers.defaultNullOpts.mkInt 0 ''
|
onOpen = defaultNullOpts.mkInt 0 ''
|
||||||
Time (in milliseconds) to wait before computing diagnostics for `textDocument/didOpen`.
|
Time (in milliseconds) to wait before computing diagnostics for `textDocument/didOpen`.
|
||||||
How long to wait before diagnostics are emitted when a document is opened.
|
How long to wait before diagnostics are emitted when a document is opened.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
onChange = helpers.defaultNullOpts.mkInt 1000 ''
|
onChange = defaultNullOpts.mkInt 1000 ''
|
||||||
Time (in milliseconds) to wait before computing diagnostics for `textDocument/didChange`.
|
Time (in milliseconds) to wait before computing diagnostics for `textDocument/didChange`.
|
||||||
After receiving a `textDocument/didChange`, wait up to this long before reporting
|
After receiving a `textDocument/didChange`, wait up to this long before reporting
|
||||||
diagnostics.
|
diagnostics.
|
||||||
|
@ -186,21 +186,21 @@ in
|
||||||
If `1000` makes you feel slow, consider setting this to `1`.
|
If `1000` makes you feel slow, consider setting this to `1`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
onSave = helpers.defaultNullOpts.mkInt 0 ''
|
onSave = defaultNullOpts.mkInt 0 ''
|
||||||
Time (in milliseconds) to wait before computing diagnostics for `textDocument/didSave`.
|
Time (in milliseconds) to wait before computing diagnostics for `textDocument/didSave`.
|
||||||
How long to wait before diagnostics are emitted after a document is saved.
|
How long to wait before diagnostics are emitted after a document is saved.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
index = {
|
index = {
|
||||||
threads = helpers.defaultNullOpts.mkInt 0 ''
|
threads = defaultNullOpts.mkInt 0 ''
|
||||||
How many threads to start when indexing a project.
|
How many threads to start when indexing a project.
|
||||||
`0` means use `std::thread::hardware_concurrency()` (the number of cores the system has).
|
`0` means use `std::thread::hardware_concurrency()` (the number of cores the system has).
|
||||||
If you want to reduce peak CPU and memory usage, set it to a small integer.
|
If you want to reduce peak CPU and memory usage, set it to a small integer.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
comments =
|
comments =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
0
|
0
|
||||||
1
|
1
|
||||||
|
@ -218,7 +218,7 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
multiVersion =
|
multiVersion =
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
defaultNullOpts.mkEnumFirstDefault
|
||||||
[
|
[
|
||||||
0
|
0
|
||||||
1
|
1
|
||||||
|
@ -238,7 +238,7 @@ in
|
||||||
Also consider using `index.multiVersionBlacklist` to exclude system headers.
|
Also consider using `index.multiVersionBlacklist` to exclude system headers.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
multiVersionBlacklist = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
multiVersionBlacklist = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
A list of regular expressions matching files that should not be indexed via multi-version
|
A list of regular expressions matching files that should not be indexed via multi-version
|
||||||
if `index.multiVersion` is set to `1`.
|
if `index.multiVersion` is set to `1`.
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ in
|
||||||
Example: `["^/usr/include"]`
|
Example: `["^/usr/include"]`
|
||||||
'';
|
'';
|
||||||
|
|
||||||
initialBlacklist = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
initialBlacklist = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
A list of regular expressions matching files that should not be indexed when the `ccls`
|
A list of regular expressions matching files that should not be indexed when the `ccls`
|
||||||
server starts up, but will still be indexed if a client opens them.
|
server starts up, but will still be indexed if a client opens them.
|
||||||
If there are areas of the project that you have no interest in indexing you can use this to
|
If there are areas of the project that you have no interest in indexing you can use this to
|
||||||
|
@ -265,7 +265,7 @@ in
|
||||||
Example: `["."]` (matches all files)
|
Example: `["."]` (matches all files)
|
||||||
'';
|
'';
|
||||||
|
|
||||||
onChange = helpers.defaultNullOpts.mkBool false ''
|
onChange = defaultNullOpts.mkBool false ''
|
||||||
If `false`, a file is re-indexed when saved, updating the global index incrementally.
|
If `false`, a file is re-indexed when saved, updating the global index incrementally.
|
||||||
|
|
||||||
If set to `true`, a document is re-indexed for every (unsaved) change.
|
If set to `true`, a document is re-indexed for every (unsaved) change.
|
||||||
|
@ -275,7 +275,7 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
trackDependency =
|
trackDependency =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
0
|
0
|
||||||
1
|
1
|
||||||
|
@ -297,5 +297,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable { plugins.lsp.servers.ccls.extraOptions.init_options = cfg.initOptions; };
|
config = lib.mkIf cfg.enable {
|
||||||
|
plugins.lsp.servers.ccls.extraOptions.init_options = cfg.initOptions;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,35 @@
|
||||||
{ lib, helpers }:
|
{ lib, ... }:
|
||||||
with lib;
|
let
|
||||||
|
inherit (lib.nixvim) mkNullOrOption;
|
||||||
|
inherit (lib) types;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
analysisExcludedFolders = helpers.mkNullOrOption (with types; listOf str) ''
|
analysisExcludedFolders = mkNullOrOption (with types; listOf str) ''
|
||||||
An array of paths (absolute or relative to each workspace folder) that should be excluded from
|
An array of paths (absolute or relative to each workspace folder) that should be excluded from
|
||||||
analysis.
|
analysis.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enableSdkFormatter = helpers.mkNullOrOption types.bool ''
|
enableSdkFormatter = mkNullOrOption types.bool ''
|
||||||
When set to false, prevents registration (or unregisters) the SDK formatter.
|
When set to false, prevents registration (or unregisters) the SDK formatter.
|
||||||
When set to true or not supplied, will register/reregister the SDK formatter
|
When set to true or not supplied, will register/reregister the SDK formatter
|
||||||
'';
|
'';
|
||||||
|
|
||||||
lineLength = helpers.mkNullOrOption types.ints.unsigned ''
|
lineLength = mkNullOrOption types.ints.unsigned ''
|
||||||
The number of characters the formatter should wrap code at.
|
The number of characters the formatter should wrap code at.
|
||||||
If unspecified, code will be wrapped at 80 characters.
|
If unspecified, code will be wrapped at 80 characters.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
completeFunctionCalls = helpers.mkNullOrOption types.bool ''
|
completeFunctionCalls = mkNullOrOption types.bool ''
|
||||||
When set to true, completes functions/methods with their required parameters.
|
When set to true, completes functions/methods with their required parameters.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
showTodos = helpers.mkNullOrOption types.bool ''
|
showTodos = mkNullOrOption types.bool ''
|
||||||
Whether to generate diagnostics for TODO comments.
|
Whether to generate diagnostics for TODO comments.
|
||||||
If unspecified, diagnostics will not be generated.
|
If unspecified, diagnostics will not be generated.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
renameFilesWithClasses =
|
renameFilesWithClasses =
|
||||||
helpers.mkNullOrOption
|
mkNullOrOption
|
||||||
(types.enum [
|
(types.enum [
|
||||||
"always"
|
"always"
|
||||||
"prompt"
|
"prompt"
|
||||||
|
@ -41,18 +44,18 @@ with lib;
|
||||||
included in the resulting `WorkspaceEdit` and must be handled by the client.
|
included in the resulting `WorkspaceEdit` and must be handled by the client.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enableSnippets = helpers.mkNullOrOption types.bool ''
|
enableSnippets = mkNullOrOption types.bool ''
|
||||||
Whether to include code snippets (such as class, stful, switch) in code completion.
|
Whether to include code snippets (such as class, stful, switch) in code completion.
|
||||||
When unspecified, snippets will be included.
|
When unspecified, snippets will be included.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
updateImportsOnRename = helpers.mkNullOrOption types.bool ''
|
updateImportsOnRename = mkNullOrOption types.bool ''
|
||||||
Whether to update imports and other directives when files are renamed.
|
Whether to update imports and other directives when files are renamed.
|
||||||
When unspecified, imports will be updated if the client supports `willRenameFiles` requests.
|
When unspecified, imports will be updated if the client supports `willRenameFiles` requests.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
documentation =
|
documentation =
|
||||||
helpers.mkNullOrOption
|
mkNullOrOption
|
||||||
(types.enum [
|
(types.enum [
|
||||||
"none"
|
"none"
|
||||||
"summary"
|
"summary"
|
||||||
|
@ -64,7 +67,7 @@ with lib;
|
||||||
If not set, defaults to `"full"`.
|
If not set, defaults to `"full"`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
includeDependenciesInWorkspaceSymbols = helpers.mkNullOrOption types.bool ''
|
includeDependenciesInWorkspaceSymbols = mkNullOrOption types.bool ''
|
||||||
Whether to include symbols from dependencies and Dart/Flutter SDKs in Workspace Symbol results.
|
Whether to include symbols from dependencies and Dart/Flutter SDKs in Workspace Symbol results.
|
||||||
If not set, defaults to true.
|
If not set, defaults to true.
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -4,24 +4,24 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
|
||||||
let
|
let
|
||||||
cfg = config.plugins.lsp.servers.hls;
|
cfg = config.plugins.lsp.servers.hls;
|
||||||
|
inherit (lib) types;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.lsp.servers.hls = {
|
options.plugins.lsp.servers.hls = {
|
||||||
installGhc = mkOption {
|
installGhc = lib.mkOption {
|
||||||
type = with types; nullOr bool;
|
type = with types; nullOr bool;
|
||||||
default = null;
|
default = null;
|
||||||
example = true;
|
example = true;
|
||||||
description = "Whether to install `ghc`.";
|
description = "Whether to install `ghc`.";
|
||||||
};
|
};
|
||||||
|
|
||||||
ghcPackage = mkPackageOption pkgs "ghc" { };
|
ghcPackage = lib.mkPackageOption pkgs "ghc" { };
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
warnings = optional (cfg.installGhc == null) ''
|
warnings = lib.optional (cfg.installGhc == null) ''
|
||||||
`hls` relies on `ghc` (the Glasgow Haskell Compiler).
|
`hls` relies on `ghc` (the Glasgow Haskell Compiler).
|
||||||
- Set `plugins.lsp.servers.hls.installGhc = true` to install it automatically with Nixvim.
|
- Set `plugins.lsp.servers.hls.installGhc = true` to install it automatically with Nixvim.
|
||||||
You can customize which package to install by changing `plugins.lsp.servers.hls.ghcPackage`.
|
You can customize which package to install by changing `plugins.lsp.servers.hls.ghcPackage`.
|
||||||
|
@ -29,6 +29,6 @@ in
|
||||||
By doing so, you will dismiss this warning.
|
By doing so, you will dismiss this warning.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
extraPackages = with pkgs; (optional ((isBool cfg.installGhc) && cfg.installGhc) cfg.ghcPackage);
|
extraPackages = lib.optional ((lib.isBool cfg.installGhc) && cfg.installGhc) cfg.ghcPackage;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,28 @@
|
||||||
{ lib, helpers }:
|
{ lib, ... }:
|
||||||
# Options:
|
# Options:
|
||||||
# - https://github.com/grafana/jsonnet-language-server/tree/main/editor/vim
|
# - https://github.com/grafana/jsonnet-language-server/tree/main/editor/vim
|
||||||
# - https://github.com/grafana/jsonnet-language-server/blob/main/pkg/server/configuration.go
|
# - https://github.com/grafana/jsonnet-language-server/blob/main/pkg/server/configuration.go
|
||||||
# - https://github.com/google/go-jsonnet/blob/master/internal/formatter/jsonnetfmt.go#L55
|
# - https://github.com/google/go-jsonnet/blob/master/internal/formatter/jsonnetfmt.go#L55
|
||||||
with lib;
|
let
|
||||||
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
inherit (lib) types;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
ext_vars = helpers.defaultNullOpts.mkAttrsOf types.str { } ''
|
ext_vars = defaultNullOpts.mkAttrsOf types.str { } ''
|
||||||
External variables.
|
External variables.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
formatting = {
|
formatting = {
|
||||||
Indent = helpers.defaultNullOpts.mkUnsignedInt 2 ''
|
Indent = defaultNullOpts.mkUnsignedInt 2 ''
|
||||||
The number of spaces for each level of indenation.
|
The number of spaces for each level of indenation.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
MaxBlankLines = helpers.defaultNullOpts.mkUnsignedInt 2 ''
|
MaxBlankLines = defaultNullOpts.mkUnsignedInt 2 ''
|
||||||
Max allowed number of consecutive blank lines.
|
Max allowed number of consecutive blank lines.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
StringStyle =
|
StringStyle =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
"double"
|
"double"
|
||||||
"single"
|
"single"
|
||||||
|
@ -31,7 +34,7 @@ with lib;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
CommentStyle =
|
CommentStyle =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
"hash"
|
"hash"
|
||||||
"slash"
|
"slash"
|
||||||
|
@ -42,35 +45,35 @@ with lib;
|
||||||
Whether comments should use hash `#`, slash `//`, or be left as-is.
|
Whether comments should use hash `#`, slash `//`, or be left as-is.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
PrettyFieldNames = helpers.defaultNullOpts.mkBool true ''
|
PrettyFieldNames = defaultNullOpts.mkBool true ''
|
||||||
Causes fields to only be wrapped in `'''` when needed.
|
Causes fields to only be wrapped in `'''` when needed.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
PadArrays = helpers.defaultNullOpts.mkBool false ''
|
PadArrays = defaultNullOpts.mkBool false ''
|
||||||
Causes arrays to be written like `[ this ]` instead of `[this]`.
|
Causes arrays to be written like `[ this ]` instead of `[this]`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
PadObjects = helpers.defaultNullOpts.mkBool true ''
|
PadObjects = defaultNullOpts.mkBool true ''
|
||||||
Causes objects to be written like `{ this }` instead of `{this}`.
|
Causes objects to be written like `{ this }` instead of `{this}`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
SortImports = helpers.defaultNullOpts.mkBool true ''
|
SortImports = defaultNullOpts.mkBool true ''
|
||||||
Causes imports at the top of the file to be sorted in groups by filename.
|
Causes imports at the top of the file to be sorted in groups by filename.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
UseImplicitPlus = helpers.defaultNullOpts.mkBool true ''
|
UseImplicitPlus = defaultNullOpts.mkBool true ''
|
||||||
Removes plus sign where it is not required.
|
Removes plus sign where it is not required.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
StripEverything = helpers.defaultNullOpts.mkBool false ''
|
StripEverything = defaultNullOpts.mkBool false ''
|
||||||
Removes all comments and newlines.
|
Removes all comments and newlines.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
StripComments = helpers.defaultNullOpts.mkBool false ''
|
StripComments = defaultNullOpts.mkBool false ''
|
||||||
Removes all comments.
|
Removes all comments.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
StripAllButComments = helpers.defaultNullOpts.mkBool false ''
|
StripAllButComments = defaultNullOpts.mkBool false ''
|
||||||
Removes everything, other than comments.
|
Removes everything, other than comments.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
{ lib, helpers }:
|
{ lib, ... }:
|
||||||
with lib;
|
let
|
||||||
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
inherit (lib) types;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
enabled =
|
enabled =
|
||||||
helpers.defaultNullOpts.mkNullableWithRaw (with lib.types; either bool (listOf (maybeRaw str)))
|
defaultNullOpts.mkNullableWithRaw (with types; either bool (listOf (maybeRaw str)))
|
||||||
[
|
[
|
||||||
"bibtex"
|
"bibtex"
|
||||||
"context"
|
"context"
|
||||||
|
@ -41,7 +44,7 @@ with lib;
|
||||||
- ["latex" "markdown"]
|
- ["latex" "markdown"]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
language = helpers.defaultNullOpts.mkStr "en-US" ''
|
language = defaultNullOpts.mkStr "en-US" ''
|
||||||
The language (e.g., "en-US") LanguageTool should check against.
|
The language (e.g., "en-US") LanguageTool should check against.
|
||||||
Use a specific variant like "en-US" or "de-DE" instead of the generic language code like "en" or
|
Use a specific variant like "en-US" or "de-DE" instead of the generic language code like "en" or
|
||||||
"de" to obtain spelling corrections (in addition to grammar corrections).
|
"de" to obtain spelling corrections (in addition to grammar corrections).
|
||||||
|
@ -101,20 +104,25 @@ with lib;
|
||||||
- "zh-CN": Chinese
|
- "zh-CN": Chinese
|
||||||
'';
|
'';
|
||||||
|
|
||||||
dictionary = helpers.defaultNullOpts.mkAttrsOf (with lib.types; listOf (maybeRaw str)) { } ''
|
dictionary = defaultNullOpts.mkAttrsOf' {
|
||||||
Lists of additional words that should not be counted as spelling errors.
|
type = with types; listOf (maybeRaw str);
|
||||||
This setting is language-specific, so use an attrs of the format
|
pluginDefault = { };
|
||||||
```nix
|
example = {
|
||||||
{
|
|
||||||
"<LANGUAGE1>" = [
|
"<LANGUAGE1>" = [
|
||||||
"<WORD1>"
|
"<WORD1>"
|
||||||
"<WORD2>"
|
"<WORD2>"
|
||||||
...
|
|
||||||
];
|
];
|
||||||
"<LANGUAGE2>" = [
|
"<LANGUAGE2>" = [
|
||||||
"<WORD1>"
|
"<WORD1>"
|
||||||
"<WORD2>"
|
"<WORD2>"
|
||||||
];
|
];
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Lists of additional words that should not be counted as spelling errors.
|
||||||
|
This setting is language-specific, so use an attrs of the format
|
||||||
|
```nix
|
||||||
|
{
|
||||||
...
|
...
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
@ -123,24 +131,20 @@ with lib;
|
||||||
This setting is a multi-scope setting. See the documentation for details.
|
This setting is a multi-scope setting. See the documentation for details.
|
||||||
This setting supports external files. See the documentation for details.
|
This setting supports external files. See the documentation for details.
|
||||||
By default, no additional spelling errors will be ignored.
|
By default, no additional spelling errors will be ignored.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
Example:
|
disabledRules = defaultNullOpts.mkAttrsOf' {
|
||||||
```nix
|
type = with types; listOf (maybeRaw str);
|
||||||
{
|
pluginDefault = { };
|
||||||
|
example = {
|
||||||
"en-US" = [
|
"en-US" = [
|
||||||
"adaptivity"
|
"EN_QUOTES"
|
||||||
"precomputed"
|
"UPPERCASE_SENTENCE_START"
|
||||||
"subproblem"
|
|
||||||
];
|
|
||||||
"de-DE" = [
|
|
||||||
"B-Splines"
|
|
||||||
":/path/to/externalFile.txt"
|
":/path/to/externalFile.txt"
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
```
|
description = ''
|
||||||
'';
|
|
||||||
|
|
||||||
disabledRules = helpers.defaultNullOpts.mkAttrsOf (with lib.types; listOf (maybeRaw str)) { } ''
|
|
||||||
Lists of rules that should be disabled (if enabled by default by LanguageTool).
|
Lists of rules that should be disabled (if enabled by default by LanguageTool).
|
||||||
This setting is language-specific, so use an attrs of the format
|
This setting is language-specific, so use an attrs of the format
|
||||||
```nix
|
```nix
|
||||||
|
@ -163,20 +167,20 @@ with lib;
|
||||||
This setting is a multi-scope setting. See the documentation for details.
|
This setting is a multi-scope setting. See the documentation for details.
|
||||||
This setting supports external files. See the documentation for details.
|
This setting supports external files. See the documentation for details.
|
||||||
By default, no additional rules will be disabled.
|
By default, no additional rules will be disabled.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
Example:
|
enabledRules = defaultNullOpts.mkAttrsOf' {
|
||||||
```nix
|
type = with types; listOf (maybeRaw str);
|
||||||
{
|
pluginDefault = { };
|
||||||
"en-US" = [
|
example = {
|
||||||
"EN_QUOTES"
|
"en-GB" = [
|
||||||
"UPPERCASE_SENTENCE_START"
|
"PASSIVE_VOICE"
|
||||||
|
"OXFORD_SPELLING_NOUNS"
|
||||||
":/path/to/externalFile.txt"
|
":/path/to/externalFile.txt"
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
```
|
description = ''
|
||||||
'';
|
|
||||||
|
|
||||||
enabledRules = helpers.defaultNullOpts.mkAttrsOf (with lib.types; listOf (maybeRaw str)) { } ''
|
|
||||||
Lists of rules that should be enabled (if disabled by default by LanguageTool).
|
Lists of rules that should be enabled (if disabled by default by LanguageTool).
|
||||||
This setting is language-specific, so use an attrs of the format
|
This setting is language-specific, so use an attrs of the format
|
||||||
```nix
|
```nix
|
||||||
|
@ -199,22 +203,16 @@ with lib;
|
||||||
This setting is a multi-scope setting. See the documentation for details.
|
This setting is a multi-scope setting. See the documentation for details.
|
||||||
This setting supports external files. See the documentation for details.
|
This setting supports external files. See the documentation for details.
|
||||||
By default, no additional rules will be enabled.
|
By default, no additional rules will be enabled.
|
||||||
|
|
||||||
Example:
|
|
||||||
```nix
|
|
||||||
{
|
|
||||||
"en-GB" = [
|
|
||||||
"PASSIVE_VOICE"
|
|
||||||
"OXFORD_SPELLING_NOUNS"
|
|
||||||
":/path/to/externalFile.txt"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
```
|
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
hiddenFalsePositives =
|
hiddenFalsePositives = defaultNullOpts.mkAttrsOf' {
|
||||||
helpers.defaultNullOpts.mkAttrsOf (with lib.types; listOf (maybeRaw str)) { }
|
type = with types; listOf (maybeRaw str);
|
||||||
''
|
pluginDefault = { };
|
||||||
|
example = {
|
||||||
|
"en-US" = [ ":/path/to/externalFile.txt" ];
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
Lists of false-positive diagnostics to hide (by hiding all diagnostics of a specific rule
|
Lists of false-positive diagnostics to hide (by hiding all diagnostics of a specific rule
|
||||||
within a specific sentence).
|
within a specific sentence).
|
||||||
This setting is language-specific, so use an attrs of the format
|
This setting is language-specific, so use an attrs of the format
|
||||||
|
@ -248,16 +246,17 @@ with lib;
|
||||||
This setting is a multi-scope setting. See the documentation for details.
|
This setting is a multi-scope setting. See the documentation for details.
|
||||||
This setting supports external files. See the documentation for details.
|
This setting supports external files. See the documentation for details.
|
||||||
If this list is very large, performance may suffer.
|
If this list is very large, performance may suffer.
|
||||||
|
|
||||||
Example:
|
|
||||||
```nix
|
|
||||||
{
|
|
||||||
"en-US" = [ ":/path/to/externalFile.txt" ];
|
|
||||||
}
|
|
||||||
```
|
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
fields = helpers.defaultNullOpts.mkAttrsOf types.bool { } ''
|
fields = defaultNullOpts.mkAttrsOf' {
|
||||||
|
type = types.bool;
|
||||||
|
pluginDefault = { };
|
||||||
|
example = {
|
||||||
|
maintitle = false;
|
||||||
|
seealso = true;
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
List of BibTEX fields whose values are to be checked in BibTEX files.
|
List of BibTEX fields whose values are to be checked in BibTEX files.
|
||||||
|
|
||||||
This setting is an attrs with the field names as keys (not restricted to classical BibTEX
|
This setting is an attrs with the field names as keys (not restricted to classical BibTEX
|
||||||
|
@ -265,18 +264,20 @@ with lib;
|
||||||
`false` means that the field value should be ignored.
|
`false` means that the field value should be ignored.
|
||||||
|
|
||||||
Some common fields are already ignored, even if you set this setting to an empty attrs.
|
Some common fields are already ignored, even if you set this setting to an empty attrs.
|
||||||
|
|
||||||
Example:
|
|
||||||
```nix
|
|
||||||
{
|
|
||||||
maintitle = false;
|
|
||||||
seealso = true;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
latex = {
|
latex = {
|
||||||
commands = helpers.defaultNullOpts.mkAttrsOf types.str { } ''
|
commands = defaultNullOpts.mkAttrsOf' {
|
||||||
|
type = types.str;
|
||||||
|
pluginDefault = { };
|
||||||
|
example = {
|
||||||
|
"\\label{}" = "ignore";
|
||||||
|
"\\documentclass[]{}" = "ignore";
|
||||||
|
"\\cite{}" = "dummy";
|
||||||
|
"\\cite[]{}" = "dummy";
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
List of LATEX commands to be handled by the LATEX parser, listed together with empty arguments
|
List of LATEX commands to be handled by the LATEX parser, listed together with empty arguments
|
||||||
(e.g., `"ref{}"`, `"\documentclass[]{}"`).
|
(e.g., `"ref{}"`, `"\documentclass[]{}"`).
|
||||||
|
|
||||||
|
@ -287,19 +288,17 @@ with lib;
|
||||||
|
|
||||||
Many common commands are already handled by default, even if you set this setting to an empty
|
Many common commands are already handled by default, even if you set this setting to an empty
|
||||||
attrs.
|
attrs.
|
||||||
|
|
||||||
Example:
|
|
||||||
```nix
|
|
||||||
{
|
|
||||||
"\\label{}" = "ignore";
|
|
||||||
"\\documentclass[]{}" = "ignore";
|
|
||||||
"\\cite{}" = "dummy";
|
|
||||||
"\\cite[]{}" = "dummy";
|
|
||||||
}
|
|
||||||
```
|
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
environments = helpers.defaultNullOpts.mkAttrsOf types.str { } ''
|
environments = defaultNullOpts.mkAttrsOf' {
|
||||||
|
type = types.str;
|
||||||
|
pluginDefault = { };
|
||||||
|
example = {
|
||||||
|
lstlisting = "ignore";
|
||||||
|
verbatim = "ignore";
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
List of names of LATEX environments to be handled by the LATEX parser.
|
List of names of LATEX environments to be handled by the LATEX parser.
|
||||||
|
|
||||||
This setting is an attrs with the environment names as keys and corresponding actions as
|
This setting is an attrs with the environment names as keys and corresponding actions as
|
||||||
|
@ -307,19 +306,21 @@ with lib;
|
||||||
|
|
||||||
Some environments are already handled by default, even if you set this setting to an empty
|
Some environments are already handled by default, even if you set this setting to an empty
|
||||||
attrs.
|
attrs.
|
||||||
|
|
||||||
Example:
|
|
||||||
```nix
|
|
||||||
{
|
|
||||||
lstlisting = "ignore";
|
|
||||||
verbatim = "ignore";
|
|
||||||
}
|
|
||||||
```
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
markdown = {
|
markdown = {
|
||||||
nodes = helpers.defaultNullOpts.mkAttrsOf types.str { } ''
|
nodes = defaultNullOpts.mkAttrsOf' {
|
||||||
|
type = types.str;
|
||||||
|
pluginDefault = { };
|
||||||
|
example = {
|
||||||
|
CodeBlock = "ignore";
|
||||||
|
FencedCodeBlock = "ignore";
|
||||||
|
AutoLink = "dummy";
|
||||||
|
Code = "dummy";
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
List of Markdown node types to be handled by the Markdown parser.
|
List of Markdown node types to be handled by the Markdown parser.
|
||||||
|
|
||||||
This setting is an attrs with the node types as keys and corresponding actions as values.
|
This setting is an attrs with the node types as keys and corresponding actions as values.
|
||||||
|
@ -330,21 +331,12 @@ with lib;
|
||||||
|
|
||||||
Some common node types are already handled by default, even if you set this setting to an
|
Some common node types are already handled by default, even if you set this setting to an
|
||||||
empty attrs.
|
empty attrs.
|
||||||
|
|
||||||
Example:
|
|
||||||
```nix
|
|
||||||
{
|
|
||||||
CodeBlock = "ignore";
|
|
||||||
FencedCodeBlock = "ignore";
|
|
||||||
AutoLink = "dummy";
|
|
||||||
Code = "dummy";
|
|
||||||
}
|
|
||||||
```
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
configurationTarget =
|
configurationTarget =
|
||||||
helpers.defaultNullOpts.mkAttrsOf types.str
|
defaultNullOpts.mkAttrsOf types.str
|
||||||
{
|
{
|
||||||
dictionary = "workspaceFolderExternalFile";
|
dictionary = "workspaceFolderExternalFile";
|
||||||
disabledRules = "workspaceFolderExternalFile";
|
disabledRules = "workspaceFolderExternalFile";
|
||||||
|
@ -356,12 +348,12 @@ with lib;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
additionalRules = {
|
additionalRules = {
|
||||||
enablePickyRules = helpers.defaultNullOpts.mkBool false ''
|
enablePickyRules = defaultNullOpts.mkBool false ''
|
||||||
Enable LanguageTool rules that are marked as picky and that are disabled by default, e.g.,
|
Enable LanguageTool rules that are marked as picky and that are disabled by default, e.g.,
|
||||||
rules about passive voice, sentence length, etc., at the cost of more false positives.
|
rules about passive voice, sentence length, etc., at the cost of more false positives.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
motherTongue = helpers.defaultNullOpts.mkStr "" ''
|
motherTongue = defaultNullOpts.mkStr "" ''
|
||||||
Optional mother tongue of the user (e.g., "de-DE").
|
Optional mother tongue of the user (e.g., "de-DE").
|
||||||
|
|
||||||
If set, additional rules will be checked to detect false friends.
|
If set, additional rules will be checked to detect false friends.
|
||||||
|
@ -421,22 +413,25 @@ with lib;
|
||||||
- "zh-CN": Chinese
|
- "zh-CN": Chinese
|
||||||
'';
|
'';
|
||||||
|
|
||||||
languageModel = helpers.defaultNullOpts.mkStr "" ''
|
languageModel = defaultNullOpts.mkStr "" ''
|
||||||
Optional path to a directory with rules of a language model with n-gram occurrence counts.
|
Optional path to a directory with rules of a language model with n-gram occurrence counts.
|
||||||
Set this setting to the parent directory that contains subdirectories for languages (e.g.,
|
Set this setting to the parent directory that contains subdirectories for languages (e.g.,
|
||||||
en).
|
en).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
neuralNetworkModel = helpers.defaultNullOpts.mkStr "" ''
|
neuralNetworkModel = defaultNullOpts.mkStr "" ''
|
||||||
Optional path to a directory with rules of a pretrained neural network model.
|
Optional path to a directory with rules of a pretrained neural network model.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
word2VecModel = helpers.defaultNullOpts.mkStr "" ''
|
word2VecModel = defaultNullOpts.mkStr "" ''
|
||||||
Optional path to a directory with rules of a word2vec language model.
|
Optional path to a directory with rules of a word2vec language model.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
languageToolHttpServerUri = helpers.defaultNullOpts.mkStr "" ''
|
languageToolHttpServerUri = defaultNullOpts.mkStr' {
|
||||||
|
pluginDefault = "";
|
||||||
|
example = "http://localhost:8081/";
|
||||||
|
description = ''
|
||||||
If set to a non-empty string, LTEX will not use the bundled, built-in version of LanguageTool.
|
If set to a non-empty string, LTEX will not use the bundled, built-in version of LanguageTool.
|
||||||
Instead, LTEX will connect to an external LanguageTool HTTP server.
|
Instead, LTEX will connect to an external LanguageTool HTTP server.
|
||||||
Set this setting to the root URI of the server, and do not append v2/check or similar.
|
Set this setting to the root URI of the server, and do not append v2/check or similar.
|
||||||
|
@ -444,24 +439,23 @@ with lib;
|
||||||
Note that in this mode, the settings `settings.additionalRules.languageModel`,
|
Note that in this mode, the settings `settings.additionalRules.languageModel`,
|
||||||
`settings.additionalRules.neuralNetworkModel`, and `settings.additionalRules.word2VecModel` will
|
`settings.additionalRules.neuralNetworkModel`, and `settings.additionalRules.word2VecModel` will
|
||||||
not take any effect.
|
not take any effect.
|
||||||
|
|
||||||
Example: `"http://localhost:8081/"`
|
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
languageToolOrg = {
|
languageToolOrg = {
|
||||||
username = helpers.defaultNullOpts.mkStr "" ''
|
username = defaultNullOpts.mkStr "" ''
|
||||||
Username/email as used to log in at `languagetool.org` for Premium API access.
|
Username/email as used to log in at `languagetool.org` for Premium API access.
|
||||||
Only relevant if `settings.languageToolHttpServerUri` is set.
|
Only relevant if `settings.languageToolHttpServerUri` is set.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
apiKey = helpers.defaultNullOpts.mkStr "" ''
|
apiKey = defaultNullOpts.mkStr "" ''
|
||||||
API key for Premium API access.
|
API key for Premium API access.
|
||||||
Only relevant if `settings.languageToolHttpServerUri` is set.
|
Only relevant if `settings.languageToolHttpServerUri` is set.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
ltex-ls = {
|
ltex-ls = {
|
||||||
path = helpers.defaultNullOpts.mkStr "" ''
|
path = defaultNullOpts.mkStr "" ''
|
||||||
If set to an empty string, LTEX automatically downloads `ltex-ls` from GitHub, stores it in
|
If set to an empty string, LTEX automatically downloads `ltex-ls` from GitHub, stores it in
|
||||||
the folder of the extension, and uses it for the checking process.
|
the folder of the extension, and uses it for the checking process.
|
||||||
You can point this setting to an ltex-ls release you downloaded by yourself.
|
You can point this setting to an ltex-ls release you downloaded by yourself.
|
||||||
|
@ -472,7 +466,7 @@ with lib;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
logLevel =
|
logLevel =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
"severe"
|
"severe"
|
||||||
"warning"
|
"warning"
|
||||||
|
@ -504,7 +498,7 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
java = {
|
java = {
|
||||||
path = helpers.defaultNullOpts.mkStr "" ''
|
path = defaultNullOpts.mkStr "" ''
|
||||||
If set to an empty string, LTEX uses a Java distribution that is bundled with `ltex-ls`.
|
If set to an empty string, LTEX uses a Java distribution that is bundled with `ltex-ls`.
|
||||||
You can point this setting to an existing Java installation on your computer to use that
|
You can point this setting to an existing Java installation on your computer to use that
|
||||||
installation instead.
|
installation instead.
|
||||||
|
@ -515,7 +509,7 @@ with lib;
|
||||||
Changes require restarting LTEX to take effect.
|
Changes require restarting LTEX to take effect.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
initialHeapSize = helpers.defaultNullOpts.mkUnsignedInt 64 ''
|
initialHeapSize = defaultNullOpts.mkUnsignedInt 64 ''
|
||||||
Initial size of the Java heap memory in megabytes (corresponds to Java’s -Xms option, must be
|
Initial size of the Java heap memory in megabytes (corresponds to Java’s -Xms option, must be
|
||||||
a positive integer).
|
a positive integer).
|
||||||
|
|
||||||
|
@ -524,7 +518,7 @@ with lib;
|
||||||
Changes require restarting LTEX to take effect.
|
Changes require restarting LTEX to take effect.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
maximumHeapSize = helpers.defaultNullOpts.mkUnsignedInt 512 ''
|
maximumHeapSize = defaultNullOpts.mkUnsignedInt 512 ''
|
||||||
Maximum size of the Java heap memory in megabytes (corresponds to Java’s -Xmx option, must be
|
Maximum size of the Java heap memory in megabytes (corresponds to Java’s -Xmx option, must be
|
||||||
a positive integer).
|
a positive integer).
|
||||||
|
|
||||||
|
@ -536,7 +530,7 @@ with lib;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
sentenceCacheSize = helpers.defaultNullOpts.mkUnsignedInt 2000 ''
|
sentenceCacheSize = defaultNullOpts.mkUnsignedInt 2000 ''
|
||||||
Size of the LanguageTool ResultCache in sentences (must be a positive integer).
|
Size of the LanguageTool ResultCache in sentences (must be a positive integer).
|
||||||
|
|
||||||
If only a small portion of the text changed (e.g., a single key press in the editor),
|
If only a small portion of the text changed (e.g., a single key press in the editor),
|
||||||
|
@ -550,7 +544,7 @@ with lib;
|
||||||
Changes require restarting LTEX to take effect.
|
Changes require restarting LTEX to take effect.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
completionEnabled = helpers.defaultNullOpts.mkBool false ''
|
completionEnabled = defaultNullOpts.mkBool false ''
|
||||||
Controls whether completion is enabled (also known as auto-completion, quick suggestions, and
|
Controls whether completion is enabled (also known as auto-completion, quick suggestions, and
|
||||||
IntelliSense).
|
IntelliSense).
|
||||||
|
|
||||||
|
@ -563,10 +557,10 @@ with lib;
|
||||||
It is recommended to enable this setting.
|
It is recommended to enable this setting.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
diagnosticSeverity =
|
diagnosticSeverity = defaultNullOpts.mkNullableWithRaw' {
|
||||||
helpers.defaultNullOpts.mkNullableWithRaw (with lib.types; either str (attrsOf (maybeRaw str)))
|
type = with types; either str (attrsOf (maybeRaw str));
|
||||||
"information"
|
pluginDefault = "information";
|
||||||
''
|
description = ''
|
||||||
Severity of the diagnostics corresponding to the grammar and spelling errors.
|
Severity of the diagnostics corresponding to the grammar and spelling errors.
|
||||||
|
|
||||||
Controls how and where the diagnostics appear.
|
Controls how and where the diagnostics appear.
|
||||||
|
@ -583,9 +577,14 @@ with lib;
|
||||||
- `"information"`
|
- `"information"`
|
||||||
- `{PASSIVE_VOICE = "hint"; default = "information";}`
|
- `{PASSIVE_VOICE = "hint"; default = "information";}`
|
||||||
'';
|
'';
|
||||||
|
example = {
|
||||||
|
PASSIVE_VOICE = "hint";
|
||||||
|
default = "information";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
checkFrequency =
|
checkFrequency =
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
defaultNullOpts.mkEnumFirstDefault
|
||||||
[
|
[
|
||||||
"edit"
|
"edit"
|
||||||
"save"
|
"save"
|
||||||
|
@ -602,17 +601,17 @@ with lib;
|
||||||
Use commands such as LTeX: Check Current Document to manually trigger checks.
|
Use commands such as LTeX: Check Current Document to manually trigger checks.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
clearDiagnosticsWhenClosingFile = helpers.defaultNullOpts.mkBool true ''
|
clearDiagnosticsWhenClosingFile = defaultNullOpts.mkBool true ''
|
||||||
If set to true, diagnostics of a file are cleared when the file is closed.
|
If set to true, diagnostics of a file are cleared when the file is closed.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
statusBarItem = helpers.defaultNullOpts.mkBool false ''
|
statusBarItem = defaultNullOpts.mkBool false ''
|
||||||
If set to true, an item about the status of LTEX is shown permanently in the status bar.
|
If set to true, an item about the status of LTEX is shown permanently in the status bar.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
trace = {
|
trace = {
|
||||||
server =
|
server =
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
defaultNullOpts.mkEnumFirstDefault
|
||||||
[
|
[
|
||||||
"off"
|
"off"
|
||||||
"messages"
|
"messages"
|
||||||
|
|
|
@ -1,22 +1,25 @@
|
||||||
# All available settings are documented here:
|
# All available settings are documented here:
|
||||||
# https://luals.github.io/wiki/settings/
|
# https://luals.github.io/wiki/settings/
|
||||||
{ lib, helpers }:
|
{ lib, ... }:
|
||||||
with lib;
|
let
|
||||||
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
inherit (lib) types;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
addonManager = {
|
addonManager = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Set the on/off state of the addon manager.
|
Set the on/off state of the addon manager.
|
||||||
Disabling the addon manager prevents it from registering its command.
|
Disabling the addon manager prevents it from registering its command.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
completion = {
|
completion = {
|
||||||
autoRequire = helpers.defaultNullOpts.mkBool true ''
|
autoRequire = defaultNullOpts.mkBool true ''
|
||||||
When the input looks like a file name, automatically require the file.
|
When the input looks like a file name, automatically require the file.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
callSnippet =
|
callSnippet =
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
defaultNullOpts.mkEnumFirstDefault
|
||||||
[
|
[
|
||||||
"Disable"
|
"Disable"
|
||||||
"Both"
|
"Both"
|
||||||
|
@ -32,21 +35,21 @@ with lib;
|
||||||
When enabled, a "more complete" snippet will be offered.
|
When enabled, a "more complete" snippet will be offered.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
displayContext = helpers.defaultNullOpts.mkUnsignedInt 0 ''
|
displayContext = defaultNullOpts.mkUnsignedInt 0 ''
|
||||||
When a snippet is being suggested, this setting will set the amount of lines around the
|
When a snippet is being suggested, this setting will set the amount of lines around the
|
||||||
snippet to preview to help you better understand its usage.
|
snippet to preview to help you better understand its usage.
|
||||||
|
|
||||||
Setting to `0` will disable this feature.
|
Setting to `0` will disable this feature.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable/disable completion.
|
Enable/disable completion.
|
||||||
Completion works like any autocompletion you already know of.
|
Completion works like any autocompletion you already know of.
|
||||||
It helps you type less and get more done.
|
It helps you type less and get more done.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
keywordSnippet =
|
keywordSnippet =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
"Disable"
|
"Disable"
|
||||||
"Both"
|
"Both"
|
||||||
|
@ -61,7 +64,7 @@ with lib;
|
||||||
Whether to show a snippet for key words like `if`, `while`, etc. When disabled, only the keyword will be completed. When enabled, a "more complete" snippet will be offered.
|
Whether to show a snippet for key words like `if`, `while`, etc. When disabled, only the keyword will be completed. When enabled, a "more complete" snippet will be offered.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postfix = helpers.defaultNullOpts.mkStr "@" ''
|
postfix = defaultNullOpts.mkStr "@" ''
|
||||||
The character to use for triggering a "postfix suggestion".
|
The character to use for triggering a "postfix suggestion".
|
||||||
A postfix allows you to write some code and then trigger a snippet after (post) to "fix" the
|
A postfix allows you to write some code and then trigger a snippet after (post) to "fix" the
|
||||||
code you have written.
|
code you have written.
|
||||||
|
@ -69,17 +72,17 @@ with lib;
|
||||||
`myTable@`.
|
`myTable@`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
requireSeparator = helpers.defaultNullOpts.mkStr "." ''
|
requireSeparator = defaultNullOpts.mkStr "." ''
|
||||||
The separator to use when `require`-ing a file.
|
The separator to use when `require`-ing a file.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
showParams = helpers.defaultNullOpts.mkBool true ''
|
showParams = defaultNullOpts.mkBool true ''
|
||||||
Display a function's parameters in the list of completions.
|
Display a function's parameters in the list of completions.
|
||||||
When a function has multiple definitions, they will be displayed separately.
|
When a function has multiple definitions, they will be displayed separately.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
showWord =
|
showWord =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
"Enable"
|
"Enable"
|
||||||
"Fallback"
|
"Fallback"
|
||||||
|
@ -95,7 +98,7 @@ with lib;
|
||||||
usefulness in the current semantic context.
|
usefulness in the current semantic context.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
workspaceWord = helpers.defaultNullOpts.mkBool true ''
|
workspaceWord = defaultNullOpts.mkBool true ''
|
||||||
Whether words from other files in the workspace should be suggested as "contextual words".
|
Whether words from other files in the workspace should be suggested as "contextual words".
|
||||||
This can be useful for completing similar strings.
|
This can be useful for completing similar strings.
|
||||||
`completion.showWord` must not be disabled for this to have an effect.
|
`completion.showWord` must not be disabled for this to have an effect.
|
||||||
|
@ -103,26 +106,26 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
disable = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
disable = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Disable certain diagnostics globally.
|
Disable certain diagnostics globally.
|
||||||
For example, if you want all warnings for `lowercase-global` to be disabled, the value for
|
For example, if you want all warnings for `lowercase-global` to be disabled, the value for
|
||||||
`diagnostics.disable` would be `["lowercase-global"]`.
|
`diagnostics.disable` would be `["lowercase-global"]`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
disableScheme = helpers.defaultNullOpts.mkListOf types.str [ "git" ] ''
|
disableScheme = defaultNullOpts.mkListOf types.str [ "git" ] ''
|
||||||
Disable diagnosis of Lua files that have the set schemes.
|
Disable diagnosis of Lua files that have the set schemes.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Whether all diagnostics should be enabled or not.
|
Whether all diagnostics should be enabled or not.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
globals = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
globals = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
An array of variable names that will be declared as global.
|
An array of variable names that will be declared as global.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
groupFileStatus =
|
groupFileStatus =
|
||||||
helpers.defaultNullOpts.mkAttrsOf
|
defaultNullOpts.mkAttrsOf
|
||||||
(types.enum [
|
(types.enum [
|
||||||
"Any"
|
"Any"
|
||||||
"Opened"
|
"Opened"
|
||||||
|
@ -157,7 +160,7 @@ with lib;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
groupSeverity =
|
groupSeverity =
|
||||||
helpers.defaultNullOpts.mkAttrsOf
|
defaultNullOpts.mkAttrsOf
|
||||||
(types.enum [
|
(types.enum [
|
||||||
"Error"
|
"Error"
|
||||||
"Warning"
|
"Warning"
|
||||||
|
@ -191,7 +194,7 @@ with lib;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
ignoredFiles =
|
ignoredFiles =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
"Enable"
|
"Enable"
|
||||||
"Opened"
|
"Opened"
|
||||||
|
@ -207,7 +210,7 @@ with lib;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
libraryFiles =
|
libraryFiles =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
"Enable"
|
"Enable"
|
||||||
"Opened"
|
"Opened"
|
||||||
|
@ -223,7 +226,7 @@ with lib;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
neededFileStatus =
|
neededFileStatus =
|
||||||
helpers.defaultNullOpts.mkAttrsOf
|
defaultNullOpts.mkAttrsOf
|
||||||
(types.enum [
|
(types.enum [
|
||||||
"Any"
|
"Any"
|
||||||
"Opened"
|
"Opened"
|
||||||
|
@ -301,7 +304,7 @@ with lib;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
severity =
|
severity =
|
||||||
helpers.defaultNullOpts.mkAttrsOf
|
defaultNullOpts.mkAttrsOf
|
||||||
(types.enum [
|
(types.enum [
|
||||||
"Error"
|
"Error"
|
||||||
"Warning"
|
"Warning"
|
||||||
|
@ -380,12 +383,12 @@ with lib;
|
||||||
- `"Hint!"` - Like `"Hint"` but overrides `diagnostics.groupSeverity`
|
- `"Hint!"` - Like `"Hint"` but overrides `diagnostics.groupSeverity`
|
||||||
'';
|
'';
|
||||||
|
|
||||||
unusedLocalExclude = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
unusedLocalExclude = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Define variable names that will not be reported as an unused local by
|
Define variable names that will not be reported as an unused local by
|
||||||
[`unused-local`](https://github.com/LuaLS/lua-language-server/wiki/Diagnostics#unused-local).
|
[`unused-local`](https://github.com/LuaLS/lua-language-server/wiki/Diagnostics#unused-local).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
workspaceDelay = helpers.defaultNullOpts.mkUnsignedInt 3000 ''
|
workspaceDelay = defaultNullOpts.mkUnsignedInt 3000 ''
|
||||||
Define the delay between diagnoses of the workspace in milliseconds.
|
Define the delay between diagnoses of the workspace in milliseconds.
|
||||||
Every time a file is edited, created, deleted, etc. the workspace will be re-diagnosed in the
|
Every time a file is edited, created, deleted, etc. the workspace will be re-diagnosed in the
|
||||||
background after this delay.
|
background after this delay.
|
||||||
|
@ -393,7 +396,7 @@ with lib;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
workspaceEvent =
|
workspaceEvent =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
"OnChange"
|
"OnChange"
|
||||||
"OnSave"
|
"OnSave"
|
||||||
|
@ -410,7 +413,7 @@ with lib;
|
||||||
- `"None"`
|
- `"None"`
|
||||||
'';
|
'';
|
||||||
|
|
||||||
workspaceRate = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
workspaceRate = defaultNullOpts.mkUnsignedInt 100 ''
|
||||||
Define the rate at which the workspace will be diagnosed as a percentage.
|
Define the rate at which the workspace will be diagnosed as a percentage.
|
||||||
`100` is 100% speed so the workspace will be diagnosed as fast as possible.
|
`100` is 100% speed so the workspace will be diagnosed as fast as possible.
|
||||||
The rate can be lowered to reduce CPU usage, but the diagnosis speed will also become slower.
|
The rate can be lowered to reduce CPU usage, but the diagnosis speed will also become slower.
|
||||||
|
@ -419,37 +422,37 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
doc = {
|
doc = {
|
||||||
packageName = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
packageName = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
The pattern used for matching field names as a package-private field.
|
The pattern used for matching field names as a package-private field.
|
||||||
Fields that match any of the patterns provided will be package-private.
|
Fields that match any of the patterns provided will be package-private.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
privateName = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
privateName = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
The pattern used for matching field names as a private field.
|
The pattern used for matching field names as a private field.
|
||||||
Fields that match any of the patterns provided will be private to that class.
|
Fields that match any of the patterns provided will be private to that class.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
protectedName = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
protectedName = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
The pattern used for matching field names as a protected field.
|
The pattern used for matching field names as a protected field.
|
||||||
Fields that match any of the patterns provided will be private to that class and its child classes.
|
Fields that match any of the patterns provided will be private to that class and its child classes.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
format = {
|
format = {
|
||||||
defaultConfig = helpers.defaultNullOpts.mkAttrsOf types.str { } ''
|
defaultConfig = defaultNullOpts.mkAttrsOf types.str { } ''
|
||||||
The default configuration for the formatter.
|
The default configuration for the formatter.
|
||||||
If there is a `.editorconfig` in the workspace, it will take priority.
|
If there is a `.editorconfig` in the workspace, it will take priority.
|
||||||
Read more on the [formatter's GitHub page](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs).
|
Read more on the [formatter's GitHub page](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Whether the built-in formatted should be enabled or not.
|
Whether the built-in formatted should be enabled or not.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
hint = {
|
hint = {
|
||||||
arrayIndex =
|
arrayIndex =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
"Enable"
|
"Enable"
|
||||||
"Auto"
|
"Auto"
|
||||||
|
@ -462,17 +465,17 @@ with lib;
|
||||||
- `"Disable"` - Disable array index hints
|
- `"Disable"` - Disable array index hints
|
||||||
'';
|
'';
|
||||||
|
|
||||||
await = helpers.defaultNullOpts.mkBool true ''
|
await = defaultNullOpts.mkBool true ''
|
||||||
If a function has been defined as [`@async`](https://github.com/LuaLS/lua-language-server/wiki/Annotations#async),
|
If a function has been defined as [`@async`](https://github.com/LuaLS/lua-language-server/wiki/Annotations#async),
|
||||||
display an `await` hint when it is being called.
|
display an `await` hint when it is being called.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enable = helpers.defaultNullOpts.mkBool false ''
|
enable = defaultNullOpts.mkBool false ''
|
||||||
Whether inline hints should be enabled or not.
|
Whether inline hints should be enabled or not.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
paramName =
|
paramName =
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
defaultNullOpts.mkEnumFirstDefault
|
||||||
[
|
[
|
||||||
"All"
|
"All"
|
||||||
"Literal"
|
"Literal"
|
||||||
|
@ -486,13 +489,13 @@ with lib;
|
||||||
- `"Disable"` - No parameter hints are shown
|
- `"Disable"` - No parameter hints are shown
|
||||||
'';
|
'';
|
||||||
|
|
||||||
paramType = helpers.defaultNullOpts.mkBool true ''
|
paramType = defaultNullOpts.mkBool true ''
|
||||||
Show a hint for parameter types at a function definition.
|
Show a hint for parameter types at a function definition.
|
||||||
Requires the parameters to be defined with [`@param`](https://github.com/LuaLS/lua-language-server/wiki/Annotations#param).
|
Requires the parameters to be defined with [`@param`](https://github.com/LuaLS/lua-language-server/wiki/Annotations#param).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
semicolon =
|
semicolon =
|
||||||
helpers.defaultNullOpts.mkEnum
|
defaultNullOpts.mkEnum
|
||||||
[
|
[
|
||||||
"All"
|
"All"
|
||||||
"SameLine"
|
"SameLine"
|
||||||
|
@ -507,63 +510,63 @@ with lib;
|
||||||
- `"Disable"` - Never hint a semicolon
|
- `"Disable"` - Never hint a semicolon
|
||||||
'';
|
'';
|
||||||
|
|
||||||
setType = helpers.defaultNullOpts.mkBool false ''
|
setType = defaultNullOpts.mkBool false ''
|
||||||
Show a hint to display the type being applied at assignment operations.
|
Show a hint to display the type being applied at assignment operations.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
hover = {
|
hover = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Whether to enable hover tooltips or not.
|
Whether to enable hover tooltips or not.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enumsLimit = helpers.defaultNullOpts.mkUnsignedInt 5 ''
|
enumsLimit = defaultNullOpts.mkUnsignedInt 5 ''
|
||||||
When a value has multiple possible types, hovering it will display them.
|
When a value has multiple possible types, hovering it will display them.
|
||||||
This setting limits how many will be displayed in the tooltip before they are truncated.
|
This setting limits how many will be displayed in the tooltip before they are truncated.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
expandAlias = helpers.defaultNullOpts.mkBool true ''
|
expandAlias = defaultNullOpts.mkBool true ''
|
||||||
When hovering a value with an [`@alias`](https://github.com/LuaLS/lua-language-server/wiki/Annotations#alias)
|
When hovering a value with an [`@alias`](https://github.com/LuaLS/lua-language-server/wiki/Annotations#alias)
|
||||||
for its type, should the alias be expanded into its values.
|
for its type, should the alias be expanded into its values.
|
||||||
When enabled, `---@alias myType boolean|number` appears as `boolean|number`, otherwise it will
|
When enabled, `---@alias myType boolean|number` appears as `boolean|number`, otherwise it will
|
||||||
appear as `myType`.
|
appear as `myType`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
previewFields = helpers.defaultNullOpts.mkUnsignedInt 50 ''
|
previewFields = defaultNullOpts.mkUnsignedInt 50 ''
|
||||||
When a table is hovered, its fields will be displayed in the tooltip.
|
When a table is hovered, its fields will be displayed in the tooltip.
|
||||||
This setting limits how many fields can be seen in the tooltip.
|
This setting limits how many fields can be seen in the tooltip.
|
||||||
Setting to `0` will disable this feature.
|
Setting to `0` will disable this feature.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
viewNumber = helpers.defaultNullOpts.mkBool true ''
|
viewNumber = defaultNullOpts.mkBool true ''
|
||||||
Enable hovering a non-decimal value to see its numeric value.
|
Enable hovering a non-decimal value to see its numeric value.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
viewString = helpers.defaultNullOpts.mkBool true ''
|
viewString = defaultNullOpts.mkBool true ''
|
||||||
Enable hovering a string that contains an escape character to see its true string value.
|
Enable hovering a string that contains an escape character to see its true string value.
|
||||||
For example, hovering `"\x48"` will display `"H"`.
|
For example, hovering `"\x48"` will display `"H"`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
viewStringMax = helpers.defaultNullOpts.mkUnsignedInt 1000 ''
|
viewStringMax = defaultNullOpts.mkUnsignedInt 1000 ''
|
||||||
The maximum number of characters that can be previewed by hovering a string before it is
|
The maximum number of characters that can be previewed by hovering a string before it is
|
||||||
truncated.
|
truncated.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
misc = {
|
misc = {
|
||||||
parameters = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
parameters = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
[Command line parameters](https://github.com/LuaLS/lua-language-server/wiki/Getting-Started#run)
|
[Command line parameters](https://github.com/LuaLS/lua-language-server/wiki/Getting-Started#run)
|
||||||
to be passed along to the server `exe` when starting through Visual Studio Code.
|
to be passed along to the server `exe` when starting through Visual Studio Code.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
executablePath = helpers.defaultNullOpts.mkStr "" ''
|
executablePath = defaultNullOpts.mkStr "" ''
|
||||||
Manually specify the path for the Lua Language Server executable file.
|
Manually specify the path for the Lua Language Server executable file.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
runtime = {
|
runtime = {
|
||||||
builtin =
|
builtin =
|
||||||
helpers.defaultNullOpts.mkAttrsOf
|
defaultNullOpts.mkAttrsOf
|
||||||
(types.enum [
|
(types.enum [
|
||||||
"default"
|
"default"
|
||||||
"enable"
|
"enable"
|
||||||
|
@ -617,7 +620,7 @@ with lib;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
fileEncoding =
|
fileEncoding =
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
defaultNullOpts.mkEnumFirstDefault
|
||||||
[
|
[
|
||||||
"utf8"
|
"utf8"
|
||||||
"ansi"
|
"ansi"
|
||||||
|
@ -631,13 +634,13 @@ with lib;
|
||||||
- `"utf16be"`
|
- `"utf16be"`
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = helpers.defaultNullOpts.mkStr "$\{version} $\{language} $\{encoding}" ''
|
meta = defaultNullOpts.mkStr "$\{version} $\{language} $\{encoding}" ''
|
||||||
Specify the template that should be used for naming the folders that contain the generated
|
Specify the template that should be used for naming the folders that contain the generated
|
||||||
definitions for the various Lua versions, languages, and encodings.
|
definitions for the various Lua versions, languages, and encodings.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nonstandardSymbol =
|
nonstandardSymbol =
|
||||||
helpers.defaultNullOpts.mkListOf
|
defaultNullOpts.mkListOf
|
||||||
(types.enum [
|
(types.enum [
|
||||||
"//"
|
"//"
|
||||||
"/**/"
|
"/**/"
|
||||||
|
@ -667,7 +670,7 @@ with lib;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
path =
|
path =
|
||||||
helpers.defaultNullOpts.mkListOf types.str
|
defaultNullOpts.mkListOf types.str
|
||||||
[
|
[
|
||||||
"?.lua"
|
"?.lua"
|
||||||
"?/init.lua"
|
"?/init.lua"
|
||||||
|
@ -682,71 +685,71 @@ with lib;
|
||||||
[`workspace.library`](https://github.com/LuaLS/lua-language-server/wiki/Settings#workspacelibrary).
|
[`workspace.library`](https://github.com/LuaLS/lua-language-server/wiki/Settings#workspacelibrary).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
pathStrict = helpers.defaultNullOpts.mkBool false ''
|
pathStrict = defaultNullOpts.mkBool false ''
|
||||||
When enabled, [`runtime.path`](https://github.com/LuaLS/lua-language-server/wiki/Settings#runtimepath)
|
When enabled, [`runtime.path`](https://github.com/LuaLS/lua-language-server/wiki/Settings#runtimepath)
|
||||||
will only search the first level of directories.
|
will only search the first level of directories.
|
||||||
See the description of `runtime.path` for more info.
|
See the description of `runtime.path` for more info.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
plugin = helpers.defaultNullOpts.mkStr "" ''
|
plugin = defaultNullOpts.mkStr "" ''
|
||||||
The path to the [plugin](https://github.com/LuaLS/lua-language-server/wiki/Plugins) to use.
|
The path to the [plugin](https://github.com/LuaLS/lua-language-server/wiki/Plugins) to use.
|
||||||
Blank by default for security reasons.
|
Blank by default for security reasons.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
pluginArgs = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
pluginArgs = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Additional arguments that will be passed to the active
|
Additional arguments that will be passed to the active
|
||||||
[plugin](https://github.com/LuaLS/lua-language-server/wiki/Plugins).
|
[plugin](https://github.com/LuaLS/lua-language-server/wiki/Plugins).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
special = helpers.defaultNullOpts.mkAttrsOf types.str { } ''
|
special = defaultNullOpts.mkAttrsOf types.str { } ''
|
||||||
Special variables can be set to be treated as other variables. For example, specifying `"include" : "require"` will result in `include` being treated like `require`.
|
Special variables can be set to be treated as other variables. For example, specifying `"include" : "require"` will result in `include` being treated like `require`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
unicodeName = helpers.defaultNullOpts.mkBool false ''
|
unicodeName = defaultNullOpts.mkBool false ''
|
||||||
Whether unicode characters should be allowed in variable names or not.
|
Whether unicode characters should be allowed in variable names or not.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
version = helpers.defaultNullOpts.mkStr "Lua 5.4" ''
|
version = defaultNullOpts.mkStr "Lua 5.4" ''
|
||||||
The Lua runtime version to use in this environment.
|
The Lua runtime version to use in this environment.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
semantic = {
|
semantic = {
|
||||||
annotation = helpers.defaultNullOpts.mkBool true ''
|
annotation = defaultNullOpts.mkBool true ''
|
||||||
Whether semantic colouring should be enabled for type annotations.
|
Whether semantic colouring should be enabled for type annotations.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Whether semantic colouring should be enabled.
|
Whether semantic colouring should be enabled.
|
||||||
You may need to set `editor.semanticHighlighting.enabled` to true in order for this setting to
|
You may need to set `editor.semanticHighlighting.enabled` to true in order for this setting to
|
||||||
take effect.
|
take effect.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
keyword = helpers.defaultNullOpts.mkBool false ''
|
keyword = defaultNullOpts.mkBool false ''
|
||||||
Whether the server should provide semantic colouring of keywords, literals, and operators.
|
Whether the server should provide semantic colouring of keywords, literals, and operators.
|
||||||
You should only need to enable this setting if your editor is unable to highlight Lua's syntax.
|
You should only need to enable this setting if your editor is unable to highlight Lua's syntax.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
variable = helpers.defaultNullOpts.mkBool true ''
|
variable = defaultNullOpts.mkBool true ''
|
||||||
Whether the server should provide semantic colouring of variables, fields, and parameters.
|
Whether the server should provide semantic colouring of variables, fields, and parameters.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
signatureHelp = {
|
signatureHelp = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
The signatureHelp group contains settings for helping understand signatures.
|
The signatureHelp group contains settings for helping understand signatures.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
spell = {
|
spell = {
|
||||||
dict = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
dict = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
A custom dictionary of words that you know are spelt correctly but are being reported as incorrect.
|
A custom dictionary of words that you know are spelt correctly but are being reported as incorrect.
|
||||||
Adding words to this dictionary will make them exempt from spell checking.
|
Adding words to this dictionary will make them exempt from spell checking.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
telemetry = {
|
telemetry = {
|
||||||
enable = helpers.defaultNullOpts.mkBool null ''
|
enable = defaultNullOpts.mkBool null ''
|
||||||
The language server comes with opt-in telemetry to help improve the language server.
|
The language server comes with opt-in telemetry to help improve the language server.
|
||||||
It would be greatly appreciated if you enable this setting.
|
It would be greatly appreciated if you enable this setting.
|
||||||
Read the [privacy policy](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy)
|
Read the [privacy policy](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy)
|
||||||
|
@ -755,11 +758,11 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
type = {
|
type = {
|
||||||
castNumberToInteger = helpers.defaultNullOpts.mkBool false ''
|
castNumberToInteger = defaultNullOpts.mkBool false ''
|
||||||
Whether casting a `number` to an `integer` is allowed.
|
Whether casting a `number` to an `integer` is allowed.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
weakNilCheck = helpers.defaultNullOpts.mkBool false ''
|
weakNilCheck = defaultNullOpts.mkBool false ''
|
||||||
Whether it is permitted to assign a union type that contains `nil` to a variable that does not
|
Whether it is permitted to assign a union type that contains `nil` to a variable that does not
|
||||||
permit it.
|
permit it.
|
||||||
When `false`, the following will throw an error because `number|nil` cannot be assigned to
|
When `false`, the following will throw an error because `number|nil` cannot be assigned to
|
||||||
|
@ -775,7 +778,7 @@ with lib;
|
||||||
```
|
```
|
||||||
'';
|
'';
|
||||||
|
|
||||||
weakUnionCheck = helpers.defaultNullOpts.mkBool false ''
|
weakUnionCheck = defaultNullOpts.mkBool false ''
|
||||||
Whether it is permitted to assign a union type which only has one matching type to a variable.
|
Whether it is permitted to assign a union type which only has one matching type to a variable.
|
||||||
When `false`, the following will throw an error because `string|boolean` cannot be assigned to
|
When `false`, the following will throw an error because `string|boolean` cannot be assigned to
|
||||||
`string`.
|
`string`.
|
||||||
|
@ -790,18 +793,18 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
window = {
|
window = {
|
||||||
progressBar = helpers.defaultNullOpts.mkBool true ''
|
progressBar = defaultNullOpts.mkBool true ''
|
||||||
Show a progress bar in the bottom status bar that shows how the workspace loading is progressing.
|
Show a progress bar in the bottom status bar that shows how the workspace loading is progressing.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
statusBar = helpers.defaultNullOpts.mkBool true ''
|
statusBar = defaultNullOpts.mkBool true ''
|
||||||
Show a `Lua 😺` entry in the bottom status bar that can be clicked to manually perform a
|
Show a `Lua 😺` entry in the bottom status bar that can be clicked to manually perform a
|
||||||
workspace diagnosis.
|
workspace diagnosis.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
workspace = {
|
workspace = {
|
||||||
checkThirdParty = helpers.defaultNullOpts.mkBool true ''
|
checkThirdParty = defaultNullOpts.mkBool true ''
|
||||||
Whether [third party libraries](https://github.com/LuaLS/lua-language-server/wiki/Libraries)
|
Whether [third party libraries](https://github.com/LuaLS/lua-language-server/wiki/Libraries)
|
||||||
can be automatically detected and applied.
|
can be automatically detected and applied.
|
||||||
Third party libraries can set up the environment to be as close as possible to your target
|
Third party libraries can set up the environment to be as close as possible to your target
|
||||||
|
@ -810,17 +813,17 @@ with lib;
|
||||||
to view what third party libraries are currently supported.
|
to view what third party libraries are currently supported.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
ignoreDir = helpers.defaultNullOpts.mkListOf types.str [ ".vscode" ] ''
|
ignoreDir = defaultNullOpts.mkListOf types.str [ ".vscode" ] ''
|
||||||
An array of paths that will be ignored and not included in the workspace diagnosis.
|
An array of paths that will be ignored and not included in the workspace diagnosis.
|
||||||
Uses `.gitignore` grammar. Can be a file or directory.
|
Uses `.gitignore` grammar. Can be a file or directory.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
ignoreSubmodules = helpers.defaultNullOpts.mkBool true ''
|
ignoreSubmodules = defaultNullOpts.mkBool true ''
|
||||||
Whether [git submodules](https://github.blog/2016-02-01-working-with-submodules/)
|
Whether [git submodules](https://github.blog/2016-02-01-working-with-submodules/)
|
||||||
should be ignored and not included in the workspace diagnosis.
|
should be ignored and not included in the workspace diagnosis.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
library = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
library = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
An array of abosolute or workspace-relative paths that will be added to the workspace
|
An array of abosolute or workspace-relative paths that will be added to the workspace
|
||||||
diagnosis - meaning you will get completion and context from these library files.
|
diagnosis - meaning you will get completion and context from these library files.
|
||||||
Can be a file or directory.
|
Can be a file or directory.
|
||||||
|
@ -829,17 +832,17 @@ with lib;
|
||||||
Read more on the [Libraries page](https://github.com/LuaLS/lua-language-server/wiki/Libraries).
|
Read more on the [Libraries page](https://github.com/LuaLS/lua-language-server/wiki/Libraries).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
maxPreload = helpers.defaultNullOpts.mkUnsignedInt 5000 ''
|
maxPreload = defaultNullOpts.mkUnsignedInt 5000 ''
|
||||||
The maximum amount of files that can be diagnosed.
|
The maximum amount of files that can be diagnosed.
|
||||||
More files will require more RAM.
|
More files will require more RAM.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preloadFileSize = helpers.defaultNullOpts.mkUnsignedInt 500 ''
|
preloadFileSize = defaultNullOpts.mkUnsignedInt 500 ''
|
||||||
Files larger than this value (in KB) will be skipped when loading for workspace diagnosis.
|
Files larger than this value (in KB) will be skipped when loading for workspace diagnosis.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
supportScheme =
|
supportScheme =
|
||||||
helpers.defaultNullOpts.mkListOf types.str
|
defaultNullOpts.mkListOf types.str
|
||||||
[
|
[
|
||||||
"file"
|
"file"
|
||||||
"untitled"
|
"untitled"
|
||||||
|
@ -849,12 +852,12 @@ with lib;
|
||||||
Lua file schemes to enable the language server for.
|
Lua file schemes to enable the language server for.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
useGitIgnore = helpers.defaultNullOpts.mkBool true ''
|
useGitIgnore = defaultNullOpts.mkBool true ''
|
||||||
Whether files that are in `.gitignore` should be ignored by the language server when
|
Whether files that are in `.gitignore` should be ignored by the language server when
|
||||||
performing workspace diagnosis.
|
performing workspace diagnosis.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
userThirdParty = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
userThirdParty = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
An array of paths to
|
An array of paths to
|
||||||
[custom third party libraries](https://github.com/LuaLS/lua-language-server/wiki/Libraries#custom).
|
[custom third party libraries](https://github.com/LuaLS/lua-language-server/wiki/Libraries#custom).
|
||||||
This path should point to a directory where **all** of your custom libraries are, not just to
|
This path should point to a directory where **all** of your custom libraries are, not just to
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ lib, helpers }:
|
{ lib, ... }:
|
||||||
# All available settings are documented here:
|
# All available settings are documented here:
|
||||||
# https://github.com/oxalica/nil/blob/main/docs/configuration.md
|
# https://github.com/oxalica/nil/blob/main/docs/configuration.md
|
||||||
with lib;
|
let
|
||||||
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
inherit (lib) types;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
formatting = {
|
formatting = {
|
||||||
command = helpers.defaultNullOpts.mkListOf' {
|
command = defaultNullOpts.mkListOf' {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
pluginDefault = null;
|
pluginDefault = null;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -17,13 +20,13 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
ignored = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
ignored = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Ignored diagnostic kinds.
|
Ignored diagnostic kinds.
|
||||||
The kind identifier is a snake_cased_string usually shown together
|
The kind identifier is a snake_cased_string usually shown together
|
||||||
with the diagnostic message.
|
with the diagnostic message.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
excludedFiles = helpers.defaultNullOpts.mkListOf' {
|
excludedFiles = defaultNullOpts.mkListOf' {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
pluginDefault = [ ];
|
pluginDefault = [ ];
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -37,13 +40,13 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
binary = helpers.defaultNullOpts.mkStr' {
|
binary = defaultNullOpts.mkStr' {
|
||||||
pluginDefault = "nix";
|
pluginDefault = "nix";
|
||||||
description = "The path to the `nix` binary.";
|
description = "The path to the `nix` binary.";
|
||||||
example = "/run/current-system/sw/bin/nix";
|
example = "/run/current-system/sw/bin/nix";
|
||||||
};
|
};
|
||||||
|
|
||||||
maxMemoryMB = helpers.defaultNullOpts.mkUnsignedInt' {
|
maxMemoryMB = defaultNullOpts.mkUnsignedInt' {
|
||||||
pluginDefault = 2560;
|
pluginDefault = 2560;
|
||||||
example = 1024;
|
example = 1024;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -59,19 +62,19 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
flake = {
|
flake = {
|
||||||
autoArchive = helpers.defaultNullOpts.mkBool false ''
|
autoArchive = defaultNullOpts.mkBool false ''
|
||||||
Auto-archiving behavior which may use network.
|
Auto-archiving behavior which may use network.
|
||||||
- `null`: Ask every time.
|
- `null`: Ask every time.
|
||||||
- `true`: Automatically run `nix flake archive` when necessary.
|
- `true`: Automatically run `nix flake archive` when necessary.
|
||||||
- `false`: Do not archive. Only load inputs that are already on disk.
|
- `false`: Do not archive. Only load inputs that are already on disk.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
autoEvalInputs = helpers.defaultNullOpts.mkBool false ''
|
autoEvalInputs = defaultNullOpts.mkBool false ''
|
||||||
Whether to auto-eval flake inputs.
|
Whether to auto-eval flake inputs.
|
||||||
The evaluation result is used to improve completion, but may cost lots of time and/or memory.
|
The evaluation result is used to improve completion, but may cost lots of time and/or memory.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nixpkgsInputName = helpers.defaultNullOpts.mkStr' {
|
nixpkgsInputName = defaultNullOpts.mkStr' {
|
||||||
pluginDefault = "nixpkgs";
|
pluginDefault = "nixpkgs";
|
||||||
example = "nixos";
|
example = "nixos";
|
||||||
description = ''
|
description = ''
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
{ lib, helpers }:
|
{ lib, ... }:
|
||||||
# Options:
|
# Options:
|
||||||
# - https://github.com/nix-community/nixd/blob/main/nixd/docs/configuration.md
|
# - https://github.com/nix-community/nixd/blob/main/nixd/docs/configuration.md
|
||||||
# - https://github.com/nix-community/nixd/blob/main/nixd/include/nixd/Controller/Configuration.h
|
# - https://github.com/nix-community/nixd/blob/main/nixd/include/nixd/Controller/Configuration.h
|
||||||
with lib;
|
let
|
||||||
|
inherit (lib.nixvim) defaultNullOpts mkNullOrOption;
|
||||||
|
inherit (lib) types;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
diagnostic = {
|
diagnostic = {
|
||||||
suppress = helpers.defaultNullOpts.mkListOf' {
|
suppress = defaultNullOpts.mkListOf' {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = ''
|
description = ''
|
||||||
Disable specific LSP warnings, etc.
|
Disable specific LSP warnings, etc.
|
||||||
|
@ -20,7 +23,7 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
formatting = {
|
formatting = {
|
||||||
command = helpers.defaultNullOpts.mkListOf types.str [ "nixpkgs-fmt" ] ''
|
command = defaultNullOpts.mkListOf types.str [ "nixpkgs-fmt" ] ''
|
||||||
Which command you would like to do formatting.
|
Which command you would like to do formatting.
|
||||||
Explicitly setting to `["nixpkgs-fmt"]` will automatically add `pkgs.nixpkgs-fmt` to the nixvim
|
Explicitly setting to `["nixpkgs-fmt"]` will automatically add `pkgs.nixpkgs-fmt` to the nixvim
|
||||||
environment.
|
environment.
|
||||||
|
@ -31,14 +34,14 @@ with lib;
|
||||||
let
|
let
|
||||||
provider = types.submodule {
|
provider = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
expr = mkOption {
|
expr = lib.mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "Expression to eval. Select this attrset as eval .options";
|
description = "Expression to eval. Select this attrset as eval .options";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
helpers.mkNullOrOption (with lib.types; attrsOf (maybeRaw provider)) ''
|
mkNullOrOption (with types; attrsOf (maybeRaw provider)) ''
|
||||||
Tell the language server your desired option set, for completion.
|
Tell the language server your desired option set, for completion.
|
||||||
This is lazily evaluated.
|
This is lazily evaluated.
|
||||||
'';
|
'';
|
||||||
|
@ -47,14 +50,14 @@ with lib;
|
||||||
let
|
let
|
||||||
provider = types.submodule {
|
provider = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
expr = mkOption {
|
expr = lib.mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "Expression to eval. Treat it as `import <nixpkgs> { }`";
|
description = "Expression to eval. Treat it as `import <nixpkgs> { }`";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
helpers.mkNullOrOption (lib.types.maybeRaw provider) ''
|
mkNullOrOption (types.maybeRaw provider) ''
|
||||||
This expression will be interpreted as "nixpkgs" toplevel
|
This expression will be interpreted as "nixpkgs" toplevel
|
||||||
Nixd provides package, lib completion/information from it.
|
Nixd provides package, lib completion/information from it.
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
|
||||||
let
|
let
|
||||||
cfg = config.plugins.lsp.servers.pylsp;
|
cfg = config.plugins.lsp.servers.pylsp;
|
||||||
|
inherit (lib.nixvim) defaultNullOpts mkNullOrOption;
|
||||||
|
inherit (lib) mkOption types;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.lsp.servers.pylsp = {
|
options.plugins.lsp.servers.pylsp = {
|
||||||
pythonPackage = mkPackageOption pkgs "python" {
|
pythonPackage = lib.mkPackageOption pkgs "python" {
|
||||||
default = "python3";
|
default = "python3";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ in
|
||||||
# https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
|
# https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
|
||||||
settings = {
|
settings = {
|
||||||
configurationSources = mkOption {
|
configurationSources = mkOption {
|
||||||
type = lib.types.nullOr (
|
type = types.nullOr (
|
||||||
types.enum [
|
types.enum [
|
||||||
"pycodestyle"
|
"pycodestyle"
|
||||||
"flake8"
|
"flake8"
|
||||||
|
@ -32,108 +32,108 @@ in
|
||||||
|
|
||||||
plugins = {
|
plugins = {
|
||||||
autopep8 = {
|
autopep8 = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
enabled = defaultNullOpts.mkBool true ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin (autopep8).
|
Setting this explicitly to `true` will install the dependency for this plugin (autopep8).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
flake8 = {
|
flake8 = {
|
||||||
config = helpers.mkNullOrOption types.str ''
|
config = mkNullOrOption types.str ''
|
||||||
Path to the config file that will be the authoritative config source.
|
Path to the config file that will be the authoritative config source.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
enabled = defaultNullOpts.mkBool false ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin (flake8).
|
Setting this explicitly to `true` will install the dependency for this plugin (flake8).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
exclude = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
exclude = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
List of files or directories to exclude.
|
List of files or directories to exclude.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
executable = helpers.mkNullOrOption types.str ''
|
executable = mkNullOrOption types.str ''
|
||||||
Path to the flake8 executable.
|
Path to the flake8 executable.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
filename = helpers.mkNullOrOption types.str ''
|
filename = mkNullOrOption types.str ''
|
||||||
Only check for filenames matching the patterns in this list.
|
Only check for filenames matching the patterns in this list.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
hangClosing = helpers.mkNullOrOption types.bool ''
|
hangClosing = mkNullOrOption types.bool ''
|
||||||
Hang closing bracket instead of matching indentation of opening bracket's line.
|
Hang closing bracket instead of matching indentation of opening bracket's line.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
ignore = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
ignore = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
List of errors and warnings to ignore (or skip).
|
List of errors and warnings to ignore (or skip).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
maxComplexity = helpers.mkNullOrOption types.int ''
|
maxComplexity = mkNullOrOption types.int ''
|
||||||
Maximum allowed complexity threshold.
|
Maximum allowed complexity threshold.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
maxLineLength = helpers.mkNullOrOption types.int ''
|
maxLineLength = mkNullOrOption types.int ''
|
||||||
Maximum allowed line length for the entirety of this run.
|
Maximum allowed line length for the entirety of this run.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
indentSize = helpers.mkNullOrOption types.int ''
|
indentSize = mkNullOrOption types.int ''
|
||||||
Set indentation spaces.
|
Set indentation spaces.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
perFileIgnores = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
perFileIgnores = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
A pairing of filenames and violation codes that defines which violations to ignore in a
|
A pairing of filenames and violation codes that defines which violations to ignore in a
|
||||||
particular file.
|
particular file.
|
||||||
|
|
||||||
For example: `["file_path.py:W305,W304"]`.
|
For example: `["file_path.py:W305,W304"]`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
select = helpers.mkNullOrOption (types.listOf types.str) ''
|
select = mkNullOrOption (types.listOf types.str) ''
|
||||||
List of errors and warnings to enable.
|
List of errors and warnings to enable.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
jedi = {
|
jedi = {
|
||||||
auto_import_modules = helpers.defaultNullOpts.mkListOf types.str [
|
auto_import_modules = defaultNullOpts.mkListOf types.str [
|
||||||
"numpy"
|
"numpy"
|
||||||
] "List of module names for `jedi.settings.auto_import_modules`.";
|
] "List of module names for `jedi.settings.auto_import_modules`.";
|
||||||
|
|
||||||
extra_paths = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
extra_paths = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Define extra paths for jedi.Script.
|
Define extra paths for jedi.Script.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
environment = helpers.mkNullOrOption types.str ''
|
environment = mkNullOrOption types.str ''
|
||||||
Define environment for jedi.Script and Jedi.names.
|
Define environment for jedi.Script and Jedi.names.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
jedi_completion = {
|
jedi_completion = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
enabled = defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||||
|
|
||||||
include_params = helpers.defaultNullOpts.mkBool true ''
|
include_params = defaultNullOpts.mkBool true ''
|
||||||
Auto-completes methods and classes with tabstops for each parameter.
|
Auto-completes methods and classes with tabstops for each parameter.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
include_class_objects = helpers.defaultNullOpts.mkBool false ''
|
include_class_objects = defaultNullOpts.mkBool false ''
|
||||||
Adds class objects as a separate completion item.
|
Adds class objects as a separate completion item.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
include_function_objects = helpers.defaultNullOpts.mkBool false ''
|
include_function_objects = defaultNullOpts.mkBool false ''
|
||||||
Adds function objects as a separate completion item.
|
Adds function objects as a separate completion item.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
fuzzy = helpers.defaultNullOpts.mkBool false ''
|
fuzzy = defaultNullOpts.mkBool false ''
|
||||||
Enable fuzzy when requesting autocomplete.
|
Enable fuzzy when requesting autocomplete.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
eager = helpers.defaultNullOpts.mkBool false ''
|
eager = defaultNullOpts.mkBool false ''
|
||||||
Resolve documentation and detail eagerly.
|
Resolve documentation and detail eagerly.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
resolve_at_most = helpers.defaultNullOpts.mkInt 25 ''
|
resolve_at_most = defaultNullOpts.mkInt 25 ''
|
||||||
How many labels and snippets (at most) should be resolved.
|
How many labels and snippets (at most) should be resolved.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
cache_for = helpers.defaultNullOpts.mkListOf types.str [
|
cache_for = defaultNullOpts.mkListOf types.str [
|
||||||
"pandas"
|
"pandas"
|
||||||
"numpy"
|
"numpy"
|
||||||
"tensorflow"
|
"tensorflow"
|
||||||
|
@ -142,159 +142,159 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
jedi_definition = {
|
jedi_definition = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
enabled = defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||||
|
|
||||||
follow_imports = helpers.defaultNullOpts.mkBool true ''
|
follow_imports = defaultNullOpts.mkBool true ''
|
||||||
The goto call will follow imports.
|
The goto call will follow imports.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
follow_builtin_imports = helpers.defaultNullOpts.mkBool true ''
|
follow_builtin_imports = defaultNullOpts.mkBool true ''
|
||||||
If follow_imports is true will decide if it follow builtin imports.
|
If follow_imports is true will decide if it follow builtin imports.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
follow_builtin_definitions = helpers.defaultNullOpts.mkBool true ''
|
follow_builtin_definitions = defaultNullOpts.mkBool true ''
|
||||||
Follow builtin and extension definitions to stubs.
|
Follow builtin and extension definitions to stubs.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
jedi_hover = {
|
jedi_hover = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
enabled = defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||||
};
|
};
|
||||||
|
|
||||||
jedi_references = {
|
jedi_references = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
enabled = defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||||
};
|
};
|
||||||
|
|
||||||
jedi_signature_help = {
|
jedi_signature_help = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
enabled = defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||||
};
|
};
|
||||||
|
|
||||||
jedi_symbols = {
|
jedi_symbols = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
enabled = defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||||
|
|
||||||
all_scopes = helpers.defaultNullOpts.mkBool true ''
|
all_scopes = defaultNullOpts.mkBool true ''
|
||||||
If true lists the names of all scopes instead of only the module namespace.
|
If true lists the names of all scopes instead of only the module namespace.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
include_import_symbols = helpers.defaultNullOpts.mkBool true ''
|
include_import_symbols = defaultNullOpts.mkBool true ''
|
||||||
If true includes symbols imported from other libraries.
|
If true includes symbols imported from other libraries.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
mccabe = {
|
mccabe = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
enabled = defaultNullOpts.mkBool true ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin (mccabe).
|
Setting this explicitly to `true` will install the dependency for this plugin (mccabe).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
threshold = helpers.defaultNullOpts.mkInt 15 ''
|
threshold = defaultNullOpts.mkInt 15 ''
|
||||||
The minimum threshold that triggers warnings about cyclomatic complexity.
|
The minimum threshold that triggers warnings about cyclomatic complexity.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
preload = {
|
preload = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
enabled = defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||||
|
|
||||||
modules = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
modules = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
List of modules to import on startup.
|
List of modules to import on startup.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
pycodestyle = {
|
pycodestyle = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
enabled = defaultNullOpts.mkBool true ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin
|
Setting this explicitly to `true` will install the dependency for this plugin
|
||||||
(pycodestyle).
|
(pycodestyle).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
exclude = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
exclude = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Exclude files or directories which match these patterns.
|
Exclude files or directories which match these patterns.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
filename = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
filename = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
When parsing directories, only check filenames matching these patterns.
|
When parsing directories, only check filenames matching these patterns.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
ropeFolder = helpers.mkNullOrOption (types.listOf types.str) ''
|
ropeFolder = mkNullOrOption (types.listOf types.str) ''
|
||||||
Select errors and warnings.
|
Select errors and warnings.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
ignore = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
ignore = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Ignore errors and warnings.
|
Ignore errors and warnings.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
hangClosing = helpers.mkNullOrOption types.bool ''
|
hangClosing = mkNullOrOption types.bool ''
|
||||||
Hang closing bracket instead of matching indentation of opening bracket's line.
|
Hang closing bracket instead of matching indentation of opening bracket's line.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
maxLineLength = helpers.mkNullOrOption types.int ''
|
maxLineLength = mkNullOrOption types.int ''
|
||||||
Set maximum allowed line length.
|
Set maximum allowed line length.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
indentSize = helpers.mkNullOrOption types.int ''
|
indentSize = mkNullOrOption types.int ''
|
||||||
Set indentation spaces.
|
Set indentation spaces.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
pydocstyle = {
|
pydocstyle = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
enabled = defaultNullOpts.mkBool false ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin
|
Setting this explicitly to `true` will install the dependency for this plugin
|
||||||
(pydocstyle).
|
(pydocstyle).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
convention = helpers.mkNullOrOption (types.enum [
|
convention = mkNullOrOption (types.enum [
|
||||||
"pep257"
|
"pep257"
|
||||||
"numpy"
|
"numpy"
|
||||||
"google"
|
"google"
|
||||||
"None"
|
"None"
|
||||||
]) "Choose the basic list of checked errors by specifying an existing convention.";
|
]) "Choose the basic list of checked errors by specifying an existing convention.";
|
||||||
|
|
||||||
addIgnore = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
addIgnore = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Ignore errors and warnings in addition to the specified convention.
|
Ignore errors and warnings in addition to the specified convention.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
addSelect = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
addSelect = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Select errors and warnings in addition to the specified convention.
|
Select errors and warnings in addition to the specified convention.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
ignore = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
ignore = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Ignore errors and warnings.
|
Ignore errors and warnings.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
select = helpers.mkNullOrOption (types.listOf types.str) ''
|
select = mkNullOrOption (types.listOf types.str) ''
|
||||||
Select errors and warnings.
|
Select errors and warnings.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
match = helpers.defaultNullOpts.mkStr "(?!test_).*\\.py" ''
|
match = defaultNullOpts.mkStr "(?!test_).*\\.py" ''
|
||||||
Check only files that exactly match the given regular expression;
|
Check only files that exactly match the given regular expression;
|
||||||
default is to match files that don't start with 'test_' but end with '.py'.
|
default is to match files that don't start with 'test_' but end with '.py'.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
matchDir = helpers.defaultNullOpts.mkStr "[^\\.].*" ''
|
matchDir = defaultNullOpts.mkStr "[^\\.].*" ''
|
||||||
Search only dirs that exactly match the given regular expression;
|
Search only dirs that exactly match the given regular expression;
|
||||||
default is to match dirs which do not begin with a dot.
|
default is to match dirs which do not begin with a dot.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
pyflakes = {
|
pyflakes = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
enabled = defaultNullOpts.mkBool true ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin (pyflakes).
|
Setting this explicitly to `true` will install the dependency for this plugin (pyflakes).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
pylint = {
|
pylint = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
enabled = defaultNullOpts.mkBool false ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin (pylint).
|
Setting this explicitly to `true` will install the dependency for this plugin (pylint).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
args = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
args = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Arguments to pass to pylint.
|
Arguments to pass to pylint.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
executable = helpers.mkNullOrOption types.str ''
|
executable = mkNullOrOption types.str ''
|
||||||
Executable to run pylint with.
|
Executable to run pylint with.
|
||||||
Enabling this will run pylint on unsaved files via stdin.
|
Enabling this will run pylint on unsaved files via stdin.
|
||||||
Can slow down workflow. Only works with python3.
|
Can slow down workflow. Only works with python3.
|
||||||
|
@ -302,30 +302,30 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
rope_autoimport = {
|
rope_autoimport = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
enabled = defaultNullOpts.mkBool false ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin (rope).
|
Setting this explicitly to `true` will install the dependency for this plugin (rope).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
memory = helpers.defaultNullOpts.mkBool false ''
|
memory = defaultNullOpts.mkBool false ''
|
||||||
Make the autoimport database memory only.
|
Make the autoimport database memory only.
|
||||||
Drastically increases startup time.
|
Drastically increases startup time.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
rope_completion = {
|
rope_completion = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
enabled = defaultNullOpts.mkBool false ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin (rope).
|
Setting this explicitly to `true` will install the dependency for this plugin (rope).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
eager = helpers.defaultNullOpts.mkBool false ''
|
eager = defaultNullOpts.mkBool false ''
|
||||||
Resolve documentation and detail eagerly.
|
Resolve documentation and detail eagerly.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
yapf = {
|
yapf = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
enabled = defaultNullOpts.mkBool true ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin (yapf).
|
Setting this explicitly to `true` will install the dependency for this plugin (yapf).
|
||||||
'';
|
'';
|
||||||
|
@ -333,32 +333,32 @@ in
|
||||||
|
|
||||||
### THIRD-PARTY PLUGINS
|
### THIRD-PARTY PLUGINS
|
||||||
pylsp_mypy = {
|
pylsp_mypy = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
enabled = defaultNullOpts.mkBool false ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin
|
Setting this explicitly to `true` will install the dependency for this plugin
|
||||||
(pylsp-mypy).
|
(pylsp-mypy).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
live_mode = helpers.defaultNullOpts.mkBool true ''
|
live_mode = defaultNullOpts.mkBool true ''
|
||||||
Provides type checking as you type.
|
Provides type checking as you type.
|
||||||
This writes to a tempfile every time a check is done.
|
This writes to a tempfile every time a check is done.
|
||||||
Turning off live_mode means you must save your changes for mypy diagnostics to update
|
Turning off live_mode means you must save your changes for mypy diagnostics to update
|
||||||
correctly.
|
correctly.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
dmypy = helpers.defaultNullOpts.mkBool false ''
|
dmypy = defaultNullOpts.mkBool false ''
|
||||||
Executes via dmypy run rather than mypy.
|
Executes via dmypy run rather than mypy.
|
||||||
This uses the dmypy daemon and may dramatically improve the responsiveness of the pylsp
|
This uses the dmypy daemon and may dramatically improve the responsiveness of the pylsp
|
||||||
server, however this currently does not work in live_mode.
|
server, however this currently does not work in live_mode.
|
||||||
Enabling this disables live_mode, even for conflicting configs.
|
Enabling this disables live_mode, even for conflicting configs.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
strict = helpers.defaultNullOpts.mkBool false ''
|
strict = defaultNullOpts.mkBool false ''
|
||||||
Refers to the strict option of mypy.
|
Refers to the strict option of mypy.
|
||||||
This option often is too strict to be useful.
|
This option often is too strict to be useful.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
overrides = helpers.defaultNullOpts.mkListOf (with types; either bool str) [ true ] ''
|
overrides = defaultNullOpts.mkListOf (with types; either bool str) [ true ] ''
|
||||||
Specifies a list of alternate or supplemental command-line options.
|
Specifies a list of alternate or supplemental command-line options.
|
||||||
This modifies the options passed to mypy or the mypy-specific ones passed to dmypy run.
|
This modifies the options passed to mypy or the mypy-specific ones passed to dmypy run.
|
||||||
When present, the special boolean member true is replaced with the command-line options that
|
When present, the special boolean member true is replaced with the command-line options that
|
||||||
|
@ -367,18 +367,18 @@ in
|
||||||
options (see `mypy.main:process_options` and `mypy --help | grep inverse`).
|
options (see `mypy.main:process_options` and `mypy --help | grep inverse`).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
dmypy_status_file = helpers.defaultNullOpts.mkStr ".dmypy.json" ''
|
dmypy_status_file = defaultNullOpts.mkStr ".dmypy.json" ''
|
||||||
Specifies which status file dmypy should use.
|
Specifies which status file dmypy should use.
|
||||||
This modifies the --status-file option passed to dmypy given dmypy is active.
|
This modifies the --status-file option passed to dmypy given dmypy is active.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
config_sub_paths = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
config_sub_paths = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Specifies sub paths under which the mypy configuration file may be found.
|
Specifies sub paths under which the mypy configuration file may be found.
|
||||||
For each directory searched for the mypy config file, this also searches the sub paths
|
For each directory searched for the mypy config file, this also searches the sub paths
|
||||||
specified here.
|
specified here.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
report_progress = helpers.defaultNullOpts.mkBool false ''
|
report_progress = defaultNullOpts.mkBool false ''
|
||||||
Report basic progress to the LSP client.
|
Report basic progress to the LSP client.
|
||||||
With this option, pylsp-mypy will report when mypy is running, given your editor supports
|
With this option, pylsp-mypy will report when mypy is running, given your editor supports
|
||||||
LSP progress reporting.
|
LSP progress reporting.
|
||||||
|
@ -390,7 +390,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
isort = {
|
isort = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
enabled = defaultNullOpts.mkBool false ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin
|
Setting this explicitly to `true` will install the dependency for this plugin
|
||||||
(pyls-isort).
|
(pyls-isort).
|
||||||
|
@ -398,30 +398,30 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
black = {
|
black = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
enabled = defaultNullOpts.mkBool false ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin
|
Setting this explicitly to `true` will install the dependency for this plugin
|
||||||
(python-lsp-black).
|
(python-lsp-black).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
cache_config = helpers.defaultNullOpts.mkBool false ''
|
cache_config = defaultNullOpts.mkBool false ''
|
||||||
Whether to enable black configuration caching.
|
Whether to enable black configuration caching.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
line_length = helpers.defaultNullOpts.mkInt 88 ''
|
line_length = defaultNullOpts.mkInt 88 ''
|
||||||
An integer that maps to black's max-line-length setting.
|
An integer that maps to black's max-line-length setting.
|
||||||
Defaults to 88 (same as black's default).
|
Defaults to 88 (same as black's default).
|
||||||
This can also be set through black's configuration files, which should be preferred for
|
This can also be set through black's configuration files, which should be preferred for
|
||||||
multi-user projects.
|
multi-user projects.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preview = helpers.defaultNullOpts.mkBool false ''
|
preview = defaultNullOpts.mkBool false ''
|
||||||
Enable or disable black's --preview setting.
|
Enable or disable black's --preview setting.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
memestra = {
|
memestra = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
enabled = defaultNullOpts.mkBool false ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin
|
Setting this explicitly to `true` will install the dependency for this plugin
|
||||||
(pyls-memestra).
|
(pyls-memestra).
|
||||||
|
@ -429,7 +429,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
rope = {
|
rope = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
enabled = defaultNullOpts.mkBool false ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin
|
Setting this explicitly to `true` will install the dependency for this plugin
|
||||||
(pylsp-rope).
|
(pylsp-rope).
|
||||||
|
@ -437,45 +437,45 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
ruff = {
|
ruff = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
enabled = defaultNullOpts.mkBool false ''
|
||||||
Enable or disable the plugin.
|
Enable or disable the plugin.
|
||||||
Setting this explicitly to `true` will install the dependency for this plugin
|
Setting this explicitly to `true` will install the dependency for this plugin
|
||||||
(python-lsp-ruff).
|
(python-lsp-ruff).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
config = helpers.mkNullOrOption types.str "Path to optional pyproject.toml file.";
|
config = mkNullOrOption types.str "Path to optional pyproject.toml file.";
|
||||||
|
|
||||||
exclude = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
exclude = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Exclude files from being checked by ruff.
|
Exclude files from being checked by ruff.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
executable = helpers.mkNullOrOption types.str ''
|
executable = mkNullOrOption types.str ''
|
||||||
Path to the ruff executable. Assumed to be in PATH by default.
|
Path to the ruff executable. Assumed to be in PATH by default.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
ignore = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
ignore = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Error codes to ignore.
|
Error codes to ignore.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
extendIgnore = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
extendIgnore = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Same as ignore, but append to existing ignores.
|
Same as ignore, but append to existing ignores.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
lineLength = helpers.mkNullOrOption types.int "Set the line-length for length checks.";
|
lineLength = mkNullOrOption types.int "Set the line-length for length checks.";
|
||||||
|
|
||||||
perFileIgnores = helpers.mkNullOrOption (with types; attrsOf (listOf str)) ''
|
perFileIgnores = mkNullOrOption (with types; attrsOf (listOf str)) ''
|
||||||
File-specific error codes to be ignored.
|
File-specific error codes to be ignored.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
select = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
select = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
List of error codes to enable.
|
List of error codes to enable.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
extendSelect = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
extendSelect = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
Same as select, but append to existing error codes.
|
Same as select, but append to existing error codes.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
format = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
format = defaultNullOpts.mkListOf types.str [ ] ''
|
||||||
List of error codes to fix during formatting.
|
List of error codes to fix during formatting.
|
||||||
The default is ["I"], any additional codes are appended to this list.
|
The default is ["I"], any additional codes are appended to this list.
|
||||||
'';
|
'';
|
||||||
|
@ -485,11 +485,11 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
rope = {
|
rope = {
|
||||||
extensionModules = helpers.mkNullOrOption types.str ''
|
extensionModules = mkNullOrOption types.str ''
|
||||||
Builtin and c-extension modules that are allowed to be imported and inspected by rope.
|
Builtin and c-extension modules that are allowed to be imported and inspected by rope.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
ropeFolder = helpers.mkNullOrOption (types.listOf types.str) ''
|
ropeFolder = mkNullOrOption (types.listOf types.str) ''
|
||||||
The name of the folder in which rope stores project configurations and data.
|
The name of the folder in which rope stores project configurations and data.
|
||||||
Pass null for not using such a folder at all.
|
Pass null for not using such a folder at all.
|
||||||
'';
|
'';
|
||||||
|
@ -497,7 +497,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
# WARNING: tricky stuff below:
|
# WARNING: tricky stuff below:
|
||||||
# We need to fix the `python-lsp-server` derivation by adding all of the (user enabled)
|
# We need to fix the `python-lsp-server` derivation by adding all of the (user enabled)
|
||||||
# plugins to its `propagatedBuildInputs`.
|
# plugins to its `propagatedBuildInputs`.
|
||||||
|
@ -511,7 +511,7 @@ in
|
||||||
(map
|
(map
|
||||||
(
|
(
|
||||||
pluginName:
|
pluginName:
|
||||||
(optionals (isEnabled plugins.${pluginName}) cfg.package.optional-dependencies.${pluginName})
|
(lib.optionals (isEnabled plugins.${pluginName}) cfg.package.optional-dependencies.${pluginName})
|
||||||
)
|
)
|
||||||
[
|
[
|
||||||
"autopep8"
|
"autopep8"
|
||||||
|
@ -524,20 +524,20 @@ in
|
||||||
"yapf"
|
"yapf"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
++ (optionals (
|
++ (lib.optionals (
|
||||||
(isEnabled plugins.rope_autoimport) || (isEnabled plugins.rope_completion)
|
(isEnabled plugins.rope_autoimport) || (isEnabled plugins.rope_completion)
|
||||||
) cfg.package.optional-dependencies.rope);
|
) cfg.package.optional-dependencies.rope);
|
||||||
|
|
||||||
# All of those plugins have `python-lsp-server` as a dependency.
|
# All of those plugins have `python-lsp-server` as a dependency.
|
||||||
# We need to get rid of it to add them to the `python-lsp-server` derivation itself.
|
# We need to get rid of it to add them to the `python-lsp-server` derivation itself.
|
||||||
thirdPartyPlugins = lists.flatten (
|
thirdPartyPlugins = lib.lists.flatten (
|
||||||
mapAttrsToList
|
lib.mapAttrsToList
|
||||||
(
|
(
|
||||||
pluginName: nixPackage:
|
pluginName: nixPackage:
|
||||||
(optional (isEnabled plugins.${pluginName}) (
|
(lib.optional (isEnabled plugins.${pluginName}) (
|
||||||
nixPackage.overridePythonAttrs (old: {
|
nixPackage.overridePythonAttrs (old: {
|
||||||
# Get rid of the python-lsp-server dependency
|
# Get rid of the python-lsp-server dependency
|
||||||
dependencies = filter (dep: dep.pname != "python-lsp-server") old.dependencies;
|
dependencies = lib.filter (dep: dep.pname != "python-lsp-server") old.dependencies;
|
||||||
|
|
||||||
# Skip testing because those naked dependencies will complain about missing pylsp
|
# Skip testing because those naked dependencies will complain about missing pylsp
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
@ -601,7 +601,7 @@ in
|
||||||
# Final list of pylsp plugins to install
|
# Final list of pylsp plugins to install
|
||||||
pylspPlugins = nativePlugins ++ thirdPartyPlugins;
|
pylspPlugins = nativePlugins ++ thirdPartyPlugins;
|
||||||
in
|
in
|
||||||
mkDefault (
|
lib.mkDefault (
|
||||||
# This is the final default package for pylsp
|
# This is the final default package for pylsp
|
||||||
cfg.pythonPackage.pkgs.python-lsp-server.overridePythonAttrs (old: {
|
cfg.pythonPackage.pkgs.python-lsp-server.overridePythonAttrs (old: {
|
||||||
propagatedBuildInputs = pylspPlugins ++ old.dependencies;
|
propagatedBuildInputs = pylspPlugins ++ old.dependencies;
|
||||||
|
|
|
@ -1,44 +1,47 @@
|
||||||
# TODO: make all the types support raw lua
|
# TODO: make all the types support raw lua
|
||||||
lib:
|
lib:
|
||||||
let
|
let
|
||||||
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
inherit (lib) types;
|
||||||
|
|
||||||
rustAnalyzerOptions = import ../../../generated/rust-analyzer.nix;
|
rustAnalyzerOptions = import ../../../generated/rust-analyzer.nix;
|
||||||
|
|
||||||
mkRustAnalyzerType =
|
mkRustAnalyzerType =
|
||||||
{ kind, ... }@typeInfo:
|
{ kind, ... }@typeInfo:
|
||||||
if kind == "enum" then
|
if kind == "enum" then
|
||||||
lib.types.enum typeInfo.values
|
types.enum typeInfo.values
|
||||||
else if kind == "oneOf" then
|
else if kind == "oneOf" then
|
||||||
lib.types.oneOf (lib.map mkRustAnalyzerType typeInfo.subTypes)
|
types.oneOf (lib.map mkRustAnalyzerType typeInfo.subTypes)
|
||||||
else if kind == "list" then
|
else if kind == "list" then
|
||||||
lib.types.listOf (mkRustAnalyzerType typeInfo.item)
|
types.listOf (mkRustAnalyzerType typeInfo.item)
|
||||||
else if kind == "number" then
|
else if kind == "number" then
|
||||||
let
|
let
|
||||||
inherit (typeInfo) minimum maximum;
|
inherit (typeInfo) minimum maximum;
|
||||||
in
|
in
|
||||||
if minimum != null && maximum != null then
|
if minimum != null && maximum != null then
|
||||||
lib.types.numbers.between minimum maximum
|
types.numbers.between minimum maximum
|
||||||
else if minimum != null then
|
else if minimum != null then
|
||||||
lib.types.addCheck lib.types.number (x: x >= minimum)
|
types.addCheck types.number (x: x >= minimum)
|
||||||
else if maximum != null then
|
else if maximum != null then
|
||||||
lib.types.addCheck lib.types.number (x: x <= maximum)
|
types.addCheck types.number (x: x <= maximum)
|
||||||
else
|
else
|
||||||
lib.types.number
|
types.number
|
||||||
else if kind == "integer" then
|
else if kind == "integer" then
|
||||||
let
|
let
|
||||||
inherit (typeInfo) minimum maximum;
|
inherit (typeInfo) minimum maximum;
|
||||||
in
|
in
|
||||||
if minimum != null && maximum != null then
|
if minimum != null && maximum != null then
|
||||||
lib.types.ints.between minimum maximum
|
types.ints.between minimum maximum
|
||||||
else if minimum != null then
|
else if minimum != null then
|
||||||
lib.types.addCheck lib.types.int (x: x >= minimum)
|
types.addCheck types.int (x: x >= minimum)
|
||||||
else if maximum != null then
|
else if maximum != null then
|
||||||
lib.types.addCheck lib.types.int (x: x <= maximum)
|
types.addCheck types.int (x: x <= maximum)
|
||||||
else
|
else
|
||||||
lib.types.int
|
types.int
|
||||||
else if kind == "object" then
|
else if kind == "object" then
|
||||||
lib.types.attrsOf lib.types.anything
|
types.attrsOf types.anything
|
||||||
else if kind == "submodule" then
|
else if kind == "submodule" then
|
||||||
lib.types.submodule {
|
types.submodule {
|
||||||
options = lib.mapAttrs (
|
options = lib.mapAttrs (
|
||||||
_: ty:
|
_: ty:
|
||||||
lib.mkOption {
|
lib.mkOption {
|
||||||
|
@ -48,9 +51,9 @@ let
|
||||||
) typeInfo.options;
|
) typeInfo.options;
|
||||||
}
|
}
|
||||||
else if kind == "string" then
|
else if kind == "string" then
|
||||||
lib.types.str
|
types.str
|
||||||
else if kind == "boolean" then
|
else if kind == "boolean" then
|
||||||
lib.types.bool
|
types.bool
|
||||||
else
|
else
|
||||||
throw "Unknown type: ${kind}";
|
throw "Unknown type: ${kind}";
|
||||||
|
|
||||||
|
@ -60,7 +63,7 @@ let
|
||||||
pluginDefault,
|
pluginDefault,
|
||||||
type,
|
type,
|
||||||
}:
|
}:
|
||||||
lib.nixvim.defaultNullOpts.mkNullable' {
|
defaultNullOpts.mkNullable' {
|
||||||
inherit description pluginDefault;
|
inherit description pluginDefault;
|
||||||
type = mkRustAnalyzerType type;
|
type = mkRustAnalyzerType type;
|
||||||
};
|
};
|
||||||
|
@ -72,8 +75,8 @@ let
|
||||||
in
|
in
|
||||||
lib.setAttrByPath parts value;
|
lib.setAttrByPath parts value;
|
||||||
|
|
||||||
nestedNixOptions = lib.attrsets.mapAttrsToList (
|
nestedNixOptions = lib.mapAttrsToList (
|
||||||
name: value: nestOpt name (mkNixOption value)
|
name: value: nestOpt name (mkNixOption value)
|
||||||
) rustAnalyzerOptions;
|
) rustAnalyzerOptions;
|
||||||
in
|
in
|
||||||
(builtins.foldl' lib.attrsets.recursiveUpdate { } nestedNixOptions).rust-analyzer
|
(builtins.foldl' lib.recursiveUpdate { } nestedNixOptions).rust-analyzer
|
||||||
|
|
|
@ -4,26 +4,26 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
|
||||||
let
|
let
|
||||||
cfg = config.plugins.lsp.servers.rust_analyzer;
|
cfg = config.plugins.lsp.servers.rust_analyzer;
|
||||||
|
inherit (lib) mkPackageOption types;
|
||||||
|
inherit (lib.nixvim) mkNullOrOption';
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.lsp.servers.rust_analyzer = {
|
options.plugins.lsp.servers.rust_analyzer = {
|
||||||
# https://github.com/nix-community/nixvim/issues/674
|
# https://github.com/nix-community/nixvim/issues/674
|
||||||
installCargo = mkOption {
|
installCargo = mkNullOrOption' {
|
||||||
type = with types; nullOr bool;
|
type = types.bool;
|
||||||
default = null;
|
|
||||||
example = true;
|
example = true;
|
||||||
description = "Whether to install `cargo`.";
|
description = "Whether to install `cargo`.";
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: make nullable?
|
# TODO: make nullable?
|
||||||
cargoPackage = mkPackageOption pkgs "cargo" { };
|
cargoPackage = lib.mkPackageOption pkgs "cargo" { };
|
||||||
|
|
||||||
installRustc = mkOption {
|
installRustc = mkNullOrOption' {
|
||||||
type = with types; nullOr bool;
|
type = types.bool;
|
||||||
default = null;
|
|
||||||
example = true;
|
example = true;
|
||||||
description = "Whether to install `rustc`.";
|
description = "Whether to install `rustc`.";
|
||||||
};
|
};
|
||||||
|
@ -31,9 +31,8 @@ in
|
||||||
# TODO: make nullable
|
# TODO: make nullable
|
||||||
rustcPackage = mkPackageOption pkgs "rustc" { };
|
rustcPackage = mkPackageOption pkgs "rustc" { };
|
||||||
|
|
||||||
installRustfmt = mkOption {
|
installRustfmt = mkNullOrOption' {
|
||||||
type = with types; nullOr bool;
|
type = types.bool;
|
||||||
default = null;
|
|
||||||
example = true;
|
example = true;
|
||||||
description = "Whether to install `rustfmt`.";
|
description = "Whether to install `rustfmt`.";
|
||||||
};
|
};
|
||||||
|
@ -41,9 +40,9 @@ in
|
||||||
# TODO: make nullable
|
# TODO: make nullable
|
||||||
rustfmtPackage = mkPackageOption pkgs "rustfmt" { };
|
rustfmtPackage = mkPackageOption pkgs "rustfmt" { };
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
warnings =
|
warnings =
|
||||||
(optional (cfg.installCargo == null) ''
|
(lib.optional (cfg.installCargo == null) ''
|
||||||
`rust_analyzer` relies on `cargo`.
|
`rust_analyzer` relies on `cargo`.
|
||||||
- Set `plugins.lsp.servers.rust_analyzer.installCargo = true` to install it automatically
|
- Set `plugins.lsp.servers.rust_analyzer.installCargo = true` to install it automatically
|
||||||
with Nixvim.
|
with Nixvim.
|
||||||
|
@ -53,7 +52,7 @@ in
|
||||||
through Nixvim.
|
through Nixvim.
|
||||||
By doing so, you will dismiss this warning.
|
By doing so, you will dismiss this warning.
|
||||||
'')
|
'')
|
||||||
++ (optional (cfg.installRustc == null) ''
|
++ (lib.optional (cfg.installRustc == null) ''
|
||||||
`rust_analyzer` relies on `rustc`.
|
`rust_analyzer` relies on `rustc`.
|
||||||
- Set `plugins.lsp.servers.rust_analyzer.installRustc = true` to install it automatically
|
- Set `plugins.lsp.servers.rust_analyzer.installRustc = true` to install it automatically
|
||||||
with Nixvim.
|
with Nixvim.
|
||||||
|
@ -65,9 +64,11 @@ in
|
||||||
'');
|
'');
|
||||||
|
|
||||||
extraPackages =
|
extraPackages =
|
||||||
with pkgs;
|
let
|
||||||
optional (isBool cfg.installCargo && cfg.installCargo) cfg.cargoPackage
|
isEnabled = x: lib.isBool x && x;
|
||||||
++ optional (isBool cfg.installRustc && cfg.installRustc) cfg.rustcPackage
|
in
|
||||||
++ optional (isBool cfg.installRustfmt && cfg.installRustfmt) cfg.rustfmtPackage;
|
lib.optional (isEnabled cfg.installCargo) cfg.cargoPackage
|
||||||
|
++ lib.optional (isEnabled cfg.installRustc) cfg.rustcPackage
|
||||||
|
++ lib.optional (isEnabled cfg.installRustfmt) cfg.rustfmtPackage;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
|
||||||
let
|
let
|
||||||
cfg = config.plugins.lsp.servers.svelte;
|
cfg = config.plugins.lsp.servers.svelte;
|
||||||
|
inherit (lib.nixvim) defaultNullOpts mkNullOrOption;
|
||||||
|
inherit (lib) types;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Options: https://github.com/sveltejs/language-tools/tree/master/packages/language-server#settings
|
# Options: https://github.com/sveltejs/language-tools/tree/master/packages/language-server#settings
|
||||||
|
@ -14,161 +14,161 @@ in
|
||||||
svelte = {
|
svelte = {
|
||||||
plugin = {
|
plugin = {
|
||||||
typescript = {
|
typescript = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true "Enable the TypeScript plugin.";
|
enable = defaultNullOpts.mkBool true "Enable the TypeScript plugin.";
|
||||||
|
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable diagnostic messages for TypeScript.
|
Enable diagnostic messages for TypeScript.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
hover = {
|
hover = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable hover info for TypeScript.
|
Enable hover info for TypeScript.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
documentSymbols = {
|
documentSymbols = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable document symbols for TypeScript.
|
Enable document symbols for TypeScript.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
completions = {
|
completions = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable completions for TypeScript.
|
Enable completions for TypeScript.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
codeActions = {
|
codeActions = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable code actions for TypeScript.
|
Enable code actions for TypeScript.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
selectionRange = {
|
selectionRange = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable selection range for TypeScript.
|
Enable selection range for TypeScript.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
signatureHelp = {
|
signatureHelp = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable signature help (parameter hints) for JS/TS.
|
Enable signature help (parameter hints) for JS/TS.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
semanticTokens = {
|
semanticTokens = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable semantic tokens (semantic highlight) for TypeScript.
|
Enable semantic tokens (semantic highlight) for TypeScript.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
css = {
|
css = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true "Enable the CSS plugin.";
|
enable = defaultNullOpts.mkBool true "Enable the CSS plugin.";
|
||||||
|
|
||||||
globals = helpers.mkNullOrOption types.str ''
|
globals = mkNullOrOption types.str ''
|
||||||
Which css files should be checked for global variables (`--global-var: value;`).
|
Which css files should be checked for global variables (`--global-var: value;`).
|
||||||
These variables are added to the css completions.
|
These variables are added to the css completions.
|
||||||
String of comma-separated file paths or globs relative to workspace root.
|
String of comma-separated file paths or globs relative to workspace root.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable diagnostic messages for CSS.
|
Enable diagnostic messages for CSS.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
hover = {
|
hover = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable hover info for CSS.
|
Enable hover info for CSS.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
completions = {
|
completions = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable completions for CSS.
|
Enable completions for CSS.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
emmet = helpers.defaultNullOpts.mkBool true ''
|
emmet = defaultNullOpts.mkBool true ''
|
||||||
Enable emmet auto completions for CSS.
|
Enable emmet auto completions for CSS.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
documentColors = {
|
documentColors = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable document colors for CSS.
|
Enable document colors for CSS.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
colorPresentations = {
|
colorPresentations = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable color picker for CSS.
|
Enable color picker for CSS.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
documentSymbols = {
|
documentSymbols = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable document symbols for CSS.
|
Enable document symbols for CSS.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
selectionRange = {
|
selectionRange = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable selection range for CSS.
|
Enable selection range for CSS.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
html = {
|
html = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true "Enable the HTML plugin.";
|
enable = defaultNullOpts.mkBool true "Enable the HTML plugin.";
|
||||||
|
|
||||||
hover = {
|
hover = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable hover info for HTML.
|
Enable hover info for HTML.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
completions = {
|
completions = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable completions for HTML.
|
Enable completions for HTML.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
emmet = helpers.defaultNullOpts.mkBool true ''
|
emmet = defaultNullOpts.mkBool true ''
|
||||||
Enable emmet auto completions for HTML.
|
Enable emmet auto completions for HTML.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
tagComplete = {
|
tagComplete = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable tag auto closing.
|
Enable tag auto closing.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
documentSymbols = {
|
documentSymbols = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable document symbols for HTML.
|
Enable document symbols for HTML.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
linkedEditing = {
|
linkedEditing = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable Linked Editing for HTML.
|
Enable Linked Editing for HTML.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
svelte = {
|
svelte = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true "Enable the Svelte plugin.";
|
enable = defaultNullOpts.mkBool true "Enable the Svelte plugin.";
|
||||||
|
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable diagnostic messages for Svelte.
|
Enable diagnostic messages for Svelte.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
compilerWarnings = helpers.mkNullOrOption (with types; attrsOf str) ''
|
compilerWarnings = mkNullOrOption (with types; attrsOf str) ''
|
||||||
Svelte compiler warning codes to ignore or to treat as errors.
|
Svelte compiler warning codes to ignore or to treat as errors.
|
||||||
Example:
|
Example:
|
||||||
```
|
```
|
||||||
|
@ -179,7 +179,7 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
format = {
|
format = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable formatting for Svelte (includes css & js) using `prettier-plugin-svelte`.
|
Enable formatting for Svelte (includes css & js) using `prettier-plugin-svelte`.
|
||||||
|
|
||||||
You can set some formatting options through this extension.
|
You can set some formatting options through this extension.
|
||||||
|
@ -188,21 +188,21 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
svelteSortOrder = helpers.defaultNullOpts.mkStr "options-scripts-markup-styles" ''
|
svelteSortOrder = defaultNullOpts.mkStr "options-scripts-markup-styles" ''
|
||||||
Format: join the keys `options`, `scripts`, `markup`, `styles` with a `-` in the
|
Format: join the keys `options`, `scripts`, `markup`, `styles` with a `-` in the
|
||||||
order you want.
|
order you want.
|
||||||
|
|
||||||
This option is ignored if there's any kind of configuration file, for example a
|
This option is ignored if there's any kind of configuration file, for example a
|
||||||
`.prettierrc` file.
|
`.prettierrc` file.
|
||||||
'';
|
'';
|
||||||
svelteStrictMode = helpers.defaultNullOpts.mkBool false ''
|
svelteStrictMode = defaultNullOpts.mkBool false ''
|
||||||
More strict HTML syntax.
|
More strict HTML syntax.
|
||||||
|
|
||||||
This option is ignored if there's any kind of configuration file, for example a
|
This option is ignored if there's any kind of configuration file, for example a
|
||||||
`.prettierrc` file.
|
`.prettierrc` file.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
svelteAllowShorthand = helpers.defaultNullOpts.mkBool true ''
|
svelteAllowShorthand = defaultNullOpts.mkBool true ''
|
||||||
Option to enable/disable component attribute shorthand if attribute name and
|
Option to enable/disable component attribute shorthand if attribute name and
|
||||||
expression are the same.
|
expression are the same.
|
||||||
|
|
||||||
|
@ -210,21 +210,21 @@ in
|
||||||
`.prettierrc` file.
|
`.prettierrc` file.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
svelteBracketNewLine = helpers.defaultNullOpts.mkBool true ''
|
svelteBracketNewLine = defaultNullOpts.mkBool true ''
|
||||||
Put the `>` of a multiline element on a new line.
|
Put the `>` of a multiline element on a new line.
|
||||||
|
|
||||||
This option is ignored if there's any kind of configuration file, for example a
|
This option is ignored if there's any kind of configuration file, for example a
|
||||||
`.prettierrc` file.
|
`.prettierrc` file.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
svelteIndentScriptAndStyle = helpers.defaultNullOpts.mkBool true ''
|
svelteIndentScriptAndStyle = defaultNullOpts.mkBool true ''
|
||||||
Whether or not to indent code inside `<script>` and `<style>` tags.
|
Whether or not to indent code inside `<script>` and `<style>` tags.
|
||||||
|
|
||||||
This option is ignored if there's any kind of configuration file, for example a
|
This option is ignored if there's any kind of configuration file, for example a
|
||||||
`.prettierrc` file.
|
`.prettierrc` file.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
printWidth = helpers.defaultNullOpts.mkInt 80 ''
|
printWidth = defaultNullOpts.mkInt 80 ''
|
||||||
Maximum line width after which code is tried to be broken up.
|
Maximum line width after which code is tried to be broken up.
|
||||||
|
|
||||||
This is a Prettier core option.
|
This is a Prettier core option.
|
||||||
|
@ -234,7 +234,7 @@ in
|
||||||
`.prettierrc` file.
|
`.prettierrc` file.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
singleQuote = helpers.defaultNullOpts.mkBool false ''
|
singleQuote = defaultNullOpts.mkBool false ''
|
||||||
Use single quotes instead of double quotes, where possible.
|
Use single quotes instead of double quotes, where possible.
|
||||||
|
|
||||||
This is a Prettier core option.
|
This is a Prettier core option.
|
||||||
|
@ -247,37 +247,37 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
hover = {
|
hover = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable hover info for Svelte (for tags like `#if`/`#each`).
|
Enable hover info for Svelte (for tags like `#if`/`#each`).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
completions = {
|
completions = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable completions for TypeScript.
|
Enable completions for TypeScript.
|
||||||
Enable autocompletion for Svelte (for tags like `#if`/`#each`).
|
Enable autocompletion for Svelte (for tags like `#if`/`#each`).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
rename = {
|
rename = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable rename/move Svelte files functionality.
|
Enable rename/move Svelte files functionality.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
codeActions = {
|
codeActions = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable code actions for Svelte.
|
Enable code actions for Svelte.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
selectionRange = {
|
selectionRange = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true ''
|
enable = defaultNullOpts.mkBool true ''
|
||||||
Enable selection range for Svelte.
|
Enable selection range for Svelte.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultScriptLanguage = helpers.mkNullOrOption types.str ''
|
defaultScriptLanguage = mkNullOrOption types.str ''
|
||||||
The default language to use when generating new script tags in Svelte.
|
The default language to use when generating new script tags in Svelte.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -285,7 +285,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
plugins.lsp.servers.svelte.extraOptions.init_options = {
|
plugins.lsp.servers.svelte.extraOptions.init_options = {
|
||||||
configuration = cfg.initOptions;
|
configuration = cfg.initOptions;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue