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

No in-editor warnings when using indexing on a bad type #134

Closed
grab-a-byte opened this issue Sep 13, 2023 · 8 comments
Closed

No in-editor warnings when using indexing on a bad type #134

grab-a-byte opened this issue Sep 13, 2023 · 8 comments
Labels

Comments

@grab-a-byte
Copy link

I'm trying to learn Zig and using VSCode for it, I'm using an array list and while I've figured out I need to use arrList.items[0] I'm still curious why i'm not getting the error in-editor before i compile it, this seems like a normal part of tooling and it is really making it difficult to learn the language.

image

Am I missing something here or is this not something that is implemented?

Thanks in advance.

@grab-a-byte grab-a-byte changed the title No in-editor warnigns when using indexing on a bad type No in-editor warnings when using indexing on a bad type Sep 13, 2023
@Vexu
Copy link
Member

Vexu commented Sep 14, 2023

The buildOnSave option should handle this but it seems to be broken at the moment.

@Vexu Vexu added the bug label Sep 14, 2023
@akhildevelops
Copy link

I also faced similar problem warnings / errors aren't shown in VSCode. It worked only after enabling buildonsave option that I understood from below.

The buildOnSave option should handle this but it seems to be broken at the moment.

@grab-a-byte
Copy link
Author

Build on save seems o have fixed this but it also seems like a slightly sub-par experience. Having to save and wait for a build to do some type checking like that really slows down development iterations. Is there a reason it has to be build on save or it has to be built at all to get this kind of error showing in the editor?

@akhildevelops
Copy link

After enabling buildOnSave I get all warnings and errors without saving the file.

@grab-a-byte
Copy link
Author

@akhildevelops are you on linux or Mac? I'm on windows (something I probabaly should've mentioned earlier.)

@akhildevelops
Copy link

On Linux, why would that matter ?

@grab-a-byte
Copy link
Author

I just know sometimes tooling is worse on windows that other OS's which I've had experience before and could be something windows specific that means this setting isn't working for my setup. Just trying to narrow down possible causes.

@ghost
Copy link

ghost commented Jun 1, 2024

I just know sometimes tooling is worse on windows that other OS's which I've had experience before and could be something windows specific that means this setting isn't working for my setup. Just trying to narrow down possible causes.

Based on my experimentation, it's possible that you have zig.buildOnSave turned on.
Actually you need to enable zig.zls.enableBuildOnSave to get the error message.

My English is not very good, the above is translated by Deelp.

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

No branches or pull requests

3 participants