环境:vscode 语言:lua,typescript
我创建了一个typescript文件,并在其中声明函数,添加了注解,如下
/**
* This function allow to read the status of one of the buttons attached to TIC. The function return true when the key interrogated using its id, is pressed.
*
* https://github.com/nesbox/TIC-80/wiki/btn
*
* @param {number} id
* @returns {boolean} pressed
*/
declare function btn(id: number): boolean;
我想在同目录下的一个lua文件中,当鼠标悬浮在某个函数比如btn()
上时能够看到我在上述ts文件中写的注解,请问该如何操作?
可以在 vscode 中使用插件 "Titanium Typescript" 或 "Lua/LuaJIT Language Server" 以支持鼠标悬停文档。只需在 vscode 中安装插件,重启 vscode 即可生效。