mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +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";
|
||||
|
|
|
@ -11,19 +11,18 @@ in {
|
|||
vim.startPlugins = ["which-key"];
|
||||
|
||||
vim.luaConfigRC.whichkey = nvim.dag.entryAnywhere ''
|
||||
local wk = require("which-key")
|
||||
wk.setup {}
|
||||
local wk = require("which-key")
|
||||
wk.setup ({
|
||||
key_labels = {
|
||||
["<space>"] = "SPACE",
|
||||
["<leader>"] = "SPACE",
|
||||
["<cr>"] = "RETURN",
|
||||
["<tab>"] = "TAB",
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
wk.register({
|
||||
key_labels = {
|
||||
["<space>"] = "SPACE",
|
||||
["<leader>"] = "SPACE",
|
||||
["<cr>"] = "RETURN",
|
||||
["<tab>"] = "TAB",
|
||||
},
|
||||
|
||||
${
|
||||
wk.register({
|
||||
${
|
||||
if config.vim.tabline.nvimBufferline.enable
|
||||
then ''
|
||||
-- Buffer
|
||||
|
@ -31,12 +30,11 @@ in {
|
|||
["<leader>bm"] = { name = "BufferLineMove" },
|
||||
["<leader>bs"] = { name = "BufferLineSort" },
|
||||
["<leader>bsi"] = { name = "BufferLineSortById" },
|
||||
|
||||
''
|
||||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
${
|
||||
if config.vim.telescope.enable
|
||||
then ''
|
||||
["<leader>f"] = { name = "+Telescope" },
|
||||
|
@ -49,7 +47,7 @@ in {
|
|||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
${
|
||||
if config.vim.lsp.trouble.enable
|
||||
then ''
|
||||
-- Trouble
|
||||
|
@ -60,7 +58,7 @@ in {
|
|||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
${
|
||||
if config.vim.lsp.nvimCodeActionMenu.enable
|
||||
then ''
|
||||
-- Parent Groups
|
||||
|
@ -69,7 +67,7 @@ in {
|
|||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
${
|
||||
if config.vim.minimap.codewindow.enable || config.vim.minimap.minimap-vim.enable
|
||||
then ''
|
||||
-- Minimap
|
||||
|
@ -78,7 +76,7 @@ in {
|
|||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
${
|
||||
if config.vim.notes.mind-nvim.enable || config.vim.notes.obsidian.enable || config.vim.notes.orgmode.enable
|
||||
then ''
|
||||
-- Notes
|
||||
|
@ -89,7 +87,7 @@ in {
|
|||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
${
|
||||
if config.vim.filetree.nvimTreeLua.enable
|
||||
then ''
|
||||
-- NvimTree
|
||||
|
@ -98,7 +96,7 @@ in {
|
|||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
${
|
||||
if config.vim.git.gitsigns.enable
|
||||
then ''
|
||||
-- Git
|
||||
|
@ -106,7 +104,8 @@ in {
|
|||
''
|
||||
else ""
|
||||
}
|
||||
${
|
||||
|
||||
${
|
||||
if config.vim.markdown.glow.enable
|
||||
then ''
|
||||
-- Markdown
|
||||
|
@ -114,6 +113,7 @@ in {
|
|||
''
|
||||
else ""
|
||||
}
|
||||
|
||||
})
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue