当前位置: 首页 > 工具软件 > betterFORM > 使用案例 >

vscode插件Better Comments的Fortran支持

楚羽
2023-12-01

VScode Better Comments的Fortran语言支持

better comments插件不用过多介绍了,网上的推荐和说明有很多。但是最近使用的时候发现对上古语言Fortran的自由格式写法“!”注释不支持。费了一番功夫,在GitHub上找到了大佬的解决办法:https://github.com/aaron-bond/better-comments/pull/186在提问中作者给出了解决方案,原文是:

The best solution would be for someone with write access to this repo to merge this branch and publish a new version of the extension, but for some reason this has yet to happen.

You could go and manually edit parser.js, where the extension is installed, with the code that I added in parser.ts but beware that if you have extension syncing enabled these changes will be overwritten whenever the extensions are synced with your GitHub/Microsoft account. So really the only solution is for @aaron-bond to merge this to master.

@Arsennnic one more thing I should probably point out about this extension and Fortran code is that !! in Fortran is used by default in Doxygen documentation as continuation characters. Using this extension with Doxygen-styled docstrings will cause them to be highlighted in bright red, which can be a bit annoying for some.

大概就是说找到better comments安装位置中的parser.js文件,找到类似一堆case的片段,然后把以下的内容(在上述GitHub链接中抄的)加进去:

case "FortranFreeForm":
	this.delimiter = "!";
	break;

case "fortran_fixed-form":
	this.delimiter = "!";
	break;

然后重启一下vscode就真的可以了!亲测有效
当然原作者也说了,如果你有开启自动同步,那么如果其他设备上没有这样改的话同步之后你自己做的修改会被覆盖掉。这么小儿科的bug不知道better comments的开发团队为什么不听话把它merge到master里面去!
Anyway, 感谢GitHub上这位老哥,祝诸位苦逼的Fortraner好运。

 类似资料: