Compare commits

..

9 commits

Author SHA1 Message Date
Howard Nguyen-Huu
ae901bb8cb
Merge branch 'main' into howird/python-dap-rename 2025-04-19 13:54:36 -04:00
Howard Nguyen-Huu
b67e151d22 docs: add changes to release notes 2025-04-19 13:53:15 -04:00
raf
afca477b39
Merge pull request #838 from Noah765/fix-flutter-tools
languages/dart: address hidden dependencies of flutter-tools.nvim
2025-04-19 14:49:42 +00:00
Noah765
5db21bae6f languages/dart: update flutter-tools.enableNoResolvePatch description 2025-04-19 15:51:47 +02:00
raf
33be3db04e
Merge pull request #842 from horriblename/no-gofmt
languages/go: default disable gofmt if lsp is enabled
2025-04-19 13:37:01 +00:00
Ching Pei Yang
b762752333
languages/go: default disable gofmt if lsp is enabled 2025-04-19 13:22:06 +02:00
Noah765
df0e2060c6 languages/dart: add flutter-tools.flutterPackage option
Previously, flutter-tools was dependent on the flutter SDK, which it found in the PATH. Having such undeclared and non-reproducible dependencies is against the principles of nix.
The flutterPackage option has been made optional for people who have installed the flutter SDK differently and want to keep it that way.
The enableNoResolvePatch option has been retained for people who have installed the flutter SDK using nix outside the scope of nvf and do not want to have to install it twice. The default value has been changed to false, assuming that most people who use nix to install flutter will use the flutterPackage option instead.
2025-04-18 17:05:57 +02:00
Noah765
99d600f40f languages/dart: remove invalid config key lsp.flags from flutter-tools.nvim setup
The lsp.flags key is not present in the documentation of flutter-tools.nvim and lsp_flags always evaluates to nil.
2025-04-18 15:51:03 +02:00
Noah765
ef3ab83254 languages/dart: add necessary dependency of flutter-tools.nvim on lsp 2025-04-18 15:49:11 +02:00
3 changed files with 43 additions and 17 deletions

View file

@ -290,8 +290,10 @@
- `eslint_d` now checks for configuration files to load. - `eslint_d` now checks for configuration files to load.
- Fix an error where `eslint_d` fails to load. - Fix an error where `eslint_d` fails to load.
- Add required files support for linters under `vim.diagnostics.nvim-lint.linters.*.required_files`. - Add required files support for linters under
- Add global function `nvf_lint` under `vim.diagnostics.nvim-lint.lint_function`. `vim.diagnostics.nvim-lint.linters.*.required_files`.
- Add global function `nvf_lint` under
`vim.diagnostics.nvim-lint.lint_function`.
[Sc3l3t0n](https://github.com/Sc3l3t0n): [Sc3l3t0n](https://github.com/Sc3l3t0n):
@ -334,3 +336,9 @@
[Noah765](https://github.com/Noah765): [Noah765](https://github.com/Noah765):
- Add missing `flutter-tools.nvim` dependency `plenary.nvim`. - Add missing `flutter-tools.nvim` dependency `plenary.nvim`.
- Add necessary dependency of `flutter-tools.nvim` on lsp.
- Add the `vim.languages.dart.flutter-tools.flutterPackage` option.
[howird](https://github.com/howird):
- Change python dap adapter name from `python` to commonly expected `debugpy`.

View file

@ -13,7 +13,7 @@
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.nvim.lua) expToLua; inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.types) mkGrammarOption; inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAfter;
cfg = config.vim.languages.dart; cfg = config.vim.languages.dart;
ftcfg = cfg.flutter-tools; ftcfg = cfg.flutter-tools;
@ -81,16 +81,25 @@ in {
description = "Enable flutter-tools for flutter support"; description = "Enable flutter-tools for flutter support";
}; };
flutterPackage = mkOption {
type = nullOr package;
default = pkgs.flutter;
description = "Flutter package, or null to detect the flutter path at runtime instead.";
};
enableNoResolvePatch = mkOption { enableNoResolvePatch = mkOption {
type = bool; type = bool;
default = true; default = false;
description = '' description = ''
Whether to patch flutter-tools so that it doesn't resolve Whether to patch flutter-tools so that it doesn't resolve
symlinks when detecting flutter path. symlinks when detecting flutter path.
This is required if you want to use a flutter package built with nix. ::: {.note}
If you are using a flutter SDK installed from a different source This is required if `flutterPackage` is set to null and the flutter
and encounter the error "`dart` missing from PATH", disable this option. package in your `PATH` was built with Nix. If you are using a flutter
SDK installed from a different source and encounter the error "`dart`
missing from `PATH`", leave this option disabled.
:::
''; '';
}; };
@ -122,19 +131,21 @@ in {
}; };
}; };
config = mkIf cfg.enable (mkMerge [ config.vim = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable { (mkIf cfg.treesitter.enable {
vim.treesitter.enable = true; treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package]; treesitter.grammars = [cfg.treesitter.package];
}) })
(mkIf cfg.lsp.enable { (mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true; lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig; lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
}) })
(mkIf ftcfg.enable { (mkIf ftcfg.enable {
vim.startPlugins = [ lsp.enable = true;
startPlugins = [
( (
if ftcfg.enableNoResolvePatch if ftcfg.enableNoResolvePatch
then "flutter-tools-patched" then "flutter-tools-patched"
@ -143,8 +154,9 @@ in {
"plenary-nvim" "plenary-nvim"
]; ];
vim.pluginRC.flutter-tools = entryAnywhere '' pluginRC.flutter-tools = entryAfter ["lsp-setup"] ''
require('flutter-tools').setup { require('flutter-tools').setup {
${optionalString (ftcfg.flutterPackage != null) "flutter_path = \"${ftcfg.flutterPackage}/bin/flutter\","}
lsp = { lsp = {
color = { -- show the derived colours for dart variables 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 enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
@ -156,7 +168,6 @@ in {
capabilities = capabilities, capabilities = capabilities,
on_attach = default_on_attach; on_attach = default_on_attach;
flags = lsp_flags,
}, },
${optionalString cfg.dap.enable '' ${optionalString cfg.dap.enable ''
debugger = { debugger = {

View file

@ -5,7 +5,7 @@
... ...
}: let }: let
inherit (builtins) attrNames; inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption; inherit (lib.options) mkEnableOption mkOption literalMD;
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.meta) getExe; inherit (lib.meta) getExe;
inherit (lib.lists) isList; inherit (lib.lists) isList;
@ -84,7 +84,14 @@ in {
}; };
format = { format = {
enable = mkEnableOption "Go formatting" // {default = config.vim.languages.enableFormat;}; enable =
mkEnableOption "Go formatting"
// {
default = !cfg.lsp.enable && config.vim.languages.enableFormat;
defaultText = literalMD ''
disabled if Go LSP is enabled, otherwise follows {option}`vim.languages.enableFormat`
'';
};
type = mkOption { type = mkOption {
description = "Go formatter to use"; description = "Go formatter to use";