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 semantic tokens inside when satements #467

Open
thetarnav opened this issue Aug 6, 2024 · 6 comments
Open

No semantic tokens inside when satements #467

thetarnav opened this issue Aug 6, 2024 · 6 comments

Comments

@thetarnav
Copy link
Contributor

when ODIN_DEBUG {
	Foo :: struct {a, b, c: int}
	foo := Foo{}
}

Foo should have a struct or type semantic token, like it does outside of when statements.

@DanielGavin
Copy link
Owner

DanielGavin commented Aug 12, 2024

It's because there is no when stmt resolver. I would argue if the resolver returns false, then this should actually be grayed out.

@thetarnav
Copy link
Contributor Author

I would argue the opposite actually, ols can't know what it will resolve to, it has to account for both cases.
ODIN_DEBUG will sometimes be true and sometimes false, depending on which build script I run. I don't have two editors open, one for debug and one for normal. I work on both at the same time, as should ols imo.
Same for targets, if my project has both a cli and a browser game components, I don't want to "switch" between those.

@DanielGavin
Copy link
Owner

DanielGavin commented Aug 12, 2024

You still have to switch. Since if you want to use odin check it needs to know what your flags are. Otherwise it can give compiler errors.

@DanielGavin
Copy link
Owner

DanielGavin commented Aug 12, 2024

The default will be through profile defines.

I can add a config to go through all when stmt regardless, but just remember if you declare variables in both those whenclauses it'll go funky.

when ODIN_DEBUG {
  my_value: i32
}
else {
  my_value: i64
}

@thetarnav
Copy link
Contributor Author

You'd just see i64 instead of i32 in some cases. The flip side is not getting any lsp help where the target doesn't match.

Even if odin check is stuck at one target, ols can still be helpful, just like it is in _test files currently. I don't see compile errors there, but can still use autocomplete.

@DanielGavin
Copy link
Owner

I'll add a config for it either way. There are people that want one or the other.

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

2 participants