mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
lsp: add vstls LSP with vue support
This commit is contained in:
parent
e35a74c44a
commit
4b7357166d
2 changed files with 54 additions and 3 deletions
|
@ -52,6 +52,57 @@
|
|||
'';
|
||||
};
|
||||
|
||||
# vtsls language server, including Vue support
|
||||
# https://github.com/yioneko/vtsls
|
||||
# https://github.com/vuejs/language-tools/wiki/Neovim
|
||||
vtsls = {
|
||||
package = pkgs.vtsls;
|
||||
lspConfig =
|
||||
# lua
|
||||
''
|
||||
local vue_language_server_path = '${pkgs.vue-language-server + "/lib/node_modules/@vue/language-server"}'
|
||||
local vue_plugin = {
|
||||
name = '@vue/typescript-plugin',
|
||||
location = vue_language_server_path,
|
||||
languages = { 'vue' },
|
||||
configNamespace = 'typescript',
|
||||
}
|
||||
|
||||
--- lsconfig method doesn't work in nvf, it says
|
||||
--- it cannot find vue_ls or vtsls config.md
|
||||
--- Using it this way means they're always enabled configs
|
||||
vim.lsp.config("vtsls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = function(client, bufnr)
|
||||
attach_keymaps(client, bufnr);
|
||||
-- TODO: do we need to disable formatting for this LS?
|
||||
client.server_capabilities.documentFormattingProvider = false;
|
||||
end,
|
||||
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
|
||||
settings = {
|
||||
vtsls = {
|
||||
tsserver = {
|
||||
globalPlugins = {
|
||||
vue_plugin,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/vtsls", "--stdio"}''
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config('vue_ls', {
|
||||
cmd = {"${getExe pkgs.vue-language-server}", "--stdio"}
|
||||
})
|
||||
|
||||
vim.lsp.enable({'vtsls', 'vue_ls'})
|
||||
'';
|
||||
};
|
||||
|
||||
# Here for backwards compatibility. Still consider tsserver a valid
|
||||
# configuration in the enum, but assert if it's set to *properly*
|
||||
# redirect the user to the correct server.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue