Dropped mason (was mixing vue language server up anyways)
This commit is contained in:
39
lua/lsp.lua
39
lua/lsp.lua
@@ -1,4 +1,4 @@
|
||||
-- attach using autocommand, much better than doing it during mason
|
||||
-- attach using autocommand and setup keybindings
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('sl.lsp', {}),
|
||||
callback = function(args)
|
||||
@@ -52,26 +52,6 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||
end
|
||||
})
|
||||
|
||||
require('mason').setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
require('mason-lspconfig').setup({
|
||||
-- A list of servers to automatically install if they're not already installed
|
||||
ensure_installed = {
|
||||
'lua_ls',
|
||||
-- 'rust_analyzer', -- handled by rust mrcjkb/rustaceanvim
|
||||
'yamlls',
|
||||
'gopls',
|
||||
},
|
||||
})
|
||||
|
||||
-- lsp format selected range
|
||||
function LSPRangeFormatFunction()
|
||||
vim.lsp.buf.format({
|
||||
@@ -88,15 +68,26 @@ end
|
||||
-- use globally installed vue-language-server (instead of mason provided)
|
||||
vim.lsp.config('vue_ls', {
|
||||
-- add filetypes for typescript, javascript and vue
|
||||
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
|
||||
-- filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
|
||||
init_options = {
|
||||
vue = {
|
||||
-- disable hybrid mode
|
||||
-- disable hybrid mode, will thus use ts_ls internally
|
||||
hybridMode = false,
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.lsp.enable('vue_ls')
|
||||
|
||||
local enable_this_lsp = {
|
||||
'vue_ls',
|
||||
'gopls',
|
||||
'bashls',
|
||||
'html',
|
||||
'lua_ls',
|
||||
}
|
||||
|
||||
for l in pairs(enable_this_lsp) do
|
||||
vim.lsp.enable(enable_this_lsp[l])
|
||||
end
|
||||
|
||||
|
||||
-- add autoformat to Dioxus projects
|
||||
|
||||
Reference in New Issue
Block a user