pkgsets/nvim: update lsp config to use opts
This commit is contained in:
parent
d8f29e12b5
commit
378da9479f
17 changed files with 355 additions and 339 deletions
|
@ -7,131 +7,117 @@
|
||||||
}@inputs:
|
}@inputs:
|
||||||
|
|
||||||
lib.mkIf (lib.elem "nvim::lsp" config.machine.pkgs) {
|
lib.mkIf (lib.elem "nvim::lsp" config.machine.pkgs) {
|
||||||
programs.nvim-lazy.lazyPlugins =
|
programs.nvim-lazy.lazyPlugins = [
|
||||||
let
|
# Yaml schema store for yamlls
|
||||||
lspServers = lib.concatStrings (
|
{
|
||||||
map (path: import "${path}" (inputs // { inherit pkgs; })) (
|
lazy = true;
|
||||||
fn.lst {
|
dir = vPlug: vPlug.SchemaStore-nvim;
|
||||||
path = ((toString ./.) + "/lsp");
|
}
|
||||||
fullPath = true;
|
|
||||||
}
|
# {
|
||||||
)
|
# dir = vPlug: vPlug.cmp-nvim-lsp;
|
||||||
|
# lazy = true;
|
||||||
|
# }
|
||||||
|
|
||||||
|
{
|
||||||
|
dir = vPlug: vPlug.nvim-lspconfig;
|
||||||
|
cmd = [ "LspInfo" ];
|
||||||
|
event = [
|
||||||
|
"BufReadPre"
|
||||||
|
"BufNewFile"
|
||||||
|
];
|
||||||
|
dependencies = (
|
||||||
|
vPlug: with vPlug; [
|
||||||
|
# cmp-nvim-lsp
|
||||||
|
blink-cmp
|
||||||
|
SchemaStore-nvim
|
||||||
|
# coq_nvim
|
||||||
|
]
|
||||||
);
|
);
|
||||||
in
|
init = # lua
|
||||||
[
|
''
|
||||||
# Yaml schema store for yamlls
|
function()
|
||||||
{
|
-- Reserve a space in the gutter
|
||||||
lazy = true;
|
-- This will avoid an annoying layout shift in the screen
|
||||||
dir = vPlug: vPlug.SchemaStore-nvim;
|
vim.opt.signcolumn = 'yes'
|
||||||
}
|
|
||||||
|
|
||||||
{
|
---Force a specific language for ltex-ls
|
||||||
dir = vPlug: vPlug.cmp-nvim-lsp;
|
---@param lang string
|
||||||
lazy = true;
|
function SetLtexLang(lang)
|
||||||
}
|
local clients = vim.lsp.get_clients({ buffer = 0 })
|
||||||
|
|
||||||
{
|
for _, client in ipairs(clients) do
|
||||||
dir = vPlug: vPlug.nvim-lspconfig;
|
if client.name == "ltex" then
|
||||||
cmd = [ "LspInfo" ];
|
vim.api.nvim_notify("Set ltex-ls lang to " .. lang, vim.log.levels.INFO, { title = "LTex Language", timeout = 2000, })
|
||||||
event = [
|
client.config.settings.ltex.language = lang
|
||||||
"BufReadPre"
|
vim.lsp.buf_notify(0, "workspace/didChangeConfiguration", { settings = client.config.settings })
|
||||||
"BufNewFile"
|
return
|
||||||
];
|
|
||||||
dependencies = (
|
|
||||||
vPlug: with vPlug; [
|
|
||||||
cmp-nvim-lsp
|
|
||||||
SchemaStore-nvim
|
|
||||||
# coq_nvim
|
|
||||||
]
|
|
||||||
);
|
|
||||||
init = # lua
|
|
||||||
''
|
|
||||||
function()
|
|
||||||
-- Reserve a space in the gutter
|
|
||||||
-- This will avoid an annoying layout shift in the screen
|
|
||||||
vim.opt.signcolumn = 'yes'
|
|
||||||
|
|
||||||
---Force a specific language for ltex-ls
|
|
||||||
---@param lang string
|
|
||||||
function SetLtexLang(lang)
|
|
||||||
local clients = vim.lsp.get_clients({ buffer = 0 })
|
|
||||||
|
|
||||||
for _, client in ipairs(clients) do
|
|
||||||
if client.name == "ltex" then
|
|
||||||
vim.api.nvim_notify("Set ltex-ls lang to " .. lang, vim.log.levels.INFO, { title = "LTex Language", timeout = 2000, })
|
|
||||||
client.config.settings.ltex.language = lang
|
|
||||||
vim.lsp.buf_notify(0, "workspace/didChangeConfiguration", { settings = client.config.settings })
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
'';
|
end
|
||||||
config = # lua
|
'';
|
||||||
''
|
|
||||||
function()
|
|
||||||
local lsp_defaults = require('lspconfig').util.default_config
|
|
||||||
|
|
||||||
-- Add cmp_nvim_lsp capabilities settings to lspconfig
|
opts = {
|
||||||
-- This should be executed before you configure any language server
|
inlay_hints = {
|
||||||
lsp_defaults.capabilities = vim.tbl_deep_extend(
|
enabled = true;
|
||||||
'force',
|
|
||||||
lsp_defaults.capabilities,
|
|
||||||
require('cmp_nvim_lsp').default_capabilities()
|
|
||||||
)
|
|
||||||
|
|
||||||
-- LspAttach is where you enable features that only work
|
|
||||||
-- if there is a language server active in the file
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
|
||||||
desc = 'LSP actions',
|
|
||||||
callback = function(event)
|
|
||||||
local opts = {buffer = event.buf}
|
|
||||||
|
|
||||||
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
|
|
||||||
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
|
|
||||||
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
|
|
||||||
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
|
|
||||||
vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
|
|
||||||
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
|
|
||||||
vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
|
|
||||||
vim.keymap.set('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
|
|
||||||
vim.keymap.set({'n', 'x'}, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
|
|
||||||
vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- (Optional) Configure lua language server for neovim
|
|
||||||
local lspconfig = require('lspconfig')
|
|
||||||
${lspServers}
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
opts = {
|
|
||||||
inlay_hints = {
|
|
||||||
enabled = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
servers = lib.foldl (l: r: l // r) { } (
|
||||||
# {
|
lib.map (path: import "${path}" (inputs // { inherit pkgs; })) (
|
||||||
# dir = vPlug: vPlug.lspsaga-nvim;
|
fn.lst {
|
||||||
# config = /* lua */ ''
|
path = ((toString ./.) + "/lsp");
|
||||||
# function()
|
fullPath = true;
|
||||||
# require('lspsaga').setup({
|
}
|
||||||
# ui = {
|
)
|
||||||
# code_action = "",
|
);
|
||||||
# },
|
};
|
||||||
# lightbulb = {
|
|
||||||
# enable = true,
|
config = # lua
|
||||||
# enable_in_insert = false,
|
''
|
||||||
# virtual_text = false,
|
function(_, opts)
|
||||||
# },
|
local lsp_defaults = require('lspconfig').util.default_config
|
||||||
# })
|
|
||||||
# end
|
-- Add cmp_nvim_lsp capabilities settings to lspconfig
|
||||||
# '';
|
-- This should be executed before you configure any language server
|
||||||
# dependencies = [ "nvim-treesitter" "nvim-web-devicons" ];
|
-- lsp_defaults.capabilities = vim.tbl_deep_extend(
|
||||||
# }
|
-- 'force',
|
||||||
# {
|
-- lsp_defaults.capabilities
|
||||||
# lazy = true;
|
-- require('cmp_nvim_lsp').default_capabilities()
|
||||||
# dir = vPlug: vPlug.nvim-web-devicons;
|
-- )
|
||||||
# }
|
|
||||||
];
|
-- LspAttach is where you enable features that only work
|
||||||
|
-- if there is a language server active in the file
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
desc = 'LSP actions',
|
||||||
|
callback = function(event)
|
||||||
|
local opts = {buffer = event.buf}
|
||||||
|
|
||||||
|
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
|
||||||
|
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
|
||||||
|
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
|
||||||
|
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
|
||||||
|
vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
|
||||||
|
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
|
||||||
|
vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
|
||||||
|
vim.keymap.set('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
|
||||||
|
vim.keymap.set({'n', 'x'}, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
|
||||||
|
vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
for server, config in pairs(opts.servers) do
|
||||||
|
${lib.optionalString (lib.elem "nvim::blink" config.machine.pkgs) # lua
|
||||||
|
''
|
||||||
|
-- passing config.capabilities to blink.cmp merges with the capabilities in your
|
||||||
|
-- `opts[server].capabilities, if you've defined it
|
||||||
|
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
|
||||||
|
''
|
||||||
|
}
|
||||||
|
lspconfig[server].setup(config)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,12 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::bash" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::bash" config.machine.pkgs) {
|
||||||
''
|
bashls = {
|
||||||
lspconfig.bashls.setup({
|
cmd = [
|
||||||
cmd = {"${pkgs.nodePackages.bash-language-server}/bin/bash-language-server", "start"},
|
"${pkgs.nodePackages.bash-language-server}/bin/bash-language-server"
|
||||||
filetypes = {"sh"},
|
"start"
|
||||||
})
|
];
|
||||||
''
|
filetypes = [ "sh" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -5,18 +5,17 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::c" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::c" config.machine.pkgs) {
|
||||||
''
|
ccls = {
|
||||||
lspconfig.ccls.setup {
|
cmd = [ "${pkgs.ccls}/bin/ccls" ];
|
||||||
cmd = { "${pkgs.ccls}/bin/ccls" },
|
init_options = {
|
||||||
init_options = {
|
# compilationDatabaseDirectory = "build";
|
||||||
compilationDatabaseDirectory = "build";
|
index = {
|
||||||
index = {
|
threads = 0;
|
||||||
threads = 0;
|
};
|
||||||
};
|
clang = {
|
||||||
clang = {
|
excludeArgs = [ "-frounding-math" ];
|
||||||
excludeArgs = { "-frounding-math"} ;
|
};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
''
|
|
||||||
|
|
|
@ -5,9 +5,11 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::emmet" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::emmet" config.machine.pkgs) {
|
||||||
''
|
emmet_language_server = {
|
||||||
lspconfig.emmet_language_server.setup({
|
cmd = [
|
||||||
cmd = {"${pkgs.emmet-language-server}/bin/emmet-language-server", "--stdio"}
|
"${pkgs.emmet-language-server}/bin/emmet-language-server"
|
||||||
})
|
"--stdio"
|
||||||
''
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::go" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::go" config.machine.pkgs) {
|
||||||
''
|
gopls = {
|
||||||
lspconfig.gopls.setup({
|
cmd = [ "${pkgs.gopls}/bin/gopls" ];
|
||||||
cmd = {"${pkgs.gopls}/bin/gopls"}
|
};
|
||||||
})
|
}
|
||||||
''
|
|
||||||
|
|
|
@ -5,9 +5,11 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::harper" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::harper" config.machine.pkgs) {
|
||||||
''
|
harper_ls = {
|
||||||
lspconfig.harper_ls.setup({
|
cmd = [
|
||||||
cmd = { "${pkgs.harper}/bin/harper-ls", "--stdio" },
|
"${pkgs.harper}/bin/harper-ls"
|
||||||
})
|
"--stdio"
|
||||||
''
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::html" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::html" config.machine.pkgs) {
|
||||||
''
|
# local html_capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
local html_capabilities = vim.lsp.protocol.make_client_capabilities()
|
# html_capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
html_capabilities.textDocument.completion.completionItem.snippetSupport = true
|
html = {
|
||||||
lspconfig.html.setup({
|
capabilities = _: "vim.lsp.protocol.make_client_capabilities()";
|
||||||
capabilities = html_capabilities,
|
cmd = [ "${pkgs.vscode-langservers-extracted}/bin/vscode-html-language-server" ];
|
||||||
cmd = {"${pkgs.vscode-langservers-extracted}/bin/vscode-html-language-server"}
|
};
|
||||||
})
|
}
|
||||||
''
|
|
||||||
|
|
|
@ -5,20 +5,23 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::ltex" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::ltex" config.machine.pkgs) {
|
||||||
''
|
ltex = {
|
||||||
lspconfig.ltex.setup({
|
cmd = [ "${pkgs.ltex-ls}/bin/ltex-ls" ];
|
||||||
cmd = { "${pkgs.ltex-ls}/bin/ltex-ls" },
|
settings = {
|
||||||
settings = {
|
ltex = {
|
||||||
ltex = {
|
language = "de-DE";
|
||||||
language = "de-DE",
|
};
|
||||||
},
|
};
|
||||||
},
|
on_attach =
|
||||||
})
|
_: # lua
|
||||||
|
''
|
||||||
vim.api.nvim_create_user_command(
|
function(client, bufnr)
|
||||||
"LtexLang",
|
vim.api.nvim_create_user_command(
|
||||||
"lua SetLtexLang(<q-args>)",
|
"LtexLang",
|
||||||
{ nargs = 1, desc = "Set ltex-ls language" }
|
"lua SetLtexLang(<q-args>)",
|
||||||
)
|
{ nargs = 1, desc = "Set ltex-ls language" }
|
||||||
''
|
)
|
||||||
|
end'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -5,22 +5,21 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::lua" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::lua" config.machine.pkgs) {
|
||||||
''
|
lua_ls = {
|
||||||
lspconfig.lua_ls.setup({
|
cmd = [ "${pkgs.lua-language-server}/bin/lua-language-server" ];
|
||||||
cmd = {"${pkgs.lua-language-server}/bin/lua-language-server"},
|
settings = {
|
||||||
settings = {
|
Lua = {
|
||||||
Lua = {
|
runtime = {
|
||||||
runtime = {
|
version = "LuaJIT";
|
||||||
version = 'LuaJIT'
|
};
|
||||||
},
|
workspace = {
|
||||||
workspace = {
|
checkThirdParty = false;
|
||||||
checkThirdParty = false,
|
library = [
|
||||||
library = {
|
(_: "vim.env.VIMRUNTIME")
|
||||||
vim.env.VIMRUNTIME
|
];
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
})
|
}
|
||||||
''
|
|
||||||
|
|
|
@ -5,9 +5,11 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::markdown" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::markdown" config.machine.pkgs) {
|
||||||
''
|
marksman = {
|
||||||
lspconfig.marksman.setup {
|
cmd = [
|
||||||
cmd = { "${pkgs.marksman}/bin/marksman", "server" },
|
"${pkgs.marksman}/bin/marksman"
|
||||||
}
|
"server"
|
||||||
''
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -5,22 +5,21 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::nix-nil" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::nix-nil" config.machine.pkgs) {
|
||||||
''
|
nil_ls = {
|
||||||
lspconfig.nil_ls.setup({
|
cmd = [ "${pkgs.nil}/bin/nil" ];
|
||||||
cmd = {"${pkgs.nil}/bin/nil"},
|
settings = {
|
||||||
settings = {
|
"['nil']" = {
|
||||||
['nil'] = {
|
formatting = {
|
||||||
formatting = {
|
command = [ "${pkgs.nixfmt-rfc-style}/bin/nixfmt" ];
|
||||||
command = { "${pkgs.nixfmt-rfc-style}/bin/nixfmt" }
|
};
|
||||||
},
|
maxMemoryMB = 4069;
|
||||||
maxMemoryMB = 4069,
|
# nix = {
|
||||||
-- nix = {
|
# flake = {
|
||||||
-- flake = {
|
# autoEvalInputs = true;
|
||||||
-- autoEvalInputs = true
|
# };
|
||||||
-- }
|
# };
|
||||||
-- }
|
};
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
})
|
}
|
||||||
''
|
|
||||||
|
|
|
@ -5,38 +5,42 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::nix-nixd" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::nix-nixd" config.machine.pkgs) {
|
||||||
''
|
nixd = {
|
||||||
lspconfig.nixd.setup({
|
cmd = [ "${pkgs.nixd}/bin/nixd" ];
|
||||||
cmd = { "${pkgs.nixd}/bin/nixd" },
|
settings = {
|
||||||
settings = {
|
nixd = {
|
||||||
nixd = {
|
on_init =
|
||||||
-- on_init = function(client)
|
_: # lua
|
||||||
-- local path = client.workspace_folders[1].name
|
''
|
||||||
|
function(client)
|
||||||
|
local path = client.workspace_folders[1].name
|
||||||
|
|
||||||
-- if path == '/path/to/project1' then
|
if path == '/path/to/project1' then
|
||||||
-- client.config.settings["rust-analyzer"].checkOnSave.overrideCommand = { "cargo", "check" }
|
client.config.settings["rust-analyzer"].checkOnSave.overrideCommand = { "cargo", "check" }
|
||||||
-- client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
|
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
|
||||||
-- end
|
end
|
||||||
|
|
||||||
-- return true
|
return true
|
||||||
-- end,
|
end
|
||||||
nixpkgs = {
|
'';
|
||||||
expr = 'import (builtins.getFlake ("git+file:///etc/nixos")).inputs.nixpkgs {}',
|
nixpkgs = {
|
||||||
},
|
expr = ''import (builtins.getFlake ("git+file:///etc/nixos")).inputs.nixpkgs {}'';
|
||||||
formatting = {
|
};
|
||||||
command = { "${pkgs.nixfmt-rfc-style}/bin/nixfmt" },
|
formatting = {
|
||||||
},
|
command = [ "${pkgs.nixfmt-rfc-style}/bin/nixfmt" ];
|
||||||
options = {
|
};
|
||||||
nixos = {
|
options = {
|
||||||
expr = '(builtins.getFlake ("git+file:///etc/nixos")).outputs.nixosConfigurations.Lilim.options',
|
nixos = {
|
||||||
},
|
expr = ''(builtins.getFlake ("git+file:///etc/nixos")).outputs.nixosConfigurations.Lilim.options'';
|
||||||
-- TODO: Find a good general expression for this.
|
};
|
||||||
-- home_manager = {
|
# TODO: Find a good general expression for this.
|
||||||
-- expr = '(builtins.getFlake ("git+file://" + toString ./.)).homeConfigurations."ruixi@k-on".options',
|
# home_manager = {
|
||||||
-- },
|
# expr =
|
||||||
},
|
# "'(builtins.getFlake (\"git+file://\" + toString ./.)).homeConfigurations.\"ruixi@k-on\".options'";
|
||||||
},
|
# };
|
||||||
},
|
};
|
||||||
})
|
};
|
||||||
''
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -5,15 +5,17 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::php" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::php" config.machine.pkgs) {
|
||||||
''
|
phpactor = {
|
||||||
lspconfig.phpactor.setup({
|
cmd = [
|
||||||
cmd = {"${pkgs.phpactor}/bin/phpactor", "language-server"},
|
"${pkgs.phpactor}/bin/phpactor"
|
||||||
init_options = {
|
"language-server"
|
||||||
["symfony.enabled"] = true,
|
];
|
||||||
["language_server_phpstan.enabled"] = true,
|
init_options = {
|
||||||
["language_server_phpstan.bin"] = "${pkgs.phpPackages.phpstan}/bin/phpstan",
|
"[\"symfony.enabled\"]" = true;
|
||||||
["language_server_phpstan.level"] = 5,
|
"[\"language_server_phpstan.enabled\"]" = true;
|
||||||
},
|
"[\"language_server_phpstan.bin\"]" = "${pkgs.phpPackages.phpstan}/bin/phpstan";
|
||||||
})
|
"[\"language_server_phpstan.level\"]" = 5;
|
||||||
''
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -5,40 +5,50 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::python" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::python" config.machine.pkgs) {
|
||||||
''
|
pyright = {
|
||||||
lspconfig.pyright.setup({
|
cmd = [
|
||||||
cmd = {"${pkgs.pyright}/bin/pyright-langserver", "--stdio"},
|
"${pkgs.pyright}/bin/pyright-langserver"
|
||||||
|
"--stdio"
|
||||||
|
];
|
||||||
|
settings = {
|
||||||
|
pyright = {
|
||||||
|
disableOrganizeImports = true;
|
||||||
|
};
|
||||||
|
python = {
|
||||||
|
# analysis = {
|
||||||
|
# ignore = { '*' },
|
||||||
|
# },
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
ruff = {
|
||||||
|
cmd = [
|
||||||
|
"${pkgs.ruff}/bin/ruff"
|
||||||
|
"server"
|
||||||
|
"--preview"
|
||||||
|
];
|
||||||
|
init_options = {
|
||||||
settings = {
|
settings = {
|
||||||
pyright = {
|
# Modification to any of these settings has no effect.
|
||||||
disableOrganizeImports = true,
|
enable = true;
|
||||||
},
|
ignoreStandardLibrary = true;
|
||||||
python = {
|
organizeImports = true;
|
||||||
-- analysis = {
|
fixAll = true;
|
||||||
-- ignore = { '*' },
|
lineLength = 120;
|
||||||
-- },
|
lint = {
|
||||||
},
|
enable = true;
|
||||||
},
|
run = "onType";
|
||||||
})
|
};
|
||||||
lspconfig.ruff.setup({
|
};
|
||||||
cmd = {"${pkgs.ruff}/bin/ruff", "server", "--preview"},
|
};
|
||||||
init_options = {
|
on_attach =
|
||||||
settings = {
|
_: # lua
|
||||||
-- Modification to any of these settings has no effect.
|
''
|
||||||
enable = true,
|
function(client, bufnr)
|
||||||
ignoreStandardLibrary = true,
|
if client.name == 'ruff' then
|
||||||
organizeImports = true,
|
client.server_capabilities.hoverProvider = false;
|
||||||
fixAll = true,
|
end
|
||||||
lint = {
|
end'';
|
||||||
enable = true,
|
};
|
||||||
run = 'onType',
|
}
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
if client.name == 'ruff' then
|
|
||||||
client.server_capabilities.hoverProvider = false;
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
''
|
|
||||||
|
|
|
@ -5,9 +5,13 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::rust" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::rust" config.machine.pkgs) {
|
||||||
''
|
rust_analyzer = {
|
||||||
lspconfig.rust_analyzer.setup({
|
cmd = [
|
||||||
cmd = {"${pkgs.rustup}/bin/rustup", "run", "nightly", "rust-analyzer"}
|
"${pkgs.rustup}/bin/rustup"
|
||||||
})
|
"run"
|
||||||
''
|
"nightly"
|
||||||
|
"rust-analyzer"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -5,9 +5,11 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::typescript" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::typescript" config.machine.pkgs) {
|
||||||
''
|
ts_ls = {
|
||||||
lspconfig.ts_ls.setup({
|
cmd = [
|
||||||
cmd = {"${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server", "--stdio"}
|
"${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server"
|
||||||
})
|
"--stdio"
|
||||||
''
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -5,20 +5,22 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.optionalString (lib.elem "nvim::lsp::yaml" config.machine.pkgs) # lua
|
lib.optionalAttrs (lib.elem "nvim::lsp::yaml" config.machine.pkgs) {
|
||||||
''
|
yamlls = {
|
||||||
lspconfig.yamlls.setup({
|
cmd = [
|
||||||
cmd = { "${pkgs.yaml-language-server}/bin/yaml-language-server", "--stdio" },
|
"${pkgs.yaml-language-server}/bin/yaml-language-server"
|
||||||
settings = {
|
"--stdio"
|
||||||
yaml = {
|
];
|
||||||
schemaStore = {
|
settings = {
|
||||||
-- Disable to use Store from SchemaStore-nvim plugin
|
yaml = {
|
||||||
enable = false,
|
schemaStore = {
|
||||||
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
|
# Disable to use Store from SchemaStore-nvim plugin
|
||||||
url = "",
|
enable = false;
|
||||||
},
|
# Avoid TypeError: Cannot read properties of undefined (reading 'length')
|
||||||
schemas = require('schemastore').yaml.schemas(),
|
url = "";
|
||||||
},
|
};
|
||||||
},
|
schemas = _: "require('schemastore').yaml.schemas()";
|
||||||
})
|
};
|
||||||
''
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue