mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-10 12:21:40 +00:00
feat: refactor dart and elixir LSPs according to the new structure
This commit is contained in:
parent
07d5aee29c
commit
824c852ec1
12 changed files with 167 additions and 87 deletions
90
modules/languages/dart/dart.nix
Normal file
90
modules/languages/dart/dart.nix
Normal file
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; let
|
||||
cfg = config.vim.languages.dart;
|
||||
defaultServer = "dart";
|
||||
servers = {
|
||||
dart = {
|
||||
package = pkgs.dart;
|
||||
lspConfig = ''
|
||||
lspconfig.dart.setup{
|
||||
capabilities = capabilities;
|
||||
on_attach=default_on_attach;
|
||||
cmd = {"${pkgs.dart}/bin/dart"};
|
||||
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.dartOpts}"}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.dart = {
|
||||
enable = mkEnableOption "Dart language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkOption {
|
||||
description = "Enable Dart treesitter";
|
||||
type = types.bool;
|
||||
default = config.vim.languages.enableTreesitter;
|
||||
};
|
||||
package = nvim.types.mkGrammarOption pkgs "dart";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkOption {
|
||||
description = "Enable Dart LSP support";
|
||||
type = types.bool;
|
||||
default = config.vim.languages.enableLSP;
|
||||
};
|
||||
server = mkOption {
|
||||
description = "The Dart LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
package = mkOption {
|
||||
description = "Dart LSP server package";
|
||||
type = types.package;
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
opts = mkOption {
|
||||
description = "Options to pass to Dart LSP server";
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
|
||||
flutter-tools = {
|
||||
enable = mkEnableOption "Enable flutter-tools for flutter support";
|
||||
|
||||
color = {
|
||||
enable = mkEnableOption "Whether or mot to highlight color variables at all";
|
||||
|
||||
highlightBackground = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Highlight the background";
|
||||
};
|
||||
|
||||
highlightForeground = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Highlight the foreground";
|
||||
};
|
||||
|
||||
virtualText = {
|
||||
enable = mkEnableOption "Show the highlight using virtual text";
|
||||
|
||||
character = mkOption {
|
||||
type = types.str;
|
||||
default = "■";
|
||||
description = "Virtual text character to highlight";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue