【问题标题】:@types/node and VS Code: IntelliSense not working because of comment formatting@types/node 和 VS 代码:IntelliSense 因注释格式而无法工作
【发布时间】:2017-08-12 20:51:05
【问题描述】:

我使用 Visual Studio Code 和 @types/node (7.0.8),但似乎某些函数等的代码注释格式错误,因此 Visual Studio Code 和 Visual Studio 2017 不会在 IntelliSense 中显示任何快速信息。

例子

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

当我输入 fs.unlink VS Code 时,显示函数签名,而不是在中定义的注释

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

在线 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;

这里的罪魁祸首是第一行遗漏了一个星号。 正确的符号是

/**

只要我像这样更改 index.d.ts,我就可以开始使用 IntelliSense。 有些函数的注释正确,有些则没有。

我在这里做错了吗? (这些功能是否尽管被导出却不打算使用) @types/node 是否有错误?如果有,有没有办法教 VS Code 解析这些 cmets?

谢谢

【问题讨论】:

    标签: node.js typescript visual-studio-code typescript-typings


    【解决方案1】:

    我致力于 VSCode 的 TS 和 JS 支持。使用/* 而不是/** 看起来像是节点d.ts 类型定义中的一个错误。据我所知,没有办法配置 TypeScript 或 VSCode 将普通的旧 /* cmets 视为文档 cmets。

    我已经提交了带有修复程序的 PR:https://github.com/DefinitelyTyped/DefinitelyTyped/pull/15285

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-03
      • 2017-03-25
      • 2020-01-12
      • 2019-12-26
      • 2016-08-30
      • 2017-07-23
      • 2021-06-17
      相关资源
      最近更新 更多