fix(flutter-tools): bug where dart lsp is not found

This commit is contained in:
Ching Pei Yang 2023-06-25 14:09:12 +02:00
commit b4eaabea95
5 changed files with 70 additions and 9 deletions

View file

@ -25,13 +25,13 @@ inputs: {
// extraSpecialArgs;
};
buildPlug = name:
buildVimPluginFrom2Nix rec {
pname = name;
version = "master";
src = assert lib.asserts.assertMsg (name != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter.";
getAttr pname inputs;
};
buildPlug = {pname, ...} @ args:
assert lib.asserts.assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter.";
buildVimPluginFrom2Nix (args
// {
version = "master";
src = getAttr pname inputs;
});
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
@ -45,7 +45,13 @@ inputs: {
(
if (plug == "nvim-treesitter")
then (buildTreesitterPlug vimOptions.treesitter.grammars)
else (buildPlug plug)
else if (plug == "flutter-tools-patched")
then
(buildPlug {
pname = "flutter-tools";
patches = [../patches/flutter-tools.patch];
})
else (buildPlug {pname = plug;})
)
else plug
))

View file

@ -35,7 +35,10 @@ in {
})
(mkIf (ftcfg.enable) {
vim.startPlugins = ["flutter-tools"];
vim.startPlugins =
if ftcfg.enableNoResolvePatch
then ["flutter-tools-patched"]
else ["flutter-tools"];
vim.luaConfigRC.flutter-tools = nvim.dag.entryAnywhere ''
require('flutter-tools').setup {

View file

@ -56,6 +56,16 @@ in {
default = config.vim.languages.enableLSP;
};
enableNoResolvePatch = mkOption {
description = ''
Patch flutter-tools so that it doesn't resolve symlinks when detecting flutter path.
This is required if you want to use a flutter package built with nix.
If you are using a flutter SDK installed from a different source and encounter the error "`dart` missing from PATH", disable this option.
'';
type = types.bool;
default = true;
};
color = {
enable = mkEnableOption "Whether or mot to highlight color variables at all";