From 07ec31112afd612ceca74f11fc593c92e6db7da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Mon, 25 Feb 2019 15:36:14 +0000 Subject: [PATCH] Add JS support in vim --- .vimrc.plugins | 3 +++ .vimrc.plugins-settings | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/.vimrc.plugins b/.vimrc.plugins index 8f2ab30a..85438790 100644 --- a/.vimrc.plugins +++ b/.vimrc.plugins @@ -11,6 +11,7 @@ Plug 'airblade/vim-gitgutter' Plug 'cespare/vim-toml' Plug 'Chiel92/vim-autoformat' Plug 'drmingdrmer/vim-toggle-quickfix' +Plug 'editorconfig/editorconfig-vim' Plug 'godlygeek/tabular' Plug 'https://github.com/cyplo/vim-colors-solarized.git' Plug 'junegunn/fzf.vim' @@ -25,6 +26,8 @@ Plug 'prabirshrestha/vim-lsp' Plug 'roxma/nvim-yarp' Plug 'roxma/vim-hug-neovim-rpc' Plug 'rust-lang/rust.vim' +Plug 'ryanolsonx/vim-lsp-javascript' +Plug 'ryanolsonx/vim-lsp-typescript' Plug 'scrooloose/nerdtree' Plug 'timonv/vim-cargo' Plug 'tpope/vim-cucumber' diff --git a/.vimrc.plugins-settings b/.vimrc.plugins-settings index 7d751455..e2ce43ad 100644 --- a/.vimrc.plugins-settings +++ b/.vimrc.plugins-settings @@ -24,6 +24,15 @@ au User lsp_setup call lsp#register_server({ \ 'whitelist': ['rust'], \ }) +if executable('typescript-language-server') + au User lsp_setup call lsp#register_server({ + \ 'name': 'javascript support using typescript-language-server', + \ 'cmd': { server_info->[&shell, &shellcmdflag, 'typescript-language-server --stdio']}, + \ 'root_uri': { server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_directory(lsp#utils#get_buffer_path(), '.git/..'))}, + \ 'whitelist': ['javascript', 'javascript.jsx', 'typescript', 'typescript.tsx'], + \ }) +endif + let g:lsp_signs_enabled = 1 let g:lsp_diagnostics_echo_cursor = 1