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

Autocompletion is, sometimes, dead with JSDoc #325

Closed carlosala closed 2 years ago

carlosala commented 2 years ago

Hi! I have been using JSDoc for a while with coc-tsserver, and there are some times (more than 50%) that I am not getting autocompletion for it. This is my jsconfig.json config:

{
  "compilerOptions": {
    "baseUrl": ".",
    "checkJs": true,
    "jsx": "preserve",
    "module": "es2020",
    "moduleResolution": "node"
  },
  "exclude": ["node_modules", ".next"]
}

My coc-tsserver config is the one as default, I just have "tsserver.implicitProjectConfig.checkJs": true, but it does nothing with this issue. Does anyone knows how to get completion with JSDoc? Thanks!

fannheyward commented 2 years ago

Can you post an example js file with JSDoc, to let me make a test/debug.

carlosala commented 2 years ago

Fuck, I got the error. Prettier removed me the second * in some files and tsserver detected it, correctly, as a regular comment. I'm so sorry for you lost time. Thank you!

carlosala commented 2 years ago

@fannheyward where is true that I'm not getting completion is when defining types, for instance:

/**
 * @typedef {object} CurrencyInputType
 * @property {function} setAmount
 * @property {function} setCurrency
 * @property {string} ariaLabel
 */

When I type @property {cursorhere} I am not getting type completion. If I begin typing stri I don't get the completion for string. It's not quite annoying, but it would be great to have it solved. Thanks!

Note: the same happens if, instead of having @typedef {object} CurrencyInputType, you have @typedef CurrencyInputType

chemzqm commented 2 years ago

I can reproduce.

Should be problem of tsserver, checkout https://github.com/neoclide/coc-tsserver/blob/master/Readme.md#troubleshooting