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

JSDoc null doesn't get picked up correctly #333

Open rschristian opened 2 years ago

rschristian commented 2 years ago

I'm running into a weird issue where null in JSDoc comments do not get picked up, but seemingly just disappear. The TS playground works correctly, however.

Example snippet

/**
 * @returns {{ bar: ( baz: string ) => { baz: string } | null }}
 */
export function foo() {
    return {
        bar(baz) {
            if (baz) return { baz };
            return null;
        }
    }
}

CoC

temp2

As you'll see, the | null is just missing from the return signature.

TS Playground

Playground Link

This works correctly.

Info

jsconfig.json

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "moduleResolution": "Node",
    "allowJs": true,
    "checkJs": true,
    "noEmit": true
  },
  "include": ["packages/**/*"]
}

:CocInfo

## versions

vim version: NVIM v0.6.0
node version: v14.18.2
coc.nvim version: 0.0.80-03c9add7cd
coc.nvim directory: /home/ryun/.vim/plugged/coc.nvim
term: alacritty
platform: linux

Using coc-tsserver v1.8.6

Let me know if I missed any other details that can help you track this down.

chemzqm commented 2 years ago

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

chemzqm commented 2 years ago

Same behavior on my VSCode, don't know how to fix.

rschristian commented 2 years ago

Well that's bizarre. Swapping out the null for any other type, as far as I can tell, works correctly.

Should I raise this issue on VSCode's tracker?

chemzqm commented 2 years ago

It's up to you.

chemzqm commented 2 years ago

I found suggest.jsdoc.generateReturns in source code of VSCode, coc-tsserver may need to support it.