Commit Graph
915 Commits
Author SHA1 Message Date
Xin Zhao e0881e38f9 python: Add label_for_symbol for ty adapter (#51355)
Ported `label_for_symbol` logic directly from the basedpyright adapter
without adjustments.

Given Python's dynamic nature, the current implementation provides
sufficient coverage. No further modifications are needed for now.

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed missing syntax highlighting in symbol search when using the ty
language server.
2026-03-12 13:24:51 +01:00
Smit BarmaseandChristopher Biscardi f627c43ea1 languages: Prevent bsn macro from injecting rust layer (#51353)
Closes https://github.com/zed-industries/zed/issues/51240

We don’t parse bsn as embedded Rust anymore. We expect bsn to get its
own Tree-sitter implementation in the future, which should improve this.
This fixes broken syntax highlighting for string literals. See line 66
in the comparison below.

<img width="2560" height="1440" alt="image"
src="https://github.com/user-attachments/assets/230ae057-f315-4290-8f51-bcd21e6557d7"
/>

Release Notes:

- N/A

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-03-12 11:49:32 +05:30
Jack 4507210922 languages: Exclude angle brackets from rainbow bracket colorization for TSX (#51311)
## Summary

Angle brackets in TSX (`<`, `>`, `/>`, `</`) are always paired with JSX
tag syntax — they don't indicate bracket nesting depth — so rainbow
colorization adds noise without useful information.

This mirrors #46808, which applied the same fix to the HTML extension.

## Changes

- Added `(#set! rainbow.exclude)` to all three angle bracket patterns in
`crates/languages/src/tsx/brackets.scm`

## Before / After

Before: angle brackets in JSX tags receive rainbow colors alongside
`{}`, `()`, `[]`, making every tag visually noisy.

After: only `{}`, `()`, and `[]` receive rainbow colors — angle brackets
are excluded, matching the HTML extension behavior.

> Screenshots: I don't have a built copy of Zed handy to attach — happy
to add one if a maintainer needs it before merging.

Release Notes:

- Removed rainbow bracket colorization for angled brackets within TSX.
2026-03-11 17:55:15 +00:00
Kyle Kelley c08fd438ec languages: Validate pylsp binary before returning from check_if_user_installed (#51034)
Run `pylsp --version` via `delegate.try_exec()` in both branches of
`PyLspAdapter::check_if_user_installed` before returning the binary. If
execution fails (broken shebang, missing interpreter, etc.), log a
warning and return None so the system falls through gracefully instead
of surfacing an error dialog.

This matches the existing validation pattern used by TyLspAdapter and
RuffLspAdapter in their `fetch_server_binary` implementations.

No idea if this closes an issue but it sure was annoying on a system
where I deleted the pylsp environment I had. It surprised me too since I
had pylsp disabled in settings.

Release Notes:

- Fixed detection of when `pylsp` is not installed properly on a user's
system so that it doesn't get launched as an LSP when it doesn't exist.
2026-03-11 09:12:18 +01:00
Justin Su 7132b67962 Normalize line_comments strings to have a trailing space (#51033)
I did a search for `/^line_comments = .*[^\s\[]"/` to identify these 3
languages:

- Git Commit
- Go Mod
- Go Work

that don't add/remove a trailing space for inline comments. I couldn't
find any indication that the absence of the trailing space is due to any
peculiarity of these languages.

---

For Git Commit, I should note that (strictly speaking) the comment
character is a single `#` without a trailing space, as Git removes any
line starting with the default comment character (`#`) (see
https://git-scm.com/docs/git-config#Documentation/git-config.txt-corecommentChar).

But I believe this change only affects whether `editor::ToggleComments`
adds/removes the space, and not how the file is syntax highlighted. So
for aesthetics and consistency, it should be better to add/remove the
trailing space.

---

Before you mark this PR as ready for review, make sure that you have:

- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Add/remove a space when toggling inline comments in Git Commit and Go
Mod/Work languages
2026-03-10 19:41:24 +00:00
Piotr Osiewicz 97421c670e Remove unreferenced dev dependencies (#51093)
This will help with test times (in some cases), as nextest cannot figure
out whether a given rdep is actually an alive edge of the build graph

Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A
2026-03-09 13:22:12 +01:00
Xin Zhao a70c295658 python: Fix conda environment not auto-activated in remote terminal (#50895)
Closes #50619

In the conda activation script building procedure, Zed currently
performs a file check for the conda executable on the client side. When
in remote development, this check always fails because the file exists
on the remote host, not the local machine. Since `pet` already handles
existence checks, removing this redundant check allows the activation to
proceed. It is also better to let any potential issues (like
permissions) show up in the terminal rather than silently skipping the
activation.

This addresses the root cause for remote development, which is different
from the approach in #50715 that focuses on shell hooks.

**The video recording**


https://github.com/user-attachments/assets/62967351-e3c5-4814-aec4-b2332940e7e3

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed conda environment not auto-activating in the terminal during
remote development sessions.
2026-03-06 07:51:30 +00:00
Nianyu Shen c0f5d21a88 lsp: Add semantic token rules for Go (#50641)
gopls reports Go `const` declarations as `variable` with the `readonly`
modifier. Add a Go-specific semantic token rule to map this to the
`constant` theme style, matching VS Code's behavior.

<img width="465" height="32" alt="image"
src="https://github.com/user-attachments/assets/e0bc8a60-2275-4f81-9185-8b86c51d3d08"
/>

Closes #50642

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-04 21:41:47 -07:00
moleium de107768b1 Add .cppm (C++20 module interface) to C++ file extensions (#50667)
`.cppm` is the widely used extension for C++20 module interface units,
supported by MSVC, Clang, and GCC. Currently Zed doesn't recognize it as
C++, so users get no syntax highlighting or LSP support.

Changes:
`crates/languages/src/cpp/config.toml`: add cppm to path_suffixes
`crates/theme/src/icon_theme.rs`: add cppm to the C++ icon matcher

https://github.com/search?q=path%3A*.cppm&type=code

Release Notes:

- N/A
2026-03-04 10:30:33 +00:00
Xin Zhao cdb34c30c9 python: Register LSP adapters directly to the LanguageRegistry (#50662)
The purpose of `register_available_lsp_adapter()` is to allow language
servers to be reused across multiple languages. Since adapters like
`ty`, `pylsp`, and `pyright` are specific to Python, there is no need to
register them for other languages. Additionally, registering them
directly to the global `LanguageRegistry` results in negligible resource
consumption.

We can then use the default settings to control the default language
server for Python, as referenced here:


https://github.com/zed-industries/zed/blob/9c9337a8021f74511625517c3f4fa021106609eb/assets/settings/default.json#L2119-L2130

Additionally, the documentation for Python has been updated to clarify
that the `"..."` syntax does not mean "keep the rest at default," but
rather "include all other available servers."

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing (no sure how to add test for this)
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-04 07:31:27 +00:00
Lukas Wirth 2b774e5cd2 extension_host: Allow extensions to define semantic highlighting rules (#49282)
for their given language via a `semantic_token_rules.json` file

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-02 17:54:53 +01:00
Finn Evers 6a14388d38 languages: Add support for passing user settings to Go LSP adapter (#50472)
Closes https://github.com/zed-industries/zed/issues/50276

Release Notes:

- Added support for specifying settings for the Go LSP adapter
2026-03-02 09:33:48 +00:00
Finn Evers 5ed538f49c Format Tree-sitter queries with ts_query_ls (#50138)
Release Notes:

- N/A
2026-02-27 12:49:45 +00:00
Kunall Banerjee 1c39e192f1 languages: Reorder type identifier highlights in JavaScript (#49325)
Move general type identifier rules before class-specific ones to ensure
proper precedence in the syntax highlighting query.

Closes #49226.

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed an issue where class names were not highlighted correctly in
JavaScript files
2026-02-27 03:14:40 +00:00
Kunall Banerjee e8325318a0 languages: Add .prettierrc to JSON path_suffixes (#50156)
`.prettierrc` can be [written](https://prettier.io/docs/configuration)
in either JSON or YAML. Whether you write JSON or YAML, VS Code will
default to recognizing it as JSON. See screenshot.

Without this change, the user is forced to do:

```jsonc
"file_types": {
  "JSON": [".prettierrc"],
},
```

Small QoL improvement.

| VS Code | Zed (after the changes) |
|--------|--------|
| <img width="1732" height="1125" alt="image"
src="https://github.com/user-attachments/assets/1f9533fc-a77a-40f3-b8a5-6c36faeccffd"
/> | <img width="1732" height="1125" alt="image"
src="https://github.com/user-attachments/assets/bef8ca94-006c-44bd-ac1c-59f915b67123"
/> |

Closes #50072.

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Added `.prettierrc` to JSON `path_suffixes`
2026-02-26 17:07:25 +00:00
Finn Evers ff83f08243 python: Fix warning in injections query (#49397)
Release Notes:

- N/A
2026-02-25 16:46:27 +01:00
Xin Zhao bc023b3f80 languages: Improve completion sorting for Python-based LSPs (#47160)
Closes #47086

This PR detects completion items ending with `=` (which typically
represent keyword arguments in function calls provided by
`Pyright`/`BasedPyright`/`pylsp`) and assigns them the highest sorting
priority.

This ensures that when a user is filling out function arguments, the
named parameters appear at the top of the list, rather than being buried
mixed with other symbols.

After fix:
<img width="786" height="460" alt="image"
src="https://github.com/user-attachments/assets/75e94b0f-a2e7-4876-b9bd-02ad98cc8c50"
/>


> **Note on Sorting:** Currently, these named arguments will be sorted
alphabetically by label. Preserving the original order of the function
definition would be ideal, but it requires information not currently
available in this logical block. Insights on how to retrieve the
definition order would be appreciated.

> **Note on other LSPs:** 
> * **`ty`**: Already provides well-sorted completions natively, so no
intervention is required.

Release Notes:

- Improved completion order for Python-based LSPs
2026-02-25 19:07:54 +05:30
Avi Fenesh 938b8ab746 languages: Add .mdc as a recognized Markdown file suffix (#50074)
Highlight files ending in `.mdc` as Markdown.

The `.mdc` extension is used by Cursor for its Markdown-based rule files
(`.cursor/rules/*.mdc`). These files are standard Markdown with optional
YAML frontmatter, which the existing Markdown grammar already handles
well. Adding `.mdc` to the recognized suffixes ensures proper syntax
highlighting out of the box.

This was requested during review of the agnix extension PR
([zed-industries/extensions#4743](https://github.com/zed-industries/extensions/pull/4743))
by @MrSubidubi as the preferred approach over defining a custom MDC
language in an extension.

Release Notes:

- Added `.mdc` as a recognized Markdown file extension.
2026-02-25 10:41:24 +00:00
Brett Schneider d54a262436 languages: Add syntax highlighting for HTML character references (#48629)
HTML character references like `&middot;`, `&apos;`, and `&#123;` are
correctly parsed by tree-sitter as named nodes
(`html_character_reference` in TSX/JavaScript, `entity` in HTML), but no
highlight query captures them. This means they render as plain,
unhighlighted text in the editor.

This PR adds one-line highlight captures for each:

- **TSX** (`crates/languages/src/tsx/highlights.scm`):
`(html_character_reference) @string.special`
- **JavaScript** (`crates/languages/src/javascript/highlights.scm`):
`(html_character_reference) @string.special`
- **HTML** (`extensions/html/languages/html/highlights.scm`): `(entity)
@string.special`

`@string.special` is already styled by all built-in themes (One Dark,
Ayu, Gruvbox, etc.), so no theme changes are needed.

Release Notes:

- Added syntax highlighting for HTML character references (`&middot;`,
`&apos;`, `&#123;`, etc.) in TSX, JavaScript, and HTML files.
2026-02-22 23:40:18 -05:00
Tomas Virgl 712914a1f7 go: split definition and call highlights for functions, methods, and types (#49120)
This allows definitions to use a different highlight than function
calls.

Release Notes:

- go: Add definition highlights for functions, methods, and types
2026-02-19 15:53:33 +00:00
ozacodandozacod 3335a9b993 languages: Fix C++ indentation for multi-line declarations and assignments (#47447)
Before:
<img width="726" height="86" alt="indentation-problem"
src="https://github.com/user-attachments/assets/50330c66-26ac-4cb0-9f26-8ee73ec6c64d"
/>

After:
<img width="811" height="102" alt="after"
src="https://github.com/user-attachments/assets/8704bd83-b626-4b6d-8ff9-50edd6f065db"
/>

Release Notes:

- Fixed indentation problem with multi-line declarations and assignments
in C++

---------

Co-authored-by: ozacod <ozacod@users.noreply.github.com>
2026-02-17 00:48:59 +05:30
Matt Riggott 2c097ef09e Add automatic syntax highlighting for GeoJSON files (#49261)
GeoJSON is a popular geospatial data interchange format, standardised as
[RFC 7946](https://datatracker.ietf.org/doc/html/rfc7946). Because all
GeoJSON files are valid JSON files, they can be highlighted using Zed's
existing JSON language support.

This change adds `geojson` as a recognised path suffix, so GeoJSON files
automatically open as JSON and get the standard JSON syntax
highlighting.

Before and after screenshots:

<img width="1748" height="755" alt="geojson"
src="https://github.com/user-attachments/assets/40199248-1ce5-451e-9200-5b2f012b865f"
/>

Release notes:

- Added automatic syntax highlighting for GeoJSON files
2026-02-16 13:30:22 +00:00
Xiaobo Liu 144dd9302b python: Prevent shell command injection in conda environment activation (#49160)
Release Notes:

- Fixed prevent shell command injection in conda environment activation

The conda environment name was directly interpolated into the shell
command without proper escaping, which could allow command injection
if the environment name contained malicious shell metacharacters.

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
2026-02-14 08:08:38 +00:00
Jakub KonkaandCole Miller 16dfc60ad2 util: Always use posix_spawn on macOS even with pre_exec hooks (#49090)
Here's some backstory:
* on macOS, @cole-miller and I noticed that since roughly Oct 2025, due
to some changes to latest macOS Tahoe, for any spawned child process we
needed to reset Mach exception ports
(https://github.com/zed-industries/zed/issues/36754 +
https://github.com/RemiKalbe/zed/commit/6e8f2d2ebe5a93753625a3026aeb996de8cb436b)
* the changes in that PR achieve that via `pre_exec` hook on
`std::process::Command` which then abandons `posix_spawn` syscall for
`fork` + `execve` dance on macOS (we tracked it down in Rust's std
implementation)
* as it turns out, `fork` + `execve` is pretty expensive on macOS
(apparently way more so than on other OSes like Linux) and `fork` takes
a process-wide lock on the allocator which is bad
* however, since we wanna reset exception ports on the child, the only
official way supported by Rust's std is to use `pre_exec` hook
* posix_spawn on macOS exposes this tho via a macOS specific extension
to that syscall `posix_spawnattr_setexceptionports_np` but there is no
way to use that via any standard interfaces in `std::process::Command`
* thus, it seemed like a good idea to instead create our own custom
Command wrapper that on non-macOS hosts is a zero-cost wrapper of
`smol::process::Command`, while on macOS we reimplement the minimum to
achieve `smol::process::Command`  with `posix_spawn` under-the-hood

Notably, this changeset improves git-blame in very large repos
significantly.

Release Notes:

- Fixed performance spawning child processes on macOS by always forcing
`posix_spawn` no matter what.

---------

Co-authored-by: Cole Miller <cole@zed.dev>
2026-02-13 20:16:11 +01:00
ozacodandozacod 9c102a5675 languages: Add runnable support for bash (#48807)
Bash:
<img width="469" height="149" alt="bash"
src="https://github.com/user-attachments/assets/179c9157-58b4-49a3-a166-78486eee5334"
/>

Bash output:
<img width="319" height="77" alt="bash_output"
src="https://github.com/user-attachments/assets/2f5f6582-8538-4508-81cc-84007779d359"
/>

Zsh:
<img width="414" height="139" alt="zsh"
src="https://github.com/user-attachments/assets/23cbb61c-6af1-4956-91a6-39d00319d4fc"
/>

Zsh output:
<img width="326" height="69" alt="zsh_output"
src="https://github.com/user-attachments/assets/beb76f68-fb0c-4140-91ea-bf66a50294fc"
/>

Dash:
<img width="343" height="121" alt="dash"
src="https://github.com/user-attachments/assets/47f44fda-2130-4076-9f65-12c5b1094a53"
/>

Dash output:
<img width="343" height="75" alt="dash_output"
src="https://github.com/user-attachments/assets/176459a2-9dd7-4bd9-8a3d-a7fe39d3b7c3"
/>

- [x] Code Reviewed
- [x] Manual QA

Release Notes:

- Added runnable support for bash.

Co-authored-by: ozacod <ozacod@users.noreply.github.com>
2026-02-12 18:46:43 +02:00
ozacodandozacod 1844b96c88 languages: Improve function parameter highlighting for Bash (#48067)
Before:
<img width="371" height="93" alt="before"
src="https://github.com/user-attachments/assets/f2e9ba9c-4ef7-4533-b565-9d977d60ae79"
/>

After: 
<img width="371" height="93" alt="after"
src="https://github.com/user-attachments/assets/b385f0bc-3b23-4a3c-8bf3-639afad10e1e"
/>

Release Notes:

- Improves function parameter highlighting for Bash

Co-authored-by: ozacod <ozacod@users.noreply.github.com>
2026-02-12 15:05:35 +02:00
Cole McAnelly 255ee7296d languages: Highlight case statements and special variables for Shell Scripts (#48200)
Part of https://github.com/zed-industries/zed/issues/9461. Similar PRs:
- https://github.com/zed-industries/zed/pull/46722
- https://github.com/zed-industries/zed/pull/39683
- https://github.com/zed-industries/zed/pull/39801


## Release Notes:

- Allowed highlighting for case statement items for users and theme
authors via the `string.regex` syntax property.
- Allowed highlighting for special variables via `variable.special`

## Screenshots

| **Before** | **After** |
|:--:|:--:|
| <img width="727" height="922" alt="image"
src="https://github.com/user-attachments/assets/15126713-1f02-40f2-8115-0deb5476aebd"
/> | <img width="742" height="900" alt="image"
src="https://github.com/user-attachments/assets/e178934e-5735-448d-abb2-2d2ad08a9c8f"
/> |
2026-02-12 15:01:56 +02:00
ozacodandozacod 81d01ef853 languages: Add shebang highlight support for Bash (#48064)
Highlights the shebang line as a directive instead of a comment.

Before:
<img width="316" height="99" alt="before"
src="https://github.com/user-attachments/assets/d77a7fbd-4610-4282-b48a-c994d37401b6"
/>

After:
<img width="316" height="99" alt="after"
src="https://github.com/user-attachments/assets/7861ba9e-f64d-45be-aa0a-9e98a82b3746"
/>

Release Notes:

- Added shebang highlight support for Bash

Co-authored-by: ozacod <ozacod@users.noreply.github.com>
2026-02-12 14:56:47 +02:00
Zhongqiu ZhaoandConrad Irwin 377407c2bb languages: Fix local path of JSON and YAML schemas (#44794)
Closes #30938

Release Notes:

- Fixed: Unable to load relative path JSON schema for YAML validation
(#30938)


This patch follows the vscode LSP client logic, see
[`jsonClient.ts`](https://github.com/microsoft/vscode/blob/cee904f80cc6d15f22c850482789e06b1f536e72/extensions/json-language-features/client/src/jsonClient.ts#L768-L770).
The `url` of the JSON schemas settings and the YAML schemas settings
should be resolved to an absolute path in the LSP client when it is
submitted to the server.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2026-02-12 04:50:54 +00:00
Daniel Strobusch 4f2a277a63 go: Add first-line pattern detection for executable Go scripts (#48913)
Add support for detecting Go files that can be executed directly via
shebang-style comments (e.g., '// usr/bin/env go run "$0" "$@"; exit
"$?"').

This allows Zed to recognize Go scripts with first-line comments
containing 'go run' as executable Go files, similar to how other
languages detect shebangs or mode lines.

Reference: https://stackoverflow.com/q/7707178/1458343

Release Notes:

- Improved: Go language detection now recognizes executable Go scripts
with first-line 'go run' comments.
2026-02-11 21:32:22 -07:00
MohibShaikh 8b5328cad3 Bump tree-sitter-go to v0.25.0 (#48870)
Fixes #48357

## Summary

- Bumps `tree-sitter-go` from `0.23` to `0.25`
- This fixes wrong syntax highlighting with chained indexing in Go (e.g.
`a[b][c] = 0` being incorrectly parsed as a type instantiation
expression instead of an index expression)
- The upstream fix
([tree-sitter/tree-sitter-go#160](https://github.com/tree-sitter/tree-sitter-go/issues/160))
landed in v0.25.0, which gives index expressions a higher dynamic
precedence over type instantiation expressions
- Updated `runnables.scm` to account for the new `statement_list` node
that wraps statements inside blocks in tree-sitter-go 0.25

## Test plan

- [x] `cargo test -p languages` — all 47 tests pass
- Verified that existing Go runnables queries (table tests, subtests,
test detection) work with the updated grammar

Release Notes:

- Fixed wrong syntax highlighting with chained indexing in Go (e.g.
`a[b][c]`) by bumping tree-sitter-go to 0.25
2026-02-10 13:47:29 +01:00
ozacodandozacod 61e575547c languages: Change syntax highlighting for C/C++ preprocessor directives (#48109)
This changes the highlight capture for preprocessor directives from
`@keyword.directive` to `@preproc` in both C and C++.

PR #44043 changed C from `@keyword` to `@keyword.directive` for
consistency with C++, but `@keyword.directive` is still semantically
wrong. Preprocessor directives are not language keywords — they are
instructions to a separate preprocessing phase that runs before
compilation.

Using `@preproc` reflects this distinction and allows themes to style
them independently from actual language keywords like `const`,
`struct`,`if`, etc. This is consistent with how editors like CLion
handle preprocessor directives.

Before:
<img width="710" height="653" alt="before"
src="https://github.com/user-attachments/assets/5c02fc06-bc19-4112-ae53-ad72eb8044e3"
/>

After:
<img width="710" height="653" alt="after"
src="https://github.com/user-attachments/assets/2490e796-7286-4fbb-81b0-387f551cde8f"
/>

Release Notes:

- C/C++: Syntax highlighting for preprocessor directives can now be
tweaked with @preproc capture group.

Co-authored-by: ozacod <ozacod@users.noreply.github.com>
2026-02-10 12:44:23 +01:00
Lev Zakharov 64c3e8a848 languages: Exclude TestMain from Go runnables (#46575)
Exclude special [TestMain](https://pkg.go.dev/testing#hdr-Main) function
from Go runnables.

Release Notes:

- Excluded `TestMain` function from Go runnables.
2026-02-10 09:12:55 +00:00
ozacod 2028f85546 languages: Fix block comment indentation for C/C++ (#47810)
Before:
<img width="426" height="128" alt="before"
src="https://github.com/user-attachments/assets/89f84f4b-4810-4d11-b8a2-c841d8506cef"
/>

After:
<img width="437" height="125" alt="after"
src="https://github.com/user-attachments/assets/a63c5265-8f1b-4926-a334-93effad22f2b"
/>

Release Notes:

- Fixed for block comment indentation problem for C/C++
2026-02-10 01:05:46 +01:00
ozacod 5ba3d6aa22 languages: Fix C/C++ outline for function definitions and declarations with mixed storage and type qualifiers (#47500)
Before:
<img width="1002" height="228" alt="before"
src="https://github.com/user-attachments/assets/94c5d0b7-a467-4bfe-8eaf-5a2c4b3cb7ea"
/>

After:
<img width="1002" height="228" alt="after"
src="https://github.com/user-attachments/assets/73d049d2-4dd1-40a4-ac21-984ca3fd32ee"
/>

Release Notes:

- Fixed C/C++ outline for function definitions and declarations with
mixed storage and type qualifiers.
2026-02-10 01:04:15 +01:00
feeiyu b2150a4f02 Fix incorrect first line detection for libstdc++ files (#48351)
https://github.com/zed-industries/zed/pull/48250#issuecomment-3846774856

To ensure the fix covers all affected files, I have checked all C++
files without extensions using the following command:
```bash
find /usr/include/c++ -type f | grep -v '.h' | grep -v '.cpp' | grep -v '.tcc' | xargs head -1 | zed -
```

<details>
  <summary>Click to expand images</summary>
<img width="940" height="935" alt="image"
src="https://github.com/user-attachments/assets/d0346ad4-d9f7-47d5-a85e-cb574dacf290"
/>

<img width="956" height="939" alt="image"
src="https://github.com/user-attachments/assets/d9e872fc-f2b8-4fff-b5a9-99e8a4fc21a3"
/>

<img width="953" height="940" alt="image"
src="https://github.com/user-attachments/assets/dee53cd4-d598-4d65-918d-353b037cdf1b"
/>

<img width="956" height="938" alt="image"
src="https://github.com/user-attachments/assets/777b899c-db25-4dc8-b4a5-fafe28cc14a4"
/>

</details>

Release Notes:

- N/A
2026-02-10 01:02:23 +01:00
ozacod 28e743b4d6 languages: Add attribute highlighting in C++ (#47825)
Before:
<img width="587" height="360" alt="before"
src="https://github.com/user-attachments/assets/85989888-2fc0-43aa-87ca-01d2c3101484"
/>

After:
<img width="591" height="357" alt="after"
src="https://github.com/user-attachments/assets/9e1ceccf-7890-43f7-a0b9-938daa161d13"
/>

Release Notes:

- Added attribute highlighting in C++
2026-02-10 01:01:56 +01:00
Gaauwe Rombouts 6e5e6cf8a5 languages: Remove duplicate keywords in JS syntax highlighting (#48460)
Fixes an issue where syntax highlighting would be incorrect in certain
cases for JS, because of duplicate keyword definitions.

Release Notes:

- Fixed issue where certain keywords were incorrectly highlighted in JS
files
2026-02-05 12:23:39 +01:00
Lukas Wirth 1dca30e3a1 languages: Remove unnecessary unresolvedReference semantic token rule (#48448)
This prevents ast based highlighting in unconfigured code

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-02-05 08:19:36 +00:00
Shuhei KadowakiandMrSubidubi 4563b5ac4f lsp: Add container_name to lsp::Symbol (#46822)
Some language servers include local symbols (e.g., local variables,
parameters) in workspace symbol results. Without the `containerName`
information, these symbols lack context information, making it difficult
to distinguish them from top-level definitions and hindering efficient
symbol lookup.

This change exposes the `container_name` field from LSP
[`SymbolInformation`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolInformation)
to the extension API, allowing language server extensions to access
`symbol.container_name` in `label_for_symbol` and provide meaningful
context when rendering symbol labels.

Note: The `container_name `field is added to all extension API versions
because they seem to share the same underlying Rust types via wasmtime
bindgen. The field is optional, so existing extensions would remain
compatible as far as I understand.

Closes #ISSUE

Release Notes:

- Added `container_name` field to `lsp::Symbol`, accessible via the
extension API's `label_for_symbol` function

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
2026-02-04 23:03:15 +01:00
5d2feaa144 editor: Implement semantic highlighting (#46356)
Part of #7450

Big thanks to @macmv for pushing this forwards so much!

Rebased version of https://github.com/zed-industries/zed/pull/39539 as
working on an in-org branch simplifies a lot of things for us)

Release Notes:

- Added LSP semantic tokens highlighting support

---------

Co-authored-by: Neil Macneale V <neil.macneale.v@gmail.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-02-04 17:37:13 +00:00
Finn Evers 09fece9cb8 languages: Do not show Zed keybinding context in language selector (#48354)
This language is used for the keymap editor and should not be selectable
for normal files. Hence, removing it here from the language selector

Release Notes:

- Fixed an issue where the Zed keybinding context would show up as a
language in the language selector.
2026-02-04 13:14:12 +00:00
Kunall Banerjee 477069ef62 languages: Remove duplicate keywords in TSX syntax highlighting (#48196)
Closes #48178

Release Notes:

- Fixed issue where certain keywords were incorrectly highlighted in TSX
files
2026-02-03 14:55:26 -05:00
feeiyu 3f8bc2d4b7 languages: Add support for detecting libstdc++ headers (#48250)
https://github.com/zed-industries/zed/pull/47443#issuecomment-3834807752

Support detect libstdc++ headers

<img width="1335" height="830"
src="https://github.com/user-attachments/assets/4a8b8376-029b-41c5-a53b-d1a02a061818"
/>


Release Notes:

- N/A
2026-02-03 11:07:56 +00:00
Max Brunsfeld eae101f3c9 Revert "rust: Highlight enum variants as variant" (#48211)
Reverts zed-industries/zed#47918

Rationale:
https://github.com/zed-industries/zed/pull/47918#issuecomment-3837291864
2026-02-02 13:20:14 -07:00
Michael Yang 03663b966d rust: Highlight enum variants as variant (#47918)
Improve #45546, by changing the capture to be variant instead of type.

Release Notes:

- Improved Rust enum variant highlighting as variant instead of type.

Before (note variants have the same style as `Foo`):
<img width="276" height="162" alt="image"
src="https://github.com/user-attachments/assets/fa0d8f48-a286-4a8d-b89d-269cb1657e55"
/>

After:
<img width="276" height="162" alt="image"
src="https://github.com/user-attachments/assets/c442494a-7550-481a-a8b9-f2d944a67868"
/>
2026-01-31 09:52:05 +02:00
ozacodandozacod 4dde88cfe5 languages: Support double quoted keys in YAML highlights (#48063)
Before:
<img width="520" height="74" alt="before"
src="https://github.com/user-attachments/assets/5c010819-a20e-438e-b7f6-218b9f241070"
/>

After:
<img width="532" height="81" alt="after"
src="https://github.com/user-attachments/assets/51528d3b-439f-4fcf-9a7c-b06dec6a7e81"
/>

Release Notes:

- Improved YAML highlights to support quoted keys

Co-authored-by: ozacod <ozacod@users.noreply.github.com>
2026-01-30 19:57:04 -07:00
Joseph T. Lyons 72b151e3aa Revert "Allow always_allow patterns for Nushell, Elvish, and Rc shells" (#48050)
Reverts zed-industries/zed#47908

This PR inadvertently caused a regression:

- https://github.com/zed-industries/zed/issues/48047
2026-01-30 21:26:13 +00:00
Delyan Haralanov 04d878eef8 typescript: Fix type import highlighting when alias is not present (#47190)
## Problem
The existing tree-sitter queries for type imports required both name and
alias fields to match. This caused `import type { Foo }` and `import {
type Foo }` to fall back to the generic identifier/variable highlighting
instead of being colored as types.

- `import type { Foo }` → **NOT matched** (no alias)
- `import { type Foo }` → **NOT matched** (no alias)  
- `import type { Foo as Bar }` → Matched ✓
- `import { type Foo as Bar }` → Matched ✓

## Solution
Split the patterns to handle name and alias captures independently.

~## Disclaimer~
~DEBUGGING AND IMPLEMENTATION WAS DONE WITH **AI ASSISTANCE**.~
~**THE FIX HAS NOT BEEN TESTED** - I HAVE NOT COMPILED FROM SOURCE~
- @KyleBarton built from source and verified


Release Notes:

- Fixed typescript type import highlighting
2026-01-29 09:52:26 -08:00
Richard FeldmanandZed Zippy b7e11b38f4 Allow always_allow patterns for Nushell, Elvish, and Rc shells (#47908)
## Summary

This PR extends the `always_allow` tool permission patterns to work with
Nushell, Elvish, and Rc shells. Previously, these shells were
incorrectly excluded because they don't use `&&`/`||` operators for
command chaining. However, brush-parser can safely parse their command
syntax since they all use `;` for sequential execution.

## Changes

- Add `ShellKind::Nushell`, `ShellKind::Elvish`, and `ShellKind::Rc` to
`supports_posix_chaining()`
- Split `ShellKind::Unknown` into `ShellKind::UnknownWindows` and
`ShellKind::UnknownUnix` to preserve platform-specific fallback behavior
while still denying `always_allow` patterns for unrecognized shells
- Add comprehensive tests for the new shell support
- Clarify documentation about shell compatibility

## Shell Notes

- **Nushell**: Uses `;` for sequential execution. The `and`/`or`
keywords are boolean operators on values, not command chaining.
- **Elvish**: Uses `;` to separate pipelines. Does not have `&&` or `||`
operators. Its `and`/`or` are special commands operating on values.
- **Rc (Plan 9)**: Uses `;` for sequential execution and `|` for piping.
Does not have `&&`/`||` operators.

## Security

Unknown shells still return `false` from `supports_posix_chaining()`, so
`always_allow` patterns are denied for safety when we can't verify the
shell's syntax.

(No release notes because granular tool permissions are still
feature-flagged.)

Release Notes:

- N/A

---------

Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-01-29 06:08:05 +00:00