my-nvim-config/laptop/plugin/lsp_config.lua

45 lines
1.1 KiB
Lua
Raw Normal View History

2024-03-13 14:07:20 -05:00
local lspconfig = require('lspconfig')
local map = vim.keymap.set
2024-05-17 15:12:24 -05:00
lspconfig.pyright.setup({
settings = {
python = {
analysis = {
typeCheckingMode = "off"
}
}
}
})
2024-03-23 03:27:49 -05:00
lspconfig.lua_ls.setup({
settings = {
Lua = {
telemetry = { enable = false },
},
}
})
2024-05-17 15:12:24 -05:00
lspconfig.ocamllsp.setup {}
-- Set ;k to hover and ;a to show code actions
vim.api.nvim_create_autocmd("LspAttach", {
2024-04-03 15:25:09 -05:00
callback = function()
map('n', '<localleader>k', vim.lsp.buf.hover, { remap = false })
map('n', '<localleader>a', vim.lsp.buf.code_action, { remap = false })
map('n', '<localleader>d', vim.diagnostic.open_float, { remap = false })
end,
})
-- Enable inlay hints (needs rework after nvim>=0.10)
vim.api.nvim_create_autocmd("LspAttach", {
pattern = "*.rs",
callback = function(args)
if not (args.data and args.data.client_id) then
return
end
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
require("lsp-inlayhints").on_attach(client, bufnr)
end,
})