|
|
@ -1,22 +1,19 @@
|
|
|
|
local lsp = require('lsp-zero')
|
|
|
|
local lsp = require('lsp-zero').preset({
|
|
|
|
|
|
|
|
name = 'minimal',
|
|
|
|
-- name = 'minimal',
|
|
|
|
set_lsp_keymaps = false,
|
|
|
|
-- set_lsp_keymaps = false,
|
|
|
|
manage_nvim_cmp = true,
|
|
|
|
-- manage_nvim_cmp = true,
|
|
|
|
suggest_lsp_servers = false,
|
|
|
|
-- suggest_lsp_servers = false,
|
|
|
|
})
|
|
|
|
--})
|
|
|
|
local lspconfig = require('lspconfig')
|
|
|
|
|
|
|
|
|
|
|
|
local keybindings = require('keybindings')
|
|
|
|
local keybindings = require('keybindings')
|
|
|
|
local on_attach = keybindings.on_attach
|
|
|
|
local on_attach = keybindings.on_attach
|
|
|
|
local cmp_mapping = keybindings.cmp_mappings
|
|
|
|
local cmp_mapping = keybindings.cmp_mappings
|
|
|
|
|
|
|
|
|
|
|
|
lsp.extend_lspconfig({
|
|
|
|
lsp.on_attach(on_attach)
|
|
|
|
lsp_attach = on_attach,
|
|
|
|
|
|
|
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local cmp = require('cmp')
|
|
|
|
local cmp = require('cmp')
|
|
|
|
local cmp_config = {
|
|
|
|
local cmp_config = lsp.defaults.cmp_config({
|
|
|
|
preselect = 'none',
|
|
|
|
preselect = 'none',
|
|
|
|
window = {
|
|
|
|
window = {
|
|
|
|
completion = cmp.config.window.bordered(),
|
|
|
|
completion = cmp.config.window.bordered(),
|
|
|
@ -30,27 +27,30 @@ local cmp_config = {
|
|
|
|
experimental = {
|
|
|
|
experimental = {
|
|
|
|
ghost_text = false -- conflicts with copilot.vim's preview
|
|
|
|
ghost_text = false -- conflicts with copilot.vim's preview
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
cmp.setup(cmp_config)
|
|
|
|
cmp.setup(cmp_config)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Configure lua language server for neovim
|
|
|
|
|
|
|
|
lsp.nvim_workspace()
|
|
|
|
|
|
|
|
|
|
|
|
lsp.configure('rust_analyzer', {
|
|
|
|
lsp.configure('rust_analyzer', {
|
|
|
|
settings = {
|
|
|
|
settings = {
|
|
|
|
["rust-analyzer"] = {
|
|
|
|
["rust-analyzer"] = {
|
|
|
|
|
|
|
|
cargo = {
|
|
|
|
|
|
|
|
features = "all",
|
|
|
|
|
|
|
|
},
|
|
|
|
procMacro = {
|
|
|
|
procMacro = {
|
|
|
|
enable = true,
|
|
|
|
enable = true,
|
|
|
|
ignored = {
|
|
|
|
|
|
|
|
leptos_macro = { "server" },
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
cargo = {
|
|
|
|
checkOnSave = {
|
|
|
|
allFeatures = true,
|
|
|
|
command = 'clippy',
|
|
|
|
|
|
|
|
extraArgs = { "--", "-W", "clippy::pedantic" }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
lsp.configure('ts_ls', {
|
|
|
|
lsp.configure('tsserver', {
|
|
|
|
-- set commands to run the language server using npx
|
|
|
|
|
|
|
|
cmd = { "npx", "typescript-language-server", "--stdio" },
|
|
|
|
cmd = { "npx", "typescript-language-server", "--stdio" },
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
@ -58,10 +58,22 @@ lsp.configure('html', {
|
|
|
|
cmd = { "npx", "vscode-html-language-server", "--stdio" },
|
|
|
|
cmd = { "npx", "vscode-html-language-server", "--stdio" },
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
lsp.configure('texlab', {
|
|
|
|
lspconfig.texlab.setup({
|
|
|
|
forwardSearch = {
|
|
|
|
settings = {
|
|
|
|
executable = 'zathura',
|
|
|
|
texlab = {
|
|
|
|
args = { '--synctex-forward', '%l:1:%f', '%p' }
|
|
|
|
auxDirectory = '.',
|
|
|
|
|
|
|
|
bibtexFormatter = 'texlab',
|
|
|
|
|
|
|
|
forwardSearch = {
|
|
|
|
|
|
|
|
executable = 'zathura',
|
|
|
|
|
|
|
|
args = { '--synctex-forward', '%l:1:%f', '%p' }
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
build = {
|
|
|
|
|
|
|
|
executable = "tectonic",
|
|
|
|
|
|
|
|
args = { '-X', 'compile', '%f', '--synctex', '--keep-logs', '--keep-intermediates' },
|
|
|
|
|
|
|
|
onSave = true,
|
|
|
|
|
|
|
|
forwardSearchAfter = true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
@ -69,51 +81,6 @@ lsp.configure('clangd', {})
|
|
|
|
|
|
|
|
|
|
|
|
lsp.configure('pylsp', {})
|
|
|
|
lsp.configure('pylsp', {})
|
|
|
|
|
|
|
|
|
|
|
|
-- From https://docs.astral.sh/ruff/editors/setup/#neovim
|
|
|
|
lsp.setup_servers({'tsserver', 'rust_analyzer', 'html', 'texlab', 'clangd', 'pylsp'})
|
|
|
|
lsp.configure('ruff', {
|
|
|
|
|
|
|
|
init_options = {
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
|
|
|
|
-- Ruff language server settings go here
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- CSS
|
|
|
|
|
|
|
|
lsp.configure('cssls', {
|
|
|
|
|
|
|
|
cmd = { "npx", "vscode-css-language-server", "--stdio" },
|
|
|
|
|
|
|
|
filetypes = { "css", "scss", "less" }
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Tailwind CSS
|
|
|
|
|
|
|
|
lsp.configure('tailwindcss', {
|
|
|
|
|
|
|
|
cmd = { "npx", "tailwindcss-language-server", "--stdio" },
|
|
|
|
|
|
|
|
filetypes = { "html", "css", "scss", "javascript", "javascriptreact", "typescript", "typescriptreact" },
|
|
|
|
|
|
|
|
init_options = {
|
|
|
|
|
|
|
|
userLanguages = {
|
|
|
|
|
|
|
|
eelixir = "html-eex",
|
|
|
|
|
|
|
|
eruby = "erb"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd("LspAttach", {
|
|
|
|
|
|
|
|
group = vim.api.nvim_create_augroup('lsp_attach_disable_ruff_hover', { clear = true }),
|
|
|
|
|
|
|
|
callback = function(args)
|
|
|
|
|
|
|
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
|
|
|
|
|
|
|
if client == nil then
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
if client.name == 'ruff' then
|
|
|
|
|
|
|
|
-- Disable hover in favor of Pyright
|
|
|
|
|
|
|
|
client.server_capabilities.hoverProvider = false
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
desc = 'LSP: Disable hover capability from Ruff',
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- gopls
|
|
|
|
|
|
|
|
lsp.configure('gopls', {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lsp.setup_servers({'rust_analyzer', 'html', 'texlab', 'clangd', 'pylsp', 'gopls', 'ts_ls', 'ruff'})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lsp.setup()
|
|
|
|
lsp.setup()
|
|
|
|