diff --git a/plugins/lsp/language-servers/dartls-settings.nix b/plugins/lsp/language-servers/dartls-settings.nix new file mode 100644 index 00000000..aa9f8a68 --- /dev/null +++ b/plugins/lsp/language-servers/dartls-settings.nix @@ -0,0 +1,60 @@ +{ + lib, + helpers, +}: +with lib; { + analysisExcludedFolders = helpers.mkNullOrOption (with types; listOf str) '' + An array of paths (absolute or relative to each workspace folder) that should be excluded from + analysis. + ''; + + enableSdkFormatter = helpers.mkNullOrOption types.bool '' + When set to false, prevents registration (or unregisters) the SDK formatter. + When set to true or not supplied, will register/reregister the SDK formatter + ''; + + lineLength = helpers.mkNullOrOption types.ints.unsigned '' + The number of characters the formatter should wrap code at. + If unspecified, code will be wrapped at 80 characters. + ''; + + completeFunctionCalls = helpers.mkNullOrOption types.bool '' + When set to true, completes functions/methods with their required parameters. + ''; + + showTodos = helpers.mkNullOrOption types.bool '' + Whether to generate diagnostics for TODO comments. + If unspecified, diagnostics will not be generated. + ''; + + renameFilesWithClasses = helpers.mkNullOrOption (types.enum ["always" "prompt"]) '' + When set to "always", will include edits to rename files when classes are renamed if the + filename matches the class name (but in snake_form). + When set to "prompt", a prompt will be shown on each class rename asking to confirm the file + rename. + Otherwise, files will not be renamed. + Renames are performed using LSP's `ResourceOperation` edits - that means the rename is simply + included in the resulting `WorkspaceEdit` and must be handled by the client. + ''; + + enableSnippets = helpers.mkNullOrOption types.bool '' + Whether to include code snippets (such as class, stful, switch) in code completion. + When unspecified, snippets will be included. + ''; + + updateImportsOnRename = helpers.mkNullOrOption types.bool '' + Whether to update imports and other directives when files are renamed. + When unspecified, imports will be updated if the client supports `willRenameFiles` requests. + ''; + + documentation = helpers.mkNullOrOption (types.enum ["none" "summary" "full"]) '' + The typekind of dartdocs to include in Hovers, Code Completion, Signature Help and other similar + requests. + If not set, defaults to `"full"`. + ''; + + includeDependenciesInWorkspaceSymbols = helpers.mkNullOrOption types.bool '' + Whether to include symbols from dependencies and Dart/Flutter SDKs in Workspace Symbol results. + If not set, defaults to true. + ''; +} diff --git a/plugins/lsp/language-servers/default.nix b/plugins/lsp/language-servers/default.nix index dd358cb4..b3651fd9 100644 --- a/plugins/lsp/language-servers/default.nix +++ b/plugins/lsp/language-servers/default.nix @@ -84,91 +84,7 @@ with lib; let name = "dartls"; description = "dart language-server"; package = pkgs.dart; - settingsOptions = { - analysisExcludedFolders = mkOption { - type = types.nullOr (types.listOf types.str); - default = null; - description = '' - An array of paths (absolute or relative to each workspace folder) that should be - excluded from analysis. - ''; - }; - enableSdkFormatter = mkOption { - type = types.nullOr types.bool; - default = null; - description = '' - When set to false, prevents registration (or unregisters) the SDK formatter. When set - to true or not supplied, will register/reregister the SDK formatter - ''; - }; - lineLength = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The number of characters the formatter should wrap code at. If unspecified, code will - be wrapped at 80 characters. - ''; - }; - completeFunctionCalls = mkOption { - type = types.nullOr types.bool; - default = true; - description = '' - When set to true, completes functions/methods with their required parameters. - ''; - }; - showTodos = mkOption { - type = types.nullOr types.bool; - default = true; - description = '' - Whether to generate diagnostics for TODO comments. If unspecified, diagnostics will not - be generated. - ''; - }; - renameFilesWithClasses = mkOption { - type = types.nullOr (types.enum ["always" "prompt"]); - default = null; - description = '' - When set to "always", will include edits to rename files when classes are renamed if the - filename matches the class name (but in snake_form). When set to "prompt", a prompt will - be shown on each class rename asking to confirm the file rename. Otherwise, files will - not be renamed. Renames are performed using LSP's ResourceOperation edits - that means - the rename is simply included in the resulting WorkspaceEdit and must be handled by the - client. - ''; - }; - enableSnippets = mkOption { - type = types.nullOr types.bool; - default = null; - description = '' - Whether to include code snippets (such as class, stful, switch) in code completion. When - unspecified, snippets will be included. - ''; - }; - updateImportsOnRename = mkOption { - type = types.nullOr types.bool; - default = null; - description = '' - Whether to update imports and other directives when files are renamed. When unspecified, - imports will be updated if the client supports willRenameFiles requests - ''; - }; - documentation = mkOption { - type = types.nullOr (types.enum ["none" "summary" "full"]); - default = null; - description = '' - The typekind of dartdocs to include in Hovers, Code Completion, Signature Help and other - similar requests. If not set, defaults to full - ''; - }; - includeDependenciesInWorkspaceSymbols = mkOption { - type = types.nullOr types.bool; - default = null; - description = '' - Whether to include symbols from dependencies and Dart/Flutter SDKs in Workspace Symbol - results. If not set, defaults to true. - ''; - }; - }; + settingsOptions = import ./dartls-settings.nix {inherit lib helpers;}; settings = cfg: {dart = cfg;}; } {