lsp fixes

This commit is contained in:
Ivan Dimitrov 2023-07-15 18:27:18 +03:00
parent 89c239667a
commit 8c16d2cb6f
3 changed files with 23 additions and 13 deletions

View File

@ -1,3 +1,4 @@
-- START GLOBAL CONFIG
vim.wo.number = true -- show numbers vim.wo.number = true -- show numbers
vim.o.scrolloff = 15 -- scrll if n lines left vim.o.scrolloff = 15 -- scrll if n lines left
vim.o.hlsearch = false -- highlight search vim.o.hlsearch = false -- highlight search
@ -21,23 +22,31 @@ nmap("<leader>fw", require("telescope.builtin").live_grep)
nmap("<leader>e", vim.diagnostic.open_float) nmap("<leader>e", vim.diagnostic.open_float)
-- END GLOBAL CONFIG
-- START LSP -- START LSP
local cmp = require("cmp") local cmp = require("cmp")
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local servers = { local servers = {
tsserver = {}, tsserver = {
settings = {
completions = {
completeFunctionCalls = true
}
}
},
pylsp = {}, pylsp = {},
lua_ls = {}, lua_ls = {},
rnix = {}, rnix = {},
eslint = { gopls = {}
cmd = { "eslint", "--stdin", "--stdin-filename", "%:p" }
}
} }
local cmp_capabilities = require("cmp_nvim_lsp").default_capabilities() local cmp_capabilities = require("cmp_nvim_lsp").default_capabilities()
local on_attach = function(_, bufnr) local on_attach = function(client, bufnr)
nmap("<leader>ca", vim.lsp.buf.code_action) nmap("<leader>ca", vim.lsp.buf.code_action)
nmap('<leader>l', function() vim.lsp.buf.format() end) nmap("<leader>l", function()
vim.lsp.buf.format()
end)
nmap("K", vim.lsp.buf.hover) nmap("K", vim.lsp.buf.hover)
nmap("gr", require("telescope.builtin").lsp_references) nmap("gr", require("telescope.builtin").lsp_references)
end end
@ -56,8 +65,7 @@ cmp.setup({
for server, cfg in pairs(servers) do for server, cfg in pairs(servers) do
lspconfig[server].setup({ lspconfig[server].setup({
cmd = cfg.cmd, cfg,
settings = cfg.settings,
capabilities = cmp_capabilities, capabilities = cmp_capabilities,
on_attach = on_attach, on_attach = on_attach,
}) })

View File

@ -55,14 +55,15 @@
grim grim
home-manager home-manager
jmtpfs jmtpfs
jq
libgccjit libgccjit
libmtp libmtp
lolcat lolcat
mako mako
mlocate mlocate
mupdf mupdf
nodejs_20
nodePackages_latest.pnpm nodePackages_latest.pnpm
nodejs_20
pinentry-qt pinentry-qt
piper piper
rustup rustup

View File

@ -47,10 +47,11 @@
enable = true; enable = true;
viAlias = true; viAlias = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
nodePackages_latest.eslint go
nodePackages_latest.prettier gopls
nodePackages_latest.typescript nodePackages_latest.prettier
nodePackages_latest.typescript-language-server nodePackages_latest.typescript
nodePackages_latest.typescript-language-server
alejandra alejandra
libclang libclang
lua lua