mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
Merge pull request #38 from NotAShelf/flutter-tools.nvim
Feature/flutter-tools.nvim
This commit is contained in:
commit
7590bdf0ad
9 changed files with 128 additions and 21 deletions
17
flake.lock
17
flake.lock
|
@ -256,6 +256,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"dart-tools": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1680456818,
|
||||
"narHash": "sha256-VNSrYJZKcQ92+2ko5ZkOOiAM/sXqbJtpkYvxFr1qtWk=",
|
||||
"owner": "akinsho",
|
||||
"repo": "flutter-tools.nvim",
|
||||
"rev": "0a7e6b40aebd874e957ed630420a267e6cac0967",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "akinsho",
|
||||
"repo": "flutter-tools.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"dashboard-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -1236,6 +1252,7 @@
|
|||
"comment-nvim": "comment-nvim",
|
||||
"copilot-lua": "copilot-lua",
|
||||
"crates-nvim": "crates-nvim",
|
||||
"dart-tools": "dart-tools",
|
||||
"dashboard-nvim": "dashboard-nvim",
|
||||
"diffview-nvim": "diffview-nvim",
|
||||
"dressing-nvim": "dressing-nvim",
|
||||
|
|
|
@ -135,6 +135,11 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
flutter-tools = {
|
||||
url = "github:akinsho/flutter-tools.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Copying/Registers
|
||||
registers = {
|
||||
url = "github:tversteeg/registers.nvim";
|
||||
|
|
|
@ -72,6 +72,7 @@ with lib; let
|
|||
"fidget-nvim"
|
||||
"diffview-nvim"
|
||||
"todo-comments"
|
||||
"flutter-tools"
|
||||
];
|
||||
# You can either use the name of the plugin or a package.
|
||||
pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package));
|
||||
|
|
|
@ -10,5 +10,8 @@
|
|||
./trouble
|
||||
./lsp-signature
|
||||
./lightbulb
|
||||
|
||||
# flutter-tools
|
||||
./flutter-tools-nvim
|
||||
];
|
||||
}
|
||||
|
|
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 = ${ftcfg.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";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -57,6 +57,13 @@ in {
|
|||
default = "";
|
||||
};
|
||||
};
|
||||
|
||||
dart = {
|
||||
flutter-tools = {
|
||||
enable = mkEnableOption "";
|
||||
};
|
||||
};
|
||||
|
||||
sql = mkEnableOption "SQL Language LSP";
|
||||
go = mkEnableOption "Go language LSP";
|
||||
ts = mkEnableOption "TS language LSP";
|
||||
|
|
|
@ -12,17 +12,16 @@ in {
|
|||
|
||||
vim.luaConfigRC.whichkey = nvim.dag.entryAnywhere ''
|
||||
local wk = require("which-key")
|
||||
wk.setup {}
|
||||
|
||||
|
||||
wk.register({
|
||||
wk.setup ({
|
||||
key_labels = {
|
||||
["<space>"] = "SPACE",
|
||||
["<leader>"] = "SPACE",
|
||||
["<cr>"] = "RETURN",
|
||||
["<tab>"] = "TAB",
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
wk.register({
|
||||
${
|
||||
if config.vim.tabline.nvimBufferline.enable
|
||||
then ''
|
||||
|
@ -31,7 +30,6 @@ in {
|
|||
["<leader>bm"] = { name = "BufferLineMove" },
|
||||
["<leader>bs"] = { name = "BufferLineSort" },
|
||||
["<leader>bsi"] = { name = "BufferLineSortById" },
|
||||
|
||||
''
|
||||
else ""
|
||||
}
|
||||
|
@ -106,6 +104,7 @@ in {
|
|||
''
|
||||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
if config.vim.markdown.glow.enable
|
||||
then ''
|
||||
|
@ -114,6 +113,7 @@ in {
|
|||
''
|
||||
else ""
|
||||
}
|
||||
|
||||
})
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue