mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-05-08 16:35:07 +00:00
languages/odin: refactor lsp.servers to use lsp/presets/<name>
This commit is contained in:
parent
835d3db423
commit
00a372118a
1 changed files with 11 additions and 30 deletions
|
|
@ -7,34 +7,15 @@
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.types) enum package;
|
inherit (lib.types) enum package listOf;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib) genAttrs;
|
||||||
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
inherit (lib.generators) mkLuaInline;
|
|
||||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
|
||||||
|
|
||||||
cfg = config.vim.languages.odin;
|
cfg = config.vim.languages.odin;
|
||||||
|
|
||||||
defaultServers = ["ols"];
|
defaultServers = ["ols"];
|
||||||
servers = {
|
servers = ["ols"];
|
||||||
ols = {
|
|
||||||
enable = true;
|
|
||||||
cmd = [(getExe pkgs.ols)];
|
|
||||||
filetypes = ["odin"];
|
|
||||||
root_dir =
|
|
||||||
mkLuaInline
|
|
||||||
/*
|
|
||||||
lua
|
|
||||||
*/
|
|
||||||
''
|
|
||||||
function(bufnr, on_dir)
|
|
||||||
local fname = vim.api.nvim_buf_get_name(bufnr)
|
|
||||||
on_dir(util.root_pattern('ols.json', '.git', '*.odin')(fname))
|
|
||||||
end'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultDebugger = "codelldb";
|
defaultDebugger = "codelldb";
|
||||||
debuggers = {
|
debuggers = {
|
||||||
codelldb = {
|
codelldb = {
|
||||||
|
|
@ -71,7 +52,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
servers = mkOption {
|
servers = mkOption {
|
||||||
type = deprecatedSingleOrListOf "vim.language.odin.lsp.servers" (enum (attrNames servers));
|
type = listOf (enum servers);
|
||||||
default = defaultServers;
|
default = defaultServers;
|
||||||
description = "Odin LSP server to use";
|
description = "Odin LSP server to use";
|
||||||
};
|
};
|
||||||
|
|
@ -106,12 +87,12 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
vim.lsp.servers =
|
vim.lsp = {
|
||||||
mapListToAttrs (n: {
|
presets = genAttrs cfg.lsp.servers (_: {enable = true;});
|
||||||
name = n;
|
servers = genAttrs cfg.lsp.servers (_: {
|
||||||
value = servers.${n};
|
filetypes = ["odin"];
|
||||||
})
|
});
|
||||||
cfg.lsp.servers;
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.dap.enable {
|
(mkIf cfg.dap.enable {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue