mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-25 14:44:28 +00:00
original uri https://github.com/zed-industries/zed
https://zed.dev
## Context / Related PRs This PR is the third part of the encoding support improvements, following: - #44819: Introduced initial legacy encoding support (Shift-JIS, etc.). - #45243: Fixed UTF-16 saving behavior and improved binary detection. ## Summary This PR implements a status bar item that displays the character encoding of the active buffer (e.g., `UTF-8`, `Shift_JIS`). It provides visibility into the file's encoding and indicates the presence of a Byte Order Mark (BOM). ## Features - **Encoding Indicator**: Displays the encoding name in the status bar. - **BOM Support**: Appends `(BOM)` to the encoding name if a BOM is detected (e.g., `UTF-8 (BOM)`). - **Configuration**: The active_encoding_button setting in status_bar accepts "enabled", "disabled", or "non_utf8". The default is "non_utf8", which displays the indicator for all encodings except standard UTF-8 (without BOM). - **Settings UI**: Provides a dropdown menu in the Settings UI to control this behavior. - **Documentation**: Updated `configuring-zed.md` and `visual-customization.md`. ## Implementation Details - Created `ActiveBufferEncoding` component in `crates/encoding_selector`. - The click handler for the button is currently a **no-op**. Implementing the functionality to reopen files with a specific encoding has potential implications for real-time collaboration (e.g., syncing buffer interpretation across peers). Therefore, this PR focuses strictly on the visualization and configuration aspects to keep the scope simple and focused. - Updated schema and default settings to include `active_encoding_button`. ## Screenshots <img width="487" height="104" alt="image" src="https://github.com/user-attachments/assets/041f096d-ac69-4bad-ac53-20cdcb41f733" /> <img width="454" height="99" alt="image" src="https://github.com/user-attachments/assets/ed76daa2-2733-484f-bb1f-4688357c035a" /> ## Configuration To hide the button, add the following to `settings.json`: ```json "status_bar": { "active_encoding_button": "disabled" } ``` - **enabled**: Always show the encoding. - **disabled**: Never show the encoding. - **non_utf8**: Shows for non-UTF-8 encodings and UTF-8 with BOM. Only hides for standard UTF-8 (Default). <img width="1347" height="415" alt="image" src="https://github.com/user-attachments/assets/7f4f4938-3320-4d21-852c-53ee886d9a44" /> ## Heuristic Limitations: The underlying detection logic (implemented in #44819 and #45243) prioritizes UTF-8 opening performance and does not guarantee perfect detection for all encodings. We consider this margin of error acceptable, similar to the behavior seen in VS Code. A future "Reopen with Encoding" feature would serve as the primary fallback for any misdetections. Release Notes: - Added a status bar item to display the active file's character encoding (e.g. `UTF-16`). This shows for non-utf8 files by default and can be configured with `{"status_bar":{"active_encoding_button":"disabled|enabled|non_utf8"}}` |
||
|---|---|---|
| .cargo | ||
| .cloudflare | ||
| .config | ||
| .factory/prompts/docs-automation | ||
| .github | ||
| .zed | ||
| assets | ||
| ci | ||
| crates | ||
| docs | ||
| extensions | ||
| legal | ||
| nix | ||
| plans | ||
| script | ||
| tooling | ||
| .clinerules | ||
| .cursorrules | ||
| .git-blame-ignore-revs | ||
| .gitattributes | ||
| .gitignore | ||
| .mailmap | ||
| .prettierrc | ||
| .rules | ||
| .windsurfrules | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CLAUDE.md | ||
| clippy.toml | ||
| CODE_OF_CONDUCT.md | ||
| compose.yml | ||
| CONTRIBUTING.md | ||
| debug.plist | ||
| default.nix | ||
| docker-compose.sql | ||
| Dockerfile-collab | ||
| Dockerfile-collab.dockerignore | ||
| Dockerfile-cross.dockerignore | ||
| Dockerfile-distros | ||
| Dockerfile-distros.dockerignore | ||
| flake.lock | ||
| flake.nix | ||
| GEMINI.md | ||
| LICENSE-AGPL | ||
| LICENSE-APACHE | ||
| LICENSE-GPL | ||
| livekit.yaml | ||
| lychee.toml | ||
| Procfile | ||
| Procfile.all | ||
| Procfile.web | ||
| README.md | ||
| renovate.json | ||
| REVIEWERS.conl | ||
| rust-toolchain.toml | ||
| shell.nix | ||
| typos.toml | ||
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 issue)
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
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.