什么vscode ruby扩展检测未声明的变量之类的东西



我已经尝试了许多扩展/配置,但无法让vscode检测变量何时未定义。例如,像这样简单的东西显示没有警报:

# b and c are not defined anywhere
a = b + c 

我希望看到linter或其他扩展提醒我b和c没有声明。相反,我根本没有看到任何突出显示或通知。

我安装了以下扩展:Ruby、Solargraph、Ruby-linter、Ruby-robocop、VSCodeRuby。我为linter、solarggraph和intellisense添加了一些自定义配置:

"ruby.linter.run": "onSave",
"solargraph.definitions": false,
"ruby.intellisense": "rubyLocate"

但仍然没有任何效果。感谢提供的任何帮助

Solargraph有一个实验类型检查器,您可以在.solargraph.yml文件中激活它:

reporters:
- typecheck:strict

请记住,你很可能会得到假阳性,因为1(它仍处于测试阶段,2(正如其他人所提到的,动态方法和其他运行时魔法通常对静态分析是看不见的。

更多信息:https://solargraph.org/guides/type-checking

最新更新