Skip to content

Automatic switching deno and tsserver settings.

Luma edited this page Feb 8, 2021 · 1 revision
function! s:switch_coc_deno() abort
  let path = empty(expand('%')) ? '.' : '%:p:h'
  if empty(finddir("node_modules", path . ';'))
    call coc#config('deno.enable', v:true)
    call coc#config('tsserver.enable', v:false)
  else
    call coc#config('deno.enable', v:false)
    call coc#config('tsserver.enable', v:true)
  endif
endfunction
augroup my-coc-deno
  autocmd BufRead,BufNewFile *.ts ++once call s:switch_coc_deno()
augroup END

by @lambdalisue

Clone this wiki locally