Add syntax highlighting for project symbol search#188
Open
da-r-k wants to merge 1 commit intozed-extensions:mainfrom
Open
Add syntax highlighting for project symbol search#188da-r-k wants to merge 1 commit intozed-extensions:mainfrom
da-r-k wants to merge 1 commit intozed-extensions:mainfrom
Conversation
Implement `label_for_symbol` to provide syntax-highlighted labels in the
project symbol picker (cmd-t). Without this, Java symbols appear as
plain grey text.
Each symbol kind generates a Tree-sitter-parseable code snippet wrapped
in the appropriate context (e.g. methods/fields inside `class _ { }`)
so the Java grammar can produce correct AST nodes for highlighting.
Supported symbols:
- Class, Interface, Enum: keyword prefix + name
- Method/Function: return type + name + params (Java declaration order)
- Constructor: name + params
- Field/Property: type + name (Java declaration order)
- Constant, EnumMember, Variable: highlighted name
- Package/Module/Namespace: keyword prefix + name
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
We require contributors to sign our Contributor License Agreement, and we don't have @da-r-k on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
Author
|
@cla-bot check |
|
We require contributors to sign our Contributor License Agreement, and we don't have @da-r-k on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
The cla-bot has been summoned, and re-checked this pull request! |
Author
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
label_for_symbolto provide syntax-highlighted labels in the project symbol picker (cmd-t). Currently, Java symbols appear as plain grey text with no highlighting, unlike Rust and other languages that already implement this.Ref: zed-industries/zed#36383, zed-industries/zed#37176
Changes
label_for_symbolto theExtension for JavaimplSymbolandSymbolKindfrom the extension APIclass _ { }since Java's Tree-sitter grammar requires class context for these declarationsvoid doWork(String, int),String fieldNameclass,interface,enum,packageSupported symbol kinds
class MyClassclass MyClass {}interface Runnableinterface Runnable {}enum Statusenum Status {}MyClass(String, int)class MyClass { MyClass() {} }void doWork(String, int)class _ { void doWork() {} }String nameclass _ { String name; }MAX_SIZEclass _ { static final int MAX_SIZE; }ACTIVEenum _ { ACTIVE }countclass _ { int count; }package com.examplepackage com.example;Screenshot: