mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-02-04 02:45:53 +00:00
Merge branch 'main' into languages/fish
This commit is contained in:
commit
37e70a2155
7 changed files with 67 additions and 31 deletions
|
|
@ -13,7 +13,6 @@ trim_trailing_whitespace = true
|
|||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = false
|
||||
max_line_length = 80
|
||||
|
||||
[*.{js,json,nix,yml,yaml,toml}]
|
||||
indent_style = space
|
||||
|
|
|
|||
|
|
@ -132,7 +132,8 @@
|
|||
|
||||
- Added [sqruff](https://github.com/quarylabs/sqruff) support to `languages.sql`
|
||||
|
||||
- Added [Pyrefly](https://pyrefly.org/) support to `languages.python`
|
||||
- Added [Pyrefly](https://pyrefly.org/) and [zuban](https://zubanls.com/)
|
||||
support to `languages.python`
|
||||
|
||||
- Added TOML support via {option}`languages.toml` and the
|
||||
[Tombi](https://tombi-toml.github.io/tombi/) language server, linter, and
|
||||
|
|
@ -150,5 +151,12 @@
|
|||
[fish-lsp]: https://www.fish-lsp.dev/
|
||||
[fish_indent]: https://fishshell.com/docs/current/cmds/fish_indent.html
|
||||
|
||||
- Add Fish support via {option}`languages.fish` using [fish-lsp] and
|
||||
- Added Fish support via {option}`languages.fish` using [fish-lsp] and
|
||||
[fish_indent].
|
||||
|
||||
[Snoweuph](https://github.com/snoweuph)
|
||||
|
||||
- Added [Selenen](https://github.com/kampfkarren/selene) for more diagnostics in
|
||||
`languages.lua`.
|
||||
|
||||
<!-- vim: set textwidth=80: -->
|
||||
|
|
|
|||
|
|
@ -49,4 +49,4 @@ in
|
|||
"expToLua"
|
||||
"listToLuaTable"
|
||||
"attrsetToLuaTable"
|
||||
] (name: lib.warn "${name} is deprecated use toLuaObject instead" toLuaObject)
|
||||
] (name: builtins.throw "${name} is deprecated use toLuaObject instead")
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
|
|
@ -14,32 +15,43 @@
|
|||
|
||||
cfg = config.vim.languages.fish;
|
||||
|
||||
defaultServers = ["fish-lsp"];
|
||||
defaultServers = [ "fish-lsp" ];
|
||||
servers = {
|
||||
fish-lsp = {
|
||||
cmd = [(getExe pkgs.fish-lsp) "start"];
|
||||
filetypes = ["fish"];
|
||||
root_markers = ["config.fish" ".git"];
|
||||
cmd = [
|
||||
(getExe pkgs.fish-lsp)
|
||||
"start"
|
||||
];
|
||||
filetypes = [ "fish" ];
|
||||
root_markers = [
|
||||
"config.fish"
|
||||
".git"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
defaultFormat = ["fish_indent"];
|
||||
defaultFormat = [ "fish_indent" ];
|
||||
formats = {
|
||||
fish_indent = {
|
||||
package = pkgs.fish;
|
||||
config.command = "${cfg.format.package}/bin/fish_indent";
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.vim.languages.fish = {
|
||||
enable = mkEnableOption "Fish language support";
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Fish treesitter support" // {default = config.vim.languages.enableTreesitter;};
|
||||
enable = mkEnableOption "Fish treesitter support" // {
|
||||
default = config.vim.languages.enableTreesitter;
|
||||
};
|
||||
package = mkGrammarOption pkgs "fish";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Fish LSP support" // {default = config.vim.lsp.enable;};
|
||||
enable = mkEnableOption "Fish LSP support" // {
|
||||
default = config.vim.lsp.enable;
|
||||
};
|
||||
servers = mkOption {
|
||||
type = listOf (enum (attrNames servers));
|
||||
default = defaultServers;
|
||||
|
|
@ -48,7 +60,9 @@ in {
|
|||
};
|
||||
|
||||
format = {
|
||||
enable = mkEnableOption "Fish formatting" // {default = config.vim.languages.enableFormat;};
|
||||
enable = mkEnableOption "Fish formatting" // {
|
||||
default = config.vim.languages.enableFormat;
|
||||
};
|
||||
|
||||
type = mkOption {
|
||||
type = listOf (enum (attrNames formats));
|
||||
|
|
@ -68,29 +82,25 @@ in {
|
|||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter = {
|
||||
enable = true;
|
||||
grammars = [cfg.treesitter.package];
|
||||
grammars = [ cfg.treesitter.package ];
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.servers =
|
||||
mapListToAttrs (n: {
|
||||
name = n;
|
||||
value = servers.${n};
|
||||
})
|
||||
cfg.lsp.servers;
|
||||
vim.lsp.servers = mapListToAttrs (n: {
|
||||
name = n;
|
||||
value = servers.${n};
|
||||
}) cfg.lsp.servers;
|
||||
})
|
||||
|
||||
(mkIf (cfg.format.enable && !cfg.lsp.enable) {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.fish = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
setupOpts.formatters = mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
}) cfg.format.type;
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.types) bool enum listOf;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption deprecatedSingleOrListOf;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
|
|
@ -46,6 +46,9 @@
|
|||
luacheck = {
|
||||
package = pkgs.luajitPackages.luacheck;
|
||||
};
|
||||
selene = {
|
||||
package = pkgs.selene;
|
||||
};
|
||||
};
|
||||
in {
|
||||
imports = [
|
||||
|
|
@ -79,7 +82,7 @@ in {
|
|||
description = "Enable Lua formatting";
|
||||
};
|
||||
type = mkOption {
|
||||
type = deprecatedSingleOrListOf "vim.language.lua.format.type" (enum (attrNames formats));
|
||||
type = listOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "Lua formatter to use";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -169,6 +169,22 @@
|
|||
".git"
|
||||
];
|
||||
};
|
||||
|
||||
zuban = {
|
||||
enable = true;
|
||||
cmd = [(getExe pkgs.zuban) "server"];
|
||||
filetypes = ["python"];
|
||||
root_markers = [
|
||||
"pyproject.toml"
|
||||
"setup.py"
|
||||
"setup.cfg"
|
||||
"requirements.txt"
|
||||
"Pipfile"
|
||||
".git"
|
||||
"mypy.ini"
|
||||
".mypy.ini"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
defaultFormat = ["black"];
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
inherit (lib.lists) isList;
|
||||
inherit (lib.attrsets) attrNames;
|
||||
inherit (lib.types) bool package str listOf either enum int;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption deprecatedSingleOrListOf;
|
||||
inherit (lib.nvim.dag) entryAfter entryAnywhere;
|
||||
|
|
@ -169,7 +169,7 @@ in {
|
|||
server = {
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
then toLuaObject cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
||||
},
|
||||
default_settings = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue