DanielGavin / ols

Language server for Odin
MIT License
439 stars 67 forks source link

Add a symbol for explicit `enum.member` selectors #376

Closed thetarnav closed 5 months ago

thetarnav commented 5 months ago

I noticed that Enum.Enum_Member expressions weren't highlighted properly. Turns out that they weren't added to the symbols map, unlike package.value and others. So I "fixed" that. But returning a SymbolEnumValue for the member is probably wrong, it may need it's own symbol value. Especially since go to definition goes to the whole declaration, not specific member. I can switch it to "patch" it in semantic_tokens, instead, similarly to how implicit selectors are handled. But thats also wrong, because .Not_Actually_A_Enum_Member shouldn't get the semantic highlighting.

I think that ideally, the whole semantic tokens functionality should just be handled by looping over the symbols map and writing those, instead of walking the ast, which was already walked by the analyzer.

Also removed the selector field from builder, it looks unused now.

DanielGavin commented 5 months ago

Yeah potentially we need a symbol for the enum value. Yes the symbol resolving for references and semantic tokens should eventually be enough that we could just walk the symbols, and just leave everything else to the client syntax highlighter.