intellism / vscode-comment-translate

vscode 注释翻译插件, 不干扰正常代码,方便快速阅读源码。
https://marketplace.visualstudio.com/items?itemName=intellsmi.comment-translate
MIT License
484 stars 77 forks source link

变量声明后接多行注释无法识别 #164

Closed Antecer closed 1 year ago

Antecer commented 1 year ago

例如以下代码块,鼠标悬停到变量上不会出现注释翻译:

uint8_t test; /* test one line
 test two line
 test three line
 */

希望能支持一下这种结构的翻译

intellism commented 1 year ago

image 支持的。 通过vscode的textmate语法高亮匹配的,需要看看是否安装了具体的高亮语法。

Antecer commented 1 year ago

@intellism image 我的意思是,鼠标停留在变量名上,而不是注释区域。

image 这种注释在变量前面,就能够正常识别。

另:textmate 是什么?刚尝试安装了 TextMate Languages 还是没有效果。

intellism commented 1 year ago

@intellism image 我的意思是,鼠标停留在变量名上,而不是注释区域。

image 这种注释在变量前面,就能够正常识别。

另:textmate 是什么?刚尝试安装了 TextMate Languages 还是没有效果。

你理解错了,图2不是在“翻译变量“,是在翻译当前位置的Hover内容,图2的方式,会促发语言服务器把注释hover显示出来,hover的内容被翻译了,所以有两个提示。 你可以关闭翻译插件比较下他们两,图1没任何反应,图2 会显示原英文。 image

Antecer commented 1 year ago
/*sample 1*/
uint8 test1:
uint8 test2; /*sample 2*/
uint8 test3; /*
sample 3
*/

如上所示,鼠标悬停到变量上,test1和test2的注释会被显示并翻译,test3的注释不显示并且不翻译。 这个问题应该是vscode没有识别到第三种注释,有没有办法解决这个问题呢? 我知道可以悬停注释上查看翻译,但实际调用库的时候,需要定位到库里面才能看注释(很麻烦),1和2的注释模式,只需要在声明的变量悬停就能看注释,就很方便。