mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 13:19:48 +01:00
feat: implement flutter-tools.nvim
This commit is contained in:
parent
513087b8bd
commit
4d748c6c1b
3 changed files with 74 additions and 0 deletions
33
modules/lsp/flutter-tools-nvim/config.nix
Normal file
33
modules/lsp/flutter-tools-nvim/config.nix
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib;
|
||||||
|
with builtins; let
|
||||||
|
cfg = config.vim.lsp;
|
||||||
|
ftcfg = cfg.dart.flutter-tools;
|
||||||
|
in {
|
||||||
|
config = mkIf (cfg.enable && ftcfg.enable) {
|
||||||
|
vim.startPlugins = ["flutter-tools"];
|
||||||
|
|
||||||
|
vim.luaConfigRC.flutter-tools = nvim.dag.entryAnywhere ''
|
||||||
|
require('flutter-tools').setup {
|
||||||
|
lsp = {
|
||||||
|
color = { -- show the derived colours for dart variables
|
||||||
|
enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
|
||||||
|
background = ${boolToString ftcfg.color.highlightBackground}, -- highlight the background
|
||||||
|
foreground = ${boolToString ftcfg.color.highlightForeground}, -- highlight the foreground
|
||||||
|
virtual_text = ${boolToString ftcfg.color.virtualText.enable}, -- show the highlight using virtual text
|
||||||
|
virtual_text_str = ${ctcfg.color.virtualText.character} -- the virtual text character to highlight
|
||||||
|
},
|
||||||
|
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_on_attach;
|
||||||
|
flags = lsp_flags,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
6
modules/lsp/flutter-tools-nvim/default.nix
Normal file
6
modules/lsp/flutter-tools-nvim/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
_: {
|
||||||
|
imports = [
|
||||||
|
./flutter-tools.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
35
modules/lsp/flutter-tools-nvim/flutter-tools.nix
Normal file
35
modules/lsp/flutter-tools-nvim/flutter-tools.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib;
|
||||||
|
with builtins; {
|
||||||
|
options.vim.lsp.dart.flutter-tools = {
|
||||||
|
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…
Reference in a new issue