-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
Semantic tokens features trackList #3931
Comments
Thanks for working on this feature! I gave it a quick try in SublimeText on https://github.com/Bodigrim/cabal-add/blob/a83c827e45eeaed722d63f08a4c1bfd183770e97/src/Distribution/Client/Add.hs#L189: |
The current implementation highlights type synonyms differently to datatypes. So It's a bit funny that you get the same colour for |
Yeah, that's very confusing, especially given how ubiquitous |
Thank you for testing it out. @Bodigrim say if we want the color scheme to not distinguish between a normal datatype with a type synonyms. ===================================================== =====================================================
Also I was thinking🤔, maybe we can also make the |
(Possibly we should split this off into another issue) Worth pointing out that type synonyms are highlighted as "type" and in this case the difference is because datatypes get a special highlighting.
Generally we try pretty hard to avoid configuration. It's usually much better if we can find something that's universally acceptable. I guess I could maybe be convinced to have settings for each thing where we have a choice of a specific or generic token type, e.g. "special highlighting for type synonyms: y/n", and if it's off then we use the generic one (e.g. "just a type"). We could let people pick exactly the LSP semantic token type for each thing but that's probably overkill. We do already have a configuration switch here: it's whether or not you have semantic tokens on or off. If you turn semantic tokens on, you should probably expect it to make some fine distinctions that aren't obvious to you at first sight. So a different question is "how do we make this discoverable?". Perhaps in this instance having the options would serve a double function: it tells you what kinds of things we distinguish, and then you can fiddle with it to see what it does. Having written all that I guess I've convinced myself that we should have options. Especially since a lot of the things semantic tokens lets you do are quite opinionated and specific, which some people will inevitably dislike (e.g. I bet people will complain about the different highlighting of things of function type). |
I split off another issue for discussing the configuration issue: #3937 |
@soulomoon a couple of minor things that we still need to do:
|
@michaelpj thanks for sort it out. do it in #3938 |
A possible concern: there is a I think we could maybe fix this universally in
|
I actaully don't know if we'll emit multi-line tokens today already, do you know @soulomoon ? I guess we probably don't, since all the stuff we recognize today can't be split over multiple lines anyway. |
no we do not support them yet. |
I made an issue for doing something helpful in lsp: haskell/lsp#545 |
pretty cool! do you think it would be somehow possible to highlight parameters to a function? I could not figure out how that would work, i.e. that in f = \x -> x y z
|
There is a
I think either is plausible, I think @soulomoon just picked one. I guess on reflection |
Since we do have class and not to match class with class is rather confusing. We won't have a perfect match on Haskell token vs default token. So we actually make it configurable. So you can pick the matches that suit your color scheme. @MangoIV |
surely, yes, but I wonder what would happen if someone would program in both haskell and an object oriented language :D (I know even then you can configure it but perhaps we should optimize for the stock experience :P) |
Yes, since haskell do have class term, it is a trade-off between prioritizing haskell term vs prioritizing object oriented language term. As a language server for haskell, I think the choice would be obvious? Although for the ones without default token, we are compromising by projecting them. For the |
This seems to suggest that it's meant for both.
Here is an example of how the text editor deals with multiple types for the same token. So perhaps it's o.k. to emit both variable and parameter types for the same token? |
@rumkeller AFAIK, VSCode would consider them as overlapping token which they do not support. |
You're right -- it seems there can indeed be only one token type (though several modifiers). Apologies for the confusion. So one has to choose between variable, function, and parameter. FWIW, here is what clangd does:
|
These are non-specified modifiers, right? Do any clients check for them? (Generally it's a bit sad that we don't have an easy way to agree on extensions to the list of modifiers...) |
Indeed they're not mentioned in the spec.
Neovim exposes the modifiers verbatim to the color scheme -- quite easy to adjust, though the default scheme appears to not be aware of them. |
Semantic highlighting would give us a great experience on reading the code. It's been a shame that haskell does not have it for all these times. But now we are going to make it happen for haskell in HLS. (Thank @michaelpj for his pull request that support it in lsp package), first version of semantic tokens have been made in this pull request. (Thank @michaelpj @wz1000 for all the help and reviews. )
But since the amount of works it need , not everything in the LSP semantic tokens specification is supported yet, we would do them step by step.
Here is the track list of features.
multilineTokenSupport, overlappingTokenSupport
The text was updated successfully, but these errors were encountered: