VSCode 扩展 API:为 JSDoc 中的代码块启用智能感知

问题描述 投票:0回答:1

我正在尝试将 Intelisense 功能添加到 JSDoc 代码块,因此它确实包括代码完成并验证这些块内的语法和类型:

/**
 * Ensures that the word starts with capital later
 * ```jsx
 * console.log( capitalize('hello') ) // Would be cool to have autocompletion here
 * console.log( capitalize(42) ) // And to highlight error here
 * ```
 */
function capitalize(word: string) {
  return word.slice(0, 1).toUpperCase() + word.slice(1).toLowerCase();
}

关于如何实现它的任何想法,因为我只找到了

registerCompletionItemProvider
,但我看不到使用它来向 JSDoc 添加完成的选项

visual-studio-code vscode-extensions jsdoc
1个回答
0
投票

查看扩展 JSDoc markdown highlighting,它可以为

ts
js
文件提供语法高亮显示(在该代码块中使用
ts
)——但不是完成或验证。也许里面的东西可以帮助你。

© www.soinside.com 2019 - 2024. All rights reserved.