简体   繁体   中英

VSCode Javascript/Typescript namespaces in hover

I am relatively new to typescript ( approx. one month ). Whilst coding, and hovering over a code snippet to figure how it works, it appears as such: VSCode Hover Documentation with puppeteer namespace

( Sidenote: I do not know what most of anything is called, so I am just going to call the VSCode feature "VSCode Hover Documentation" )

Due to working on older javascript projects, I remembered that the VSCode Hover Documentation didn't have the namespace in it ( Eg the hover doc was ...options?: LaunchOptions... and not ...options?: puppeteer.LaunchOptions... ) Going back to a couple of other projects to confirm my recollections prove me otherwise. Jumping from a typescript project and a javascript project with the puppeteer package on both results in both giving me the same result as specified earlier. On both projects, puppeteer is imported the same way via require("puppeteer") . I attempted the same procedure with import , but no dice.

Is there any settings in VSCode or tsconfig.json where I can achieve the VSCode Hover Documentation without puppeteer namespace ? ( photo was edited to simulate desired effect )

There's no options or preferences to customize those tooltips.

But the thing is, those types are in the puppeteer namespace. This hint helps you know that. If you had your own type named LaunchOptions , then this tells you that type is different from that. It also gives you a hint about how to import that type.

So the namespace is there for a reason. Removing it would make things more confusing or ambiguous.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM