neoclide / coc-tsserver

Tsserver extension for coc.nvim that provide rich features like VSCode for javascript & typescript
MIT License
1.06k stars 68 forks source link

Can I turn off typescript autocompletion? #308

Closed IronBlood closed 3 years ago

IronBlood commented 3 years ago

FIrstly thank you for the coc.nvim project! I've been using this coc-tsserver for a long time, but just now I found something unexpected when working on my secondary computer. Not sure whether this is coc-tsserver feature or from tsserver itself, here're the cases:

Case-1: type the code sequentially, no autocompletion here.

const foo = () => {
  let i = 42;
  if (i > 42) {

Case-2: finish the function block first without ";", autocompletion ends if block with }

const bar = () => {
} // manually typed

And then insert between:

const bar = () => {
  let i = 42;
  if (i > 42) {
    // cursor here
  } // inserted by autocompletion
} // manually typed

Case-3: finish the function block first with ";", autocopletion ends if block with );

const baz = () => {
}; // manually typed

And then insert between:

const baz = () => {
  let i = 42;
  if (i > 42) {
    // cursor here
  }; // inserted by autocompletion
}; // manually typed

These situations also occur with function callbacks, such as

foo(() => {
});

I've seen unnecessary }); many times especially when I've closed the function call manually. My configuration file looks like this (edited with :CocConfig) but it doesn't work for typescript.

{
  "typescript.suggest.includeCompletionsWithSnippetText": false
}

Versions:

I tried to downgrade coc-tsserver from 1.8.6 to 1.8.1 by editing package.json and running npm install, but the problem still occurs on my secondary computer. Both computers run self compiled vim 8.2 (included patches 1-2528) and coc.nvim-0.0.80. Is there anyway to turn off this feature?

chemzqm commented 3 years ago

Try minimal vimrc, it should be not issue with coc-tsserver, checkout the verbose output