Skip to content

lsp: Add clangd readonly token modifier to semantic token rules to highlight constant variables as constant#49065

Merged
Veykril merged 1 commit intozed-industries:mainfrom
ozacod:feat/clangd-readonly
Mar 16, 2026
Merged

lsp: Add clangd readonly token modifier to semantic token rules to highlight constant variables as constant#49065
Veykril merged 1 commit intozed-industries:mainfrom
ozacod:feat/clangd-readonly

Conversation

@ozacod
Copy link
Copy Markdown
Contributor

@ozacod ozacod commented Feb 12, 2026

Clangd uses the "readonly" token modifier instead of "constant". Therefore, "readonly" should be mapped to highlight constant variables as constants.

Before:
before

After:
after

  • Code Reviewed
  • Manual QA

Release Notes:

  • Added clangd readonly token modifier to semantic token rules to highlight constant variables as constant.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 12, 2026
@maxdeviant maxdeviant changed the title lsp: Add clangd readonly token modifier to semantic token rules to highlight constant variables as constant. lsp: Add clangd readonly token modifier to semantic token rules to highlight constant variables as constant Feb 12, 2026
@ozacod
Copy link
Copy Markdown
Contributor Author

ozacod commented Feb 12, 2026

Do you have any plan to add language specific semantic_tokens.json in the future? @Veykril

Btw, thanks for the incredible work.

@Veykril
Copy link
Copy Markdown
Member

Veykril commented Feb 20, 2026

Sorry for the late reply, for builtin languages we already have that, you can take a look at how rust does it, it has its own json rules file. So we can do the same clangd here

@ozacod
Copy link
Copy Markdown
Contributor Author

ozacod commented Mar 15, 2026

Sorry for the late reply, for builtin languages we already have that, you can take a look at how rust does it, it has its own json rules file. So we can do the same clangd here

I changed the code to add this rule to c++ semantic rules file.

@ozacod ozacod closed this Mar 15, 2026
@ozacod ozacod reopened this Mar 15, 2026
@ozacod ozacod force-pushed the feat/clangd-readonly branch from 9829e35 to 83059af Compare March 15, 2026 22:20
Copy link
Copy Markdown
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Veykril Veykril enabled auto-merge (squash) March 16, 2026 07:23
@Veykril Veykril merged commit e5a69d8 into zed-industries:main Mar 16, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants