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

Identify methods with first arg type for completion on non-method #2137

Open
MartinVacheron opened this issue Jan 8, 2025 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@MartinVacheron
Copy link

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:

image

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:

image

@MartinVacheron MartinVacheron added the enhancement New feature or request label Jan 8, 2025
@xdBronch
Copy link
Contributor

xdBronch commented Jan 8, 2025

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

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

No branches or pull requests

2 participants