mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-10 23:45:31 +00:00
Merge branch 'main' into main
This commit is contained in:
commit
17c478557c
44 changed files with 759 additions and 373 deletions
|
|
@ -53,24 +53,20 @@
|
|||
# TODO: specify packages
|
||||
defaultDiagnosticsProvider = ["eslint_d"];
|
||||
diagnosticsProviders = {
|
||||
eslint_d = {
|
||||
package = pkgs.eslint_d;
|
||||
eslint_d = let
|
||||
pkg = pkgs.eslint_d;
|
||||
in {
|
||||
package = pkg;
|
||||
config = {
|
||||
# HACK: change if nvim-lint gets a dynamic enable thing
|
||||
parser = mkLuaInline ''
|
||||
function(output, bufnr, cwd)
|
||||
local markers = { "eslint.config.js", "eslint.config.mjs",
|
||||
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
|
||||
for _, filename in ipairs(markers) do
|
||||
local path = vim.fs.joinpath(cwd, filename)
|
||||
if vim.loop.fs_stat(path) then
|
||||
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
|
||||
end
|
||||
end
|
||||
|
||||
return {}
|
||||
end
|
||||
'';
|
||||
cmd = getExe pkg;
|
||||
required_files = [
|
||||
"eslint.config.js"
|
||||
"eslint.config.mjs"
|
||||
".eslintrc"
|
||||
".eslintrc.json"
|
||||
".eslintrc.js"
|
||||
".eslintrc.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -153,16 +149,9 @@ in {
|
|||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.astro = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (
|
||||
name: {
|
||||
${name} =
|
||||
diagnosticsProviders.${name}.config
|
||||
// {
|
||||
cmd = getExe diagnosticsProviders.${name}.package;
|
||||
};
|
||||
}
|
||||
)
|
||||
cfg.extraDiagnostics.types);
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
|
||||
cfg = config.vim.languages.dart;
|
||||
ftcfg = cfg.flutter-tools;
|
||||
|
|
@ -81,16 +81,25 @@ in {
|
|||
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 {
|
||||
type = bool;
|
||||
default = true;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to 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.
|
||||
::: {.note}
|
||||
This is required if `flutterPackage` is set to null and the flutter
|
||||
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 {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
treesitter.enable = true;
|
||||
treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
lsp.lspconfig.enable = true;
|
||||
lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
|
||||
(mkIf ftcfg.enable {
|
||||
vim.startPlugins = [
|
||||
lsp.enable = true;
|
||||
|
||||
startPlugins = [
|
||||
(
|
||||
if ftcfg.enableNoResolvePatch
|
||||
then "flutter-tools-patched"
|
||||
|
|
@ -143,8 +154,9 @@ in {
|
|||
"plenary-nvim"
|
||||
];
|
||||
|
||||
vim.pluginRC.flutter-tools = entryAnywhere ''
|
||||
pluginRC.flutter-tools = entryAfter ["lsp-setup"] ''
|
||||
require('flutter-tools').setup {
|
||||
${optionalString (ftcfg.flutterPackage != null) "flutter_path = \"${ftcfg.flutterPackage}/bin/flutter\","}
|
||||
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
|
||||
|
|
@ -156,7 +168,6 @@ in {
|
|||
|
||||
capabilities = capabilities,
|
||||
on_attach = default_on_attach;
|
||||
flags = lsp_flags,
|
||||
},
|
||||
${optionalString cfg.dap.enable ''
|
||||
debugger = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
{lib, ...}: let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.nvim.languages) mkEnable;
|
||||
in {
|
||||
imports = [
|
||||
|
|
@ -48,7 +52,11 @@ in {
|
|||
];
|
||||
|
||||
options.vim.languages = {
|
||||
enableLSP = mkEnable "LSP";
|
||||
# LSPs are now built into Neovim, and we should enable them by default
|
||||
# if `vim.lsp.enable` is true.
|
||||
enableLSP = mkEnable "LSP" // {default = config.vim.lsp.enable;};
|
||||
|
||||
# Those are still managed by plugins, and should be enabled here.
|
||||
enableDAP = mkEnable "Debug Adapter";
|
||||
enableTreesitter = mkEnable "Treesitter";
|
||||
enableFormat = mkEnable "Formatting";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.lists) isList;
|
||||
|
|
@ -84,7 +84,14 @@ in {
|
|||
};
|
||||
|
||||
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 {
|
||||
description = "Go formatter to use";
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) bool enum either package listOf str;
|
||||
inherit (lib.types) bool enum either package listOf str nullOr;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
|
@ -117,7 +117,18 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "render-markdown" {};
|
||||
setupOpts = mkPluginSetupOption "render-markdown" {
|
||||
file_types = lib.mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
description = ''
|
||||
List of buffer filetypes to enable this plugin in.
|
||||
|
||||
This will cause the plugin to attach to new buffers who
|
||||
have any of these filetypes.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@
|
|||
# idk if this is the best way to install/run debugpy
|
||||
package = pkgs.python3.withPackages (ps: with ps; [debugpy]);
|
||||
dapConfig = ''
|
||||
dap.adapters.python = function(cb, config)
|
||||
dap.adapters.debugpy = function(cb, config)
|
||||
if config.request == 'attach' then
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local port = (config.connect or config).port
|
||||
|
|
@ -128,7 +128,7 @@
|
|||
dap.configurations.python = {
|
||||
{
|
||||
-- The first three options are required by nvim-dap
|
||||
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
|
||||
type = 'debugpy'; -- the type here established the link to the adapter definition: `dap.adapters.debugpy`
|
||||
request = 'launch';
|
||||
name = "Launch file";
|
||||
|
||||
|
|
|
|||
|
|
@ -55,21 +55,14 @@
|
|||
package = pkg;
|
||||
config = {
|
||||
cmd = getExe pkg;
|
||||
# HACK: change if nvim-lint gets a dynamic enable thing
|
||||
parser = mkLuaInline ''
|
||||
function(output, bufnr, cwd)
|
||||
local markers = { "eslint.config.js", "eslint.config.mjs",
|
||||
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
|
||||
for _, filename in ipairs(markers) do
|
||||
local path = vim.fs.joinpath(cwd, filename)
|
||||
if vim.loop.fs_stat(path) then
|
||||
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
|
||||
end
|
||||
end
|
||||
|
||||
return {}
|
||||
end
|
||||
'';
|
||||
required_files = [
|
||||
"eslint.config.js"
|
||||
"eslint.config.mjs"
|
||||
".eslintrc"
|
||||
".eslintrc.json"
|
||||
".eslintrc.js"
|
||||
".eslintrc.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -91,27 +91,20 @@
|
|||
# TODO: specify packages
|
||||
defaultDiagnosticsProvider = ["eslint_d"];
|
||||
diagnosticsProviders = {
|
||||
eslint_d = {
|
||||
package = pkgs.eslint_d;
|
||||
config = let
|
||||
pkg = pkgs.eslint_d;
|
||||
in {
|
||||
eslint_d = let
|
||||
pkg = pkgs.eslint_d;
|
||||
in {
|
||||
package = pkg;
|
||||
config = {
|
||||
cmd = getExe pkg;
|
||||
# HACK: change if nvim-lint gets a dynamic enable thing
|
||||
parser = mkLuaInline ''
|
||||
function(output, bufnr, cwd)
|
||||
local markers = { "eslint.config.js", "eslint.config.mjs",
|
||||
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
|
||||
for _, filename in ipairs(markers) do
|
||||
local path = vim.fs.joinpath(cwd, filename)
|
||||
if vim.loop.fs_stat(path) then
|
||||
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
|
||||
end
|
||||
end
|
||||
|
||||
return {}
|
||||
end
|
||||
'';
|
||||
required_files = [
|
||||
"eslint.config.js"
|
||||
"eslint.config.mjs"
|
||||
".eslintrc"
|
||||
".eslintrc.json"
|
||||
".eslintrc.js"
|
||||
".eslintrc.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -221,10 +214,9 @@ in {
|
|||
linters_by_ft.typescript = cfg.extraDiagnostics.types;
|
||||
linters_by_ft.typescriptreact = cfg.extraDiagnostics.types;
|
||||
|
||||
linters = mkMerge (map (name: {
|
||||
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue