Skip to content

Commit

Permalink
Add globalPlugins for vue
Browse files Browse the repository at this point in the history
  • Loading branch information
heavenshell authored and mattn committed May 30, 2024
1 parent 69a90d9 commit 195fa71
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions settings/vtsls.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@ function! Vim_lsp_settings_vtsls_get_blocklist() abort
return []
endfunction

function! s:find_vue_plugin() abort
let plugin_location = lsp_settings#servers_dir() .. '/volar-server/node_modules/@vue/typescript-plugin'
if !isdirectory(plugin_location)
return v:null
endif

return {
\ 'name': '@vue/typescript-plugin',
\ 'location': plugin_location,
\ 'languages': ['vue'],
\ }
endfunction

function! Vim_lsp_settings_vtsls_setup_plugins() abort
let plugins = []

let vue_plugin = s:find_vue_plugin()
if !empty(vue_plugin)
call add(plugins, vue_plugin)
endif

return plugins
endfunction

augroup vim_lsp_settings_vtsls
au!
LspRegisterServer {
Expand Down Expand Up @@ -63,6 +87,11 @@ augroup vim_lsp_settings_vtsls
\ },
\ },
\ },
\ 'vtsls': {
\ 'tsserver': {
\ 'globalPlugins': Vim_lsp_settings_vtsls_setup_plugins(),
\ },
\ },
\ }),
\ 'semantic_highlight': lsp_settings#get('vtsls', 'semantic_highlight', {}),
\ }
Expand Down

0 comments on commit 195fa71

Please sign in to comment.