简体   繁体   中英

@types/node and VS Code: IntelliSense not working because of comment formatting

I use Visual Studio Code and @types/node (7.0.8) but it seems that some functions etc. have a wrong formatted code comment and therefore Visual Studio Code and Visual Studio 2017 won't show any quickinfos in IntelliSense.

example

import * as fs from 'fs';
fs.unlink

When I type fs.unlink VS Code display the function signature but not the comment whitch is defined in

./node_modules/@types/node/index.d.ts

on line 2400

/*
 * Asynchronous unlink - deletes the file specified in {path}
 *
 * @param path
 * @param callback No arguments other than a possible exception are given to the completion callback.
 */
 export function unlink(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void;

The culprit here is the first line which misses an asterisk. The correct notation would be

/**

As soon as I change index.d.ts like that, I get working IntelliSense. Some functions are commented corretly while others are not.

Am I doing something wrong here? (are those functions not meant to be used despite being exported) Is it an error in @types/node and if so are there ways to teach VS Code to parse those comments?

Thanks

I work on TS and JS support for VSCode. The use of /* instead of /** looks like a bug in the node d.ts type definition. As far as I know, there is no way to configure TypeScript or VSCode to treat plain old /* comments as documentation comments.

I've submitted a PR with the fix: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/15285

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