Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Start using and suggesting standardized Tree-sitter highlights captures #22193

Closed
1 task done
uncenter opened this issue Dec 18, 2024 · 0 comments
Closed
1 task done

Comments

@uncenter
Copy link
Contributor

uncenter commented Dec 18, 2024

Check for existing issues

  • Completed

Describe the feature

Zed currently uses non-standard captures in its builtin extensions/languages and themes, which has led to community language and theme extensions doing so as well. This is detrimental, as the non-standard subset of keywords Zed uses limit the precision of Tree-sitter highlighting. (This is distinctly different from #9656, where the injection captures are different in a manner that is actually breaking for Zed.) Standardized keywords can be found from https://neovim.io/doc/user/treesitter.html#treesitter-highlight-groups and some from https://docs.helix-editor.com/themes.html#scopes.

  1. Zed's documented list of captures - https://zed.dev/docs/extensions/languages#syntax-highlighting - should be updated/expanded, or refer to other sources (such as the ones I linked previously).
  2. Zed's builtin themes (this repository) should add support for more detailed captures.
  3. Zed's builtin languages (in both crates/languages/ and in extensions/) should copy over queries from https://github.com/nvim-treesitter/nvim-treesitter/tree/master/queries where possible, which are - in most cases - significantly better than what exists so far in Zed.
  4. Some sort of notice should be provided to theme authors that they should support these new/different captures now being used.
    • I've done some analysis with a tool I've built for analyzing Zed extensions' support by themes and usage by languages of certain captures, and unfortunately literally only 3 extensions support captures like keyword.type.

For the most part, 1) and 3) can be achieved somewhat easily. The docs update is small, and there aren't too many language extensions to begin with in this repository. However 2) and 4), theme support, is trickier - we don't want syntax highlighting regressions (which could occur by improving the captures without theme support), only improvements. I don't know where to begin updating Zed's builtin themes, and I'm not sure there exists a good way to announce changes like this to extension authors.

Some anecdotal? evidence of this:

Examples of improvements via adopting nvim-treesitter queries:

Zed Version and System Specs

N/A

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

No response

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants