Browse Source

fix: volar for vue3

master
Tovi Jaeschke-Rogers 6 months ago
parent
commit
23a348548a
2 changed files with 48 additions and 30 deletions
  1. +42
    -25
      .config/nvim/lua/tovi/plugins/lsp/lspconfig.lua
  2. +6
    -5
      .zshrc

+ 42
- 25
.config/nvim/lua/tovi/plugins/lsp/lspconfig.lua View File

@ -104,42 +104,59 @@ return {
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
-- configure html server
lspconfig["html"].setup({
lspconfig.html.setup({
capabilities = capabilities,
on_attach = on_attach,
})
-- configure typescript server with plugin
lspconfig["tsserver"].setup({
capabilities = capabilities,
on_attach = on_attach,
filetypes = { "typescript", "vue" },
init_options = {
{
name = "@vue/typescript-plugin",
location = "/usr/local/lib/node_modules/@vue/typescript-plugin",
languages = {"javascript", "typescript", "vue"},
},
}
lspconfig.tsserver.setup({
init_options = {
plugins = {
{
name = "@vue/typescript-plugin",
location = "/usr/local/lib/node_modules/@vue/typescript-plugin",
languages = { "javascript", "typescript", "vue" },
},
},
},
filetypes = {
"javascript",
"typescript",
"vue",
},
capabilities = capabilities,
})
-- configure css server
lspconfig["cssls"].setup({
capabilities = capabilities,
local function get_typescript_server_path(root_dir)
local global_ts = '/usr/local/lib/node_modules/typescript/lib'
local found_ts = ''
local function check_dir(path)
found_ts = util.path.join(path, 'node_modules', 'typescript', 'lib')
if util.path.exists(found_ts) then
return path
end
end
if util.search_ancestors(root_dir, check_dir) then
return found_ts
else
return global_ts
end
end
lspconfig.volar.setup({
-- capabilities = capabilities,
on_attach = on_attach,
filetypes = { "vue" },
on_new_config = function(new_config, new_root_dir)
new_config.init_options.typescript.tsdk = get_typescript_server_path(new_root_dir)
end,
})
-- configure emmet language server
lspconfig["volar"].setup({
-- configure css server
lspconfig["cssls"].setup({
capabilities = capabilities,
on_attach = on_attach,
filetypes = { "vue" },
init_options = {
typescript = {
tsdk = '/usr/local/lib/node_modules/typescript/lib'
},
},
})
-- configure php server


+ 6
- 5
.zshrc View File

@ -11,6 +11,7 @@ export CASE_SENSITIVE="true"
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
# Load colors
autoload -U colors && colors
PROMPT="%{$fg[blue]%}%1~ %{$fg[green]%}>%{$reset_color%} "
# Automatically cd into typed directory.
@ -28,11 +29,11 @@ bindkey -v
export KEYTIMEOUT=1
# Use vim keys in tab complete menu:
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -v '^?' backward-delete-char
# bindkey -M menuselect 'h' vi-backward-char
# bindkey -M menuselect 'k' vi-up-line-or-history
# bindkey -M menuselect 'l' vi-forward-char
# bindkey -M menuselect 'j' vi-down-line-or-history
# bindkey -v '^?' backward-delete-char
# Edit line in vim with ctrl-e:
autoload edit-command-line; zle -N edit-command-line


Loading…
Cancel
Save