zls
zls copied to clipboard
Identify methods with first arg type for completion on non-method
When working on a structure, ZLS offers completion for methods inside a non-method. What I mean by that is that if a function defined on a structure isn't a method (first parameter structure's type), it should not be able to access methods like:
Here, fn4 isn't a method and yet completion shows all methods with matching name.
If there is a way to identify the first parameter's type and notice that it's a method, we could even go a step further and show completion to "smart insert" methods like in Rust:
theres nothing stopping you from using any of those other functions from within fn4, you might have/create an instance of Foo. methods arent anything magical in zig