`RawSemanticTokens` says tokens later in the list override earlier ones on overlap, but there's no list to be later in — the tokens are stored in a `HashMap<LanguageServerId, _>` and the sort that flattens them keys only on `range.start`: https://github.com/zed-industries/zed/blob/1c2a643cde2345ff7beca0178aee617b1651e561/crates/project/src/lsp_store/semantic_tokens.rs#L702-L709 https://github.com/zed-industries/zed/blob/1c2a643cde2345ff7beca0178aee617b1651e561/crates/editor/src/semantic_tokens.rs#L312-L314 `sort_by` is stable, so two servers' tokens at the same position keep whatever order the map iteration gave them, and which one wins changes between sessions. You hit this any time two servers tokenize the same range. In my case a server that highlights an embedded query inside a string literal renders fine, then loses the range to svelte-language-server once that refreshes. Setting `languages.Svelte.language_servers` doesn't help, since that isn't what decides it. Breaking ties by `server_id` makes it deterministic. `SemanticTokenHighlight` already carries the id and `LanguageServerId` is `Ord`, so it's just the tiebreak. Worth noting the servers do arrive as an ordered `Vec` from `language_server_ids_for_buffer` and that order is dropped when they go into the `HashMap`. Sorting by id gets determinism but not that original order; if preserving it is what was intended I'm happy to submit a PR for that functionality instead. Release Notes: - Fixed semantic token highlighting being applied unpredictably when more than one language server provides tokens for the same range.
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).
Other platforms are not yet available:
- Web (tracking discussion)
Developing Zed
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
Zed source code is licensed primarily under GPL-3.0-or-later, with Apache-2.0 components where marked.
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Sponsorship
Zed is developed by Zed Industries, Inc., a for-profit company.
If you’d like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.