悬停时如何让 VSCode 显示我的库函数参数
How to get VSCode to show my libraries function arguments when hovered
我写了一个 JavaScript 库,我正在尝试了解如何在用户将鼠标悬停在 VSCode 上时显示 parameters/definitions 函数(我在 VSCode 中看到了这个其他图书馆,我没有注意到它们有什么特别之处)。我确定它很简单,但我只是不知道我会怎么做。 Link 项目在这里:https://github.com/isaacgr/jaysonic
我试过在 class 定义周围添加 jsdoc 风格的注释,但总的来说我不确定该尝试什么。如果有人能指出正确的方向,我将不胜感激。
An example would be what I see with JSON.parse
Visual Studio 代码使用 IntelliSense for autocompletions like the one you mentioned and in JavaScript they are based mainly on TypeScript definitions. If a project is already built using TypeScript, they may be generated and linked in the corresponding package.json-file 使用 "typings" 或 "types" 属性.
或者(虽然我还没有测试过这种方法)现有的 JSDoc 注释可以用于 generate these TypeScript Definitions。
TypeScript 社区还(通常是手动)创建了单独的 Typescript-Definitions,它们作为名为 @types/name-of-the-package.
的 npm 包提供。
在您的情况下,第一种方法 creating/generating a typings-file 并将其链接到您的 package.json 可能是实现预期结果的最佳方法。
顺便说一句,如果你想检查这样的打字稿定义文件,请按 Ctrl(在 Windows 上)并单击 JSON.parse 方法。这将向您显示名为 lib.es5.d.ts 的相应打字稿定义文件(它嵌入在 vscode 中,因为它是 JavaScript 语言的一部分,因此不需要安装)
我写了一个 JavaScript 库,我正在尝试了解如何在用户将鼠标悬停在 VSCode 上时显示 parameters/definitions 函数(我在 VSCode 中看到了这个其他图书馆,我没有注意到它们有什么特别之处)。我确定它很简单,但我只是不知道我会怎么做。 Link 项目在这里:https://github.com/isaacgr/jaysonic
我试过在 class 定义周围添加 jsdoc 风格的注释,但总的来说我不确定该尝试什么。如果有人能指出正确的方向,我将不胜感激。
An example would be what I see with JSON.parse
Visual Studio 代码使用 IntelliSense for autocompletions like the one you mentioned and in JavaScript they are based mainly on TypeScript definitions. If a project is already built using TypeScript, they may be generated and linked in the corresponding package.json-file 使用 "typings" 或 "types" 属性.
或者(虽然我还没有测试过这种方法)现有的 JSDoc 注释可以用于 generate these TypeScript Definitions。
TypeScript 社区还(通常是手动)创建了单独的 Typescript-Definitions,它们作为名为 @types/name-of-the-package.
的 npm 包提供。在您的情况下,第一种方法 creating/generating a typings-file 并将其链接到您的 package.json 可能是实现预期结果的最佳方法。
顺便说一句,如果你想检查这样的打字稿定义文件,请按 Ctrl(在 Windows 上)并单击 JSON.parse 方法。这将向您显示名为 lib.es5.d.ts 的相应打字稿定义文件(它嵌入在 vscode 中,因为它是 JavaScript 语言的一部分,因此不需要安装)