update
This commit is contained in:
parent
f5daf0ad68
commit
0e500b7d8f
29 changed files with 687 additions and 694 deletions
61
lua/hsta/plugins/lsp.lua
Normal file
61
lua/hsta/plugins/lsp.lua
Normal file
|
@ -0,0 +1,61 @@
|
|||
return {
|
||||
-- Buffer format on save
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
config = function()
|
||||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
python = { "isort", "black" },
|
||||
rust = { "rustfmt", lsp_format = "fallback" },
|
||||
javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
cpp = { "clang-format" },
|
||||
},
|
||||
format_on_save = {
|
||||
-- These options will be passed to conform.format()
|
||||
timeout_ms = 500,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
-- Automatic LSP setup
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
tag = "v1.32.0",
|
||||
dependencies = { "williamboman/mason.nvim", "neovim/nvim-lspconfig" },
|
||||
lazy = false,
|
||||
keys = {
|
||||
{
|
||||
"ca",
|
||||
vim.lsp.buf.code_action,
|
||||
desc = "LSP: [C]ode Action",
|
||||
},
|
||||
{
|
||||
"<leader>rr",
|
||||
vim.lsp.buf.rename,
|
||||
desc = "LSP rename",
|
||||
},
|
||||
{
|
||||
"<leader>lh",
|
||||
vim.lsp.buf.hover,
|
||||
desc = "[L]sp: Hover",
|
||||
},
|
||||
},
|
||||
|
||||
config = function()
|
||||
require("mason").setup({})
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
automatic_installation = true,
|
||||
ensure_installed = { "lua_ls", "rust_analyzer", "clangd", "cmake" },
|
||||
})
|
||||
|
||||
require("mason-lspconfig").setup_handlers({
|
||||
function(server_name)
|
||||
require("lspconfig")[server_name].setup({})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue