diff options
-rw-r--r-- | plugin/lsp_setup.vim | 9 | ||||
-rw-r--r-- | settings/javascript-typescript-langserver.vim | 13 | ||||
-rw-r--r-- | settings/typescript-language-server.vim | 2 |
3 files changed, 20 insertions, 4 deletions
diff --git a/plugin/lsp_setup.vim b/plugin/lsp_setup.vim index 6f2a471..f2f70aa 100644 --- a/plugin/lsp_setup.vim +++ b/plugin/lsp_setup.vim @@ -82,9 +82,12 @@ function! s:vimlsp_setting() abort endif for l:server in s:settings[l:ft] if s:executable(l:server.command) - exe 'source' printf('%s/%s.vim', s:settings_dir, l:server.command) - let l:found += 1 - break + let l:script = printf('%s/%s.vim', s:settings_dir, l:server.command) + if filereadable(l:script) + exe 'source' l:script + let l:found += 1 + break + endif endif endfor if l:found ==# 0 diff --git a/settings/javascript-typescript-langserver.vim b/settings/javascript-typescript-langserver.vim new file mode 100644 index 0000000..e9a5ea6 --- /dev/null +++ b/settings/javascript-typescript-langserver.vim @@ -0,0 +1,13 @@ +augroup vimlsp_settings_javascript_typescript_langserver + au! + autocmd User lsp_setup call lsp#register_server({ + \ 'name': 'javascript-typescript-langserver', + \ 'cmd': lsp_settings#get('javascript-typescript-langserver', 'cmd', {server_info->[lsp_settings#exec_path('javascript-typescript-langserver'), '--stdio']}), + \ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'tsconfig.json'))}, + \ 'initialization_options': lsp_settings#get('javascript-typescript-langserver', 'initialization_options', {"diagnostics": "true"}), + \ 'whitelist': lsp_settings#get('javascript-typescript-langserver', 'whitelist', ['typescript', 'typescript.tsx']), + \ 'blacklist': lsp_settings#get('javascript-typescript-langserver', 'blacklist', []), + \ 'config': lsp_settings#get('javascript-typescript-langserver', 'config', {}), + \ 'workspace_config': lsp_settings#get('javascript-typescript-langserver', 'workspace_config', {}), + \ }) +augroup END diff --git a/settings/typescript-language-server.vim b/settings/typescript-language-server.vim index ab7009d..f9bb5f1 100644 --- a/settings/typescript-language-server.vim +++ b/settings/typescript-language-server.vim @@ -2,7 +2,7 @@ augroup vimlsp_settings_typescript_language_server au! autocmd User lsp_setup call lsp#register_server({ \ 'name': 'typescript-language-server', - \ 'cmd': lsp_settings#get('typescript-language-server', {server_info->[lsp_settings#exec_path('typescript-language-server'), '--stdio']}), + \ 'cmd': lsp_settings#get('typescript-language-server', 'cmd', {server_info->[lsp_settings#exec_path('typescript-language-server'), '--stdio']}), \ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'tsconfig.json'))}, \ 'initialization_options': lsp_settings#get('typescript-language-server', 'initialization_options', {"diagnostics": "true"}), \ 'whitelist': lsp_settings#get('typescript-language-server', 'whitelist', ['typescript', 'typescript.tsx']), |