🔧 Added ts support in nvim for vue
This commit is contained in:
parent
5896eac43d
commit
3b96e0b641
1 changed files with 25 additions and 16 deletions
|
|
@ -1,27 +1,16 @@
|
||||||
local lsp = require("lsp-zero")
|
local lsp = require("lsp-zero")
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
local cmp = require("cmp")
|
||||||
lsp.preset("recommended")
|
lsp.preset("recommended")
|
||||||
|
require("mason").setup()
|
||||||
|
|
||||||
lsp.ensure_installed({
|
lsp.ensure_installed({
|
||||||
"tsserver",
|
"tsserver",
|
||||||
"eslint",
|
"eslint",
|
||||||
"sumneko_lua",
|
|
||||||
"rust_analyzer",
|
"rust_analyzer",
|
||||||
|
"volar",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Fix Undefined global 'vim'
|
|
||||||
lsp.configure("sumneko_lua", {
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
diagnostics = {
|
|
||||||
globals = { "vim" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
local cmp = require("cmp")
|
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
window = {
|
window = {
|
||||||
completion = cmp.config.window.bordered(),
|
completion = cmp.config.window.bordered(),
|
||||||
|
|
@ -58,9 +47,29 @@ function SetAutoCmp(mode)
|
||||||
Mode = require("cmp.types").cmp.TriggerEvent.TextChanged
|
Mode = require("cmp.types").cmp.TriggerEvent.TextChanged
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
SetAutoCmp(Mode)
|
SetAutoCmp(Mode)
|
||||||
lsp.setup()
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = true,
|
virtual_text = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- LSP Specific Settings
|
||||||
|
-- Volar TypeScript Config (turn off for Vue with Vanilla JS)
|
||||||
|
-- require("mason-lspconfig").setup_handlers({
|
||||||
|
-- function(server_name)
|
||||||
|
-- local server_config = {}
|
||||||
|
-- if server_name == "volar" then
|
||||||
|
-- server_config.filetypes = { "vue", "typescript", "javascript" }
|
||||||
|
-- lspconfig.tsserver.setup({
|
||||||
|
-- ["disabled"] = true,
|
||||||
|
-- })
|
||||||
|
-- lspconfig.volar.setup({
|
||||||
|
-- settings = {
|
||||||
|
-- ["volar.takeOverMode.enabled"] = true,
|
||||||
|
-- },
|
||||||
|
-- })
|
||||||
|
-- end
|
||||||
|
-- lspconfig[server_name].setup(server_config)
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue