mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-04-15 00:58:37 +00:00
Dart module
Some checks are pending
Check for typos in the source tree / check-typos (push) Waiting to run
Some checks are pending
Check for typos in the source tree / check-typos (push) Waiting to run
This commit is contained in:
parent
0a58c33029
commit
077a27da08
1 changed files with 40 additions and 8 deletions
|
@ -6,12 +6,15 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.trivial) boolToString;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) enum either listOf package nullOr str bool;
|
||||
inherit (lib.types) enum either listOf package str bool;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.trivial) boolToString;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.languages) lspOptions;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
|
@ -31,9 +34,32 @@
|
|||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/dart", "language-server", "--protocol=lsp"}''
|
||||
};
|
||||
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.dartOpts}"}
|
||||
}
|
||||
'';
|
||||
|
||||
options = {
|
||||
capabilities = mkLuaInline "capabilities";
|
||||
on_attach = mkLuaInline "default_on_attach";
|
||||
filetypes = ["dart"];
|
||||
cmd =
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ["${getExe cfg.lsp.package}" "language-server" "--protocol=lsp"];
|
||||
single_file_support = true;
|
||||
init_options = {
|
||||
closingLabels = true;
|
||||
flutterOutline = true;
|
||||
onlyAnalyzeProjectsWithOpenFiles = true;
|
||||
outline = true;
|
||||
suggestFromUnimportedLibraries = true;
|
||||
};
|
||||
settings = {
|
||||
dart = {
|
||||
completeFunctionCalls = true;
|
||||
showTodos = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -52,6 +78,7 @@ in {
|
|||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
|
@ -59,10 +86,15 @@ in {
|
|||
description = "Dart LSP server package, or the command to run as a list of strings";
|
||||
};
|
||||
|
||||
opts = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Options to pass to Dart LSP server";
|
||||
options = mkOption {
|
||||
type = lspOptions;
|
||||
default = servers.${cfg.lsp.server}.options;
|
||||
description = ''
|
||||
LSP options for CUE language support.
|
||||
|
||||
This option is freeform, you may add options that are not set by default
|
||||
and they will be merged into the final table passed to lspconfig.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue