neoclide / coc-tsserver

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

Auto-completing TSX component results in parentheses #296

Closed jacksonludwig closed 3 years ago

jacksonludwig commented 3 years ago

In react/tsx/jsx, components can be functions like this:

export default function ExampleComponent() {
  return (
    ...
  );
}

When trying to use this component inside another, you should write it like this:

<ExampleComponent />

However, when using completion to select ExampleComponent, it is completed as ExampleComponent() instead. It seems that tsserver is mistaking ExampleComponent for a normal function instead of a react component.

I'm using the latest release branch of COC, and the most updated version of coc-tsserver. I'm on neovim nightly.

Setting "typescript.suggest.completeFunctionCalls" to false is a workaround for this issue, but of course disables parens in all completions.

chemzqm commented 3 years ago

Should be problem of your tsserver, checkout https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel

chemzqm commented 3 years ago

Can't reproduce with typescript 4.2.x. Use <C-n> to insert word of complete item which avoid snippet insert.