Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LuaPanda 没有识别全局变量并提示 #42

Closed
deckvig opened this issue Nov 25, 2019 · 2 comments
Closed

LuaPanda 没有识别全局变量并提示 #42

deckvig opened this issue Nov 25, 2019 · 2 comments

Comments

@deckvig
Copy link

deckvig commented Nov 25, 2019

在未配置.luacheckrc的情况下,LuaPanda 没有识别全局变量并提示,但在相同路径下直接调用 luacheck 能发现全局变量

@GrandZhuo
Copy link
Collaborator

鉴于以下情况,我们默认忽略了文件中的全局变量:
在工程中有A、B两个lua文件,A中定义了一个全局变量,B require A,并在B中直接使用了A中定义的全局变量,这个时候对B运行luacheck,会认为B中使用了未定义的全局变量,报一个warning,accessing undefined variable XXX。考虑到全局变量可能定义在工程中的其他文件,也有可能是在运行时由lua框架(例如slua等)直接放入到lua虚拟机中,为了避免在这些情况下产生不必要的干扰,我们选择默认忽略了对全局变量的检查。

在VSCode的设置中还有一些关于Code Linting的配置,用以优化使用体验,例如Ignore Error Code、Luacheck Path等。

@weng7654
Copy link

weng7654 commented Nov 2, 2021

可以做一个共享全局变量的检查吗,就是无论A、B 只要存在不存在的全局变量引用,就报错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants