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

Feature Request: Speculate about undefined autoload function names #92

Open
w0rp opened this issue Sep 17, 2023 · 0 comments
Open

Feature Request: Speculate about undefined autoload function names #92

w0rp opened this issue Sep 17, 2023 · 0 comments

Comments

@w0rp
Copy link

w0rp commented Sep 17, 2023

This is a suggestion for a feature that can be implemented. Whenever you are in a path that ends with autoload/foo/bar.vim and you are trying to call a function foo#bar#Baz that doesn't exist in the script, we could probably safely assume that the function doesn't exist in the if not defined in the file, and output a warning for calling it, just like the language server can for s: functions.

A potential gotcha for an implementation of this is that autoload files aren't the only place where it's actually possible to define them. ALE defines them in ale_linters files all over the place and in Vader tests. (The test code redefines functions to mock them.) I think a good implementation could output an error specifically in the context of an autoload/ file path, and say nothing about the functions in other files.

This suggestion is just for the functions defined and called inside of the same script, not for searching over all of &runtimepath to find if a function is defined anywhere, which may be impossible to know given the information above. We can at least make life easier in the one case where we can say for (almost) certain the the function being called isn't defined. I suggest the problem type is a warning as the function call could actually execute.

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

1 participant