ols
ols copied to clipboard
No semantic tokens inside `when` satements
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.
It's because there is no when stmt resolver. I would argue if the resolver returns false, then this should actually be grayed out.
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.
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.
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
}
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.
I'll add a config for it either way. There are people that want one or the other.