iamcco / iamcco/vim-language-server

Feature Request: Speculate about undefined autoload function names

Open
#92 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
546
Forks
19
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/dense-analysis/ale/blob/master/ale_linters/ansible/language_server.vim) 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.