Skip to content
Prabir Shrestha edited this page Aug 26, 2017 · 16 revisions

Installing server

npm install -g typescript typescript-language-server

Note: tsserver is required to be in path. If you would like to point to a custom version of tsserver use --tsserver-path <path> where <path> is the absolute path of tsserver.

Registering in .vimrc

if executable('typescript-language-server')
    au User lsp_setup call lsp#register_server({
        \ 'name': '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_file_directory(lsp#utils#get_buffer_path(), 'tsconfig.json'))},
        \ 'whitelist': ['typescript'],
        \ })
endif