zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.73k stars 3.14k forks source link

Support LSP Semantic Tokens #7450

Open marwan-at-work opened 9 months ago

marwan-at-work commented 9 months ago

Check for existing issues

Describe the feature

Semantic Tokens allow for extra helpful highlighting that the language server might have better context over.

For example, in Go many things are well highlighted via Semantic Tokens which are all explained here.

My personal favorite is being able to see formatting directives easily in strings:

Screenshot 2024-02-06 at 12 59 11 PM

which is not currently supported in zed:

Screenshot 2024-02-06 at 1 03 02 PM

Thanks!

If applicable, add mockups / screenshots to help present your vision of the feature

No response

JosephTLyons commented 9 months ago

These are different requests, but this one feels like its in a similar category:

filiptibell commented 9 months ago

I've been trying to port my custom One Dark theme to Zed, everything went pretty smoothly, except for more complex code. Unfortunately some sections end up being almost unreadable compared to VSCode, where semantic tokens are available. VSCode on the top, and Zed on the bottom:

note how customizations are missing for mutable, macros, and enum members.

Here's another example of mutable vs non mutable semantic token highlighting:

more useful than one might initially think since it applies to variables / parameters and method calls.

It would also be neat if semantic tokens in Zed supported rules the same way VSCode does using globs/stars ("*.mutable": "#aabbcc") but that's not as important.

DotRed108 commented 6 months ago

bump

michaelangeloio commented 4 months ago

This is the only blocker for me

7jrxt42BxFZo4iAnN4CX commented 4 months ago

This really helps to navigate the code. We are waiting impatiently.

"editor.tokenColorCustomizations": {
"comments": "#9D9D9D",

"textMateRules": [
    {
        "name": "Rust function definition name",
        "scope": [
            "meta.function.definition.rust entity.name.function.rust",
        ],
        "settings": { "foreground": "#FF90F0" }
    },
    {
        "name": "Rust function definition params",
        "scope": [

            "meta.function.definition.rust variable.other.rust",
            "meta.function.definition.rust keyword.operator.key-value.rust",
            "meta.function.definition.rust punctuation.brackets.round.rust",
        ],
        "settings": { "foreground": "#F06BDD" }
    },
],
},
DotRed108 commented 4 months ago

bump

lylythechosenone commented 1 month ago

Is anybody working on this? It is genuinely the only thing stopping me from daily driving zed.

xpe commented 1 month ago

Is anybody working on this? It is genuinely the only thing stopping me from daily driving zed.

First, I understand that people want their top bug squashed or feature implemented. But when this kind of level of intensity shows up in bug reports, it can be hard for many of us to take at face value. Is this really a deal-breaker issue? How much of it is exaggeration?

So, for those that feel strongly about this issue, please help me understand:

(Caveat: I'm not with the Zed organization.)

lylythechosenone commented 1 month ago

Gladly.

why is this bug a high priority?

First, I wouldn't call it a bug, but a missing and much-needed feature. Regardless, semantic tokens are an important feature for a few reasons:

what are the sub-components of the problem? (is this issue blocked by something else?)

I am not familiar with Zed's internals, but the language server provides semantic tokens (if supported). It would be a matter of replacing tree-sitter highlighting with semantic tokens whenever they are available. I don't think anything is blocking this.