mirror of
https://github.com/He4eT/dotfiles.git
synced 2026-05-04 15:37:22 +00:00
nvim: update LSP settings
This commit is contained in:
parent
374e6102e1
commit
36dbc64dd4
1 changed files with 45 additions and 58 deletions
103
nvim/init.lua
103
nvim/init.lua
|
|
@ -24,11 +24,10 @@ npx @johnnymorganz/stylua-bin ./init.lua
|
||||||
├─ cfg_lazy_fzf: Fuzzy search
|
├─ cfg_lazy_fzf: Fuzzy search
|
||||||
│ └─ cfg_lazy_fzf_keymaps
|
│ └─ cfg_lazy_fzf_keymaps
|
||||||
├─ cfg_lazy_lsp: LSP configuration & plugins
|
├─ cfg_lazy_lsp: LSP configuration & plugins
|
||||||
│ ├─ cfg_lazy_lsp_servers
|
│ ├─ cfg_lazy_lsp_keymaps
|
||||||
│ │ ├─ cfg_lazy_lsp_servers_lua
|
│ └─ cfg_lazy_lsp_servers
|
||||||
│ │ ├─ cfg_lazy_lsp_servers_ts_ls
|
│ ├─ cfg_lazy_lsp_servers_lua
|
||||||
│ │ └─ cfg_lazy_lsp_servers_vue_ls
|
│ └─ cfg_lazy_lsp_servers_ts_ls
|
||||||
│ └─ cfg_lazy_lsp_keymaps
|
|
||||||
├─ cfg_lazy_cmp: Autocompletion
|
├─ cfg_lazy_cmp: Autocompletion
|
||||||
│ └─ cfg_lazy_cmp_keymaps
|
│ └─ cfg_lazy_cmp_keymaps
|
||||||
└─ cfg_lazy_treesitter: Highlight, edit, and navigate code
|
└─ cfg_lazy_treesitter: Highlight, edit, and navigate code
|
||||||
|
|
@ -421,38 +420,21 @@ require('lazy').setup({
|
||||||
'mason-org/mason-lspconfig.nvim',
|
'mason-org/mason-lspconfig.nvim',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
--[[ cfg_lazy_lsp_servers ]]
|
-- Diagnostic Appearance
|
||||||
local servers = {
|
|
||||||
--[[ cfg_lazy_lsp_servers_lua ]]
|
local icon = '⏹'
|
||||||
lua_ls = {
|
vim.diagnostic.config {
|
||||||
settings = {
|
signs = {
|
||||||
Lua = {
|
text = {
|
||||||
workspace = { checkThirdParty = false },
|
[vim.diagnostic.severity.ERROR] = icon,
|
||||||
telemetry = { enable = false },
|
[vim.diagnostic.severity.WARN] = icon,
|
||||||
diagnostics = {
|
[vim.diagnostic.severity.HINT] = icon,
|
||||||
globals = {
|
[vim.diagnostic.severity.INFO] = icon,
|
||||||
'vim',
|
|
||||||
'require',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
--[[ cfg_lazy_lsp_servers_ts_ls ]]
|
virtual_text = {
|
||||||
ts_ls = {
|
prefix = icon,
|
||||||
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
|
|
||||||
init_options = {
|
|
||||||
plugins = {
|
|
||||||
{
|
|
||||||
name = '@vue/typescript-plugin',
|
|
||||||
location = vim.fn.expand '$MASON/packages' .. '/vue-language-server' .. '/node_modules/@vue/language-server',
|
|
||||||
languages = { 'vue' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
--[[ cfg_lazy_lsp_servers_vue_ls ]]
|
|
||||||
vue_ls = {},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--[[ cfg_lazy_lsp_keymaps ]]
|
--[[ cfg_lazy_lsp_keymaps ]]
|
||||||
|
|
@ -486,34 +468,39 @@ require('lazy').setup({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
--[[ cfg_lazy_lsp_servers ]]
|
||||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
local servers = {
|
||||||
|
--[[ cfg_lazy_lsp_servers_lua ]]
|
||||||
require('mason-lspconfig').setup {
|
lua_ls = {},
|
||||||
ensure_installed = vim.tbl_keys(servers),
|
--[[ cfg_lazy_lsp_servers_ts_ls ]]
|
||||||
handlers = {
|
ts_ls = {
|
||||||
function(server_name)
|
filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'vue' },
|
||||||
local server = servers[server_name] or {}
|
init_options = {
|
||||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
plugins = {
|
||||||
require('lspconfig')[server_name].setup(server)
|
{
|
||||||
end,
|
-- https://github.com/vuejs/language-tools/wiki/Neovim
|
||||||
|
languages = { 'vue' },
|
||||||
|
location = vim.fn.stdpath('data') .. '/mason/packages/vue-language-server/node_modules/@vue/language-server',
|
||||||
|
name = '@vue/typescript-plugin',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Diagnostic Appearance
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
local icon = '⏹'
|
for server, config in pairs(servers) do
|
||||||
vim.diagnostic.config {
|
config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {})
|
||||||
signs = {
|
vim.lsp.config(server, config)
|
||||||
text = {
|
end
|
||||||
[vim.diagnostic.severity.ERROR] = icon,
|
|
||||||
[vim.diagnostic.severity.WARN] = icon,
|
require('mason-lspconfig').setup {
|
||||||
[vim.diagnostic.severity.HINT] = icon,
|
automatic_enable = true,
|
||||||
[vim.diagnostic.severity.INFO] = icon,
|
ensure_installed = {
|
||||||
},
|
'lua-language-server',
|
||||||
},
|
'typescript-language-server',
|
||||||
virtual_text = {
|
'vue-language-server',
|
||||||
prefix = icon,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue