There were two issues:
1. the `ModifiersChanged` event was never emitted on windows.
macOS, x11 and wayland have separate events for this, while on windows
they are sent via the usual `keyup` and `keydown` events, but
`parse_keydown_msg_keystroke` just ignored them.
2. the word segmenting regex didn't include '\' so paths weren't
correctly detected
fixes https://github.com/zed-industries/zed/issues/12321
Release Notes:
- N/A
Running the tests on windows currently fails for every gpui test using
the `TestPlatform` with
```rs
called `Result::unwrap()` on an `Err` value: CoInitialize has not been called. (0x800401F0)
```
trying to call `CoCreateInstance`in the `DirectWriteComponent`.
The `WindowsPlatform` calls
[`OleInitialize`](https://learn.microsoft.com/de-de/windows/win32/api/ole2/nf-ole2-oleinitialize)
which internally calls `CoInitializeEx` so I just copied that to the
`TestPlatform`.
Release Notes:
- N/A
At the current moment, the "Reveal in Finder" behavior on Windows
"opens" the file using direct execution. This causes files to be opened
with whatever software they are associated with (i.e. will open Sublime
Text instead of the file explorer).
Release Notes:
- Fixed "Reveal in Finder" on Windows to open with the File Explorer.
The new behavior always opens the file explorer with the target
folder/file pre-selected.
https://github.com/zed-industries/zed/assets/28355157/b8ba471d-2f5b-4529-90c3-4dc59f308b99
This (mostly) allows the CSD added in
https://github.com/zed-industries/zed/pull/11525 to work in X11. It's
still a bit buggy as it detects a second window drag right after the
first one finishes, but it's probably better to change the way window
drags are detected in the title bar itself (as that causes other
issues).
The CSD can be tested by changing the return value of
`should_render_window_controls` to true.
Also fixes F11 crashing.
Release Notes:
- N/A
Upper before this PR, lower after.
![Screenshot 2024-05-20
144852](https://github.com/zed-industries/zed/assets/14981363/88995482-3a98-41be-9c2c-6b781bef6ad2)
This PR manually applies a MSAA to the font atlas. Before this PR, the
font may seem aliased ( espeacially on low DPI monitors ), that's
because `DirectWrite` and `CoreText` ( on which currently `Zed` built
the whole text system ) uses different anti-aliasing strategy. The
different anti-aliasing approach used by `DirectWrite` and `CoreText`:
![Screenshot 2024-05-20
151114](https://github.com/zed-industries/zed/assets/14981363/21a2fc1e-48a2-4cff-a9d1-41602eff3658)
The upper is `VSCode` font rendering result, middle `macOS`, lower this
PR ( pic captured with same font face, same font size, same DPI, same
physical resolution, same editor theme, and same magnification rate ).
This PR brings a quality similiar to `CoreText`. What's more, from the
`VSCode` image, you can see how `DirectWrite` sub-pixel anti-aliasing is
performed on the edge of the glyph. Can we achieve the same rendering
quality? Currently, No. `Zed` use a grayscale image to render glyph, and
a sub-pixel anti-aliasing `DirectWrite` requires all RGB channels and
the foreground color of the rendering glyph, which `Zed` dose not
provide.
So, to achieve the quality of `VSCode` font rendering, the text system
of `Zed` needs much much more efforts to refactor the codes.
Release Notes:
- N/A
Release Notes:
- Improved expand excerpt indicators to allow unidirectional expansion.
Also added the `editor::ExpandExcerptsUp` and
`editor::ExpandExcerptsDown` actions, which can both take a `lines`
parameter. Also added a `expand_excerpt_lines` setting which controls
the default number of lines that the indicators and actions use.
---------
Co-authored-by: conrad <conrad@zed.dev>
Rust recently got the ability to check for typos or errors in `cfg`
attributes: https://blog.rust-lang.org/2024/05/06/check-cfg.html
This PR fixes the new warnings.
- gpui can be run with `RUSTFLAGS="--cfg gles"`, make this explicit in
`[workspace.lints.rust]`
- `cfg!(any(test, sqlite))` was just a bug, it should be
`feature(sqlite)`
- the `languages` crate had a `#[cfg(any(test, feature =
"test-support"))]` function without ever declaring the `test-support`
feature
- the `MarkdownTag` enum had a `cfg_attr` for serde without actually
having serde support
Now the only warnings when building are unused fields
`InlayHover.excerpt`, `SavedConversationMetadata.path` ,
`UserTestPlan.allow_client_reconnection` and `SyntaxMapCapture.depth`.
Release Notes:
- N/A
This PR replaces an `expect` with a precondition check to avoid a panic
if the `LspAdapterDelegate` isn't set when invoking a slash command.
Release Notes:
- N/A
Due to lifetime extension rules, we were holding onto the request
handler map mutex during parsing of the request itself. This had no
grand repercussions; it only prevented registering a handler for next
request until parsing of the previous one was done.
Release Notes:
- N/A
Follow-up of
https://github.com/zed-industries/zed/pull/12095#issuecomment-2123230762
reverting back part of https://github.com/zed-industries/zed/pull/11558
that was related to `language.toml` parsing.
Now all extensions that define `prettier_parser_name` in their language
configs, will enable formatting untitled buffers without any extra
language settings like
```json
{
"languages": {
"JSON": {
"prettier": {
"allowed": true,
"parser": "json"
}
}
}
}
```
Release Notes:
- Improved ergonomics of untitled buffer formatting with prettier, no
extra language settings are needed by default.
Fixes https://github.com/zed-industries/zed/issues/9575
Fixes https://github.com/zed-industries/zed/issues/4294
### Problem
When a large git repository's `.git` folder changes (due to a `git
commit`, `git reset` etc), Zed needs to recompute the git status for
every file in that git repository. Part of computing the git status is
the *unstaged* part - the comparison between the content of the file and
the version in the git index. In a large git repository like `chromium`
or `linux`, this is inherently pretty slow.
Previously, we performed this git status all at once, and held a lock on
our `BackgroundScanner`'s state for the entire time. On my laptop, in
the `linux` repo, this would often take around 13 seconds.
When opening a file, Zed always refreshes the metadata for that file in
its in-memory snapshot of worktree. This is normally very fast, but if
another task is holding a lock on the `BackgroundScanner`, it blocks.
### Solution
I've restructured how Zed handles Git statuses, so that when a git
repository is updated, we recompute files' git statuses in fixed-sized
batches. In between these batches, the `BackgroundScanner` is free to
perform other work, so that file operations coming from the main thread
will still be responsive.
Release Notes:
- Fixed a bug that caused long delays in opening files right after
performing a commit in very large git repositories.
Moved some things around so prompts now always have front-matter to
return, either by creating a prompt with default front-matter, or
bailing earlier on importing the prompt to the library.
In the future we'll improve visibility of malformed prompts in the
`prompts` folder in the prompt manager UI.
Fixes:
- Prompts inserted with the `/prompt` command now only include their
body, not the entire file including metadata.
- Prompts with an invalid title will now show "Untitled prompt" instead
of an empty line.
Release Notes:
- N/A
This PR adds initial support for defining slash commands for the
Assistant from extensions.
Slash commands are defined in an extension's `extension.toml`:
```toml
[slash_commands.gleam-project]
description = "Returns information about the current Gleam project."
requires_argument = false
```
and then executed via the `run_slash_command` method on the `Extension`
trait:
```rs
impl Extension for GleamExtension {
// ...
fn run_slash_command(
&self,
command: SlashCommand,
_argument: Option<String>,
worktree: &zed::Worktree,
) -> Result<Option<String>, String> {
match command.name.as_str() {
"gleam-project" => Ok(Some("Yayyy".to_string())),
command => Err(format!("unknown slash command: \"{command}\"")),
}
}
}
```
Release Notes:
- N/A
In #12003 we found ourselves in need for precise region tracking in
which a given runnable has an effect in order to grab variables from it.
This PR makes it so that in task modal all task variables from queries
overlapping current cursor position.
However, in the process of working on that I've found that we cannot
always use a top-level capture to represent the full match range of
runnable (which has been my assumption up to this point). Tree-sitter
captures cannot capture sibling groups; we did just that in Rust
queries.
Thankfully, none of the extensions are affected as in them, a capture is
always attached to single node. This PR adds annotations to them
nonetheless; we'll be able to get rid of top-level captures in extension
runnables.scm once this PR is in stable version of Zed.
Release Notes:
- N/A
This PR extracts the `SlashCommand` trait (along with the
`SlashCommandRegistry`) from the `assistant` crate.
This will allow us to register slash commands from extensions without
having to make `extension` depend on `assistant`.
Release Notes:
- N/A
Release Notes:
- Added ZED_RELATIVE_FILE (path to current file relative to worktree
root) and ZED_DIRNAME (path to the directory containing current file)
task variables.
Highlight files ending in `mdwn` as Markdown.
(Ikiwiki uses `mdwn` as the file extension for Markdown.)
This pull request was inspired by this one:
- #1209/
Release Notes:
- Added ".mdwn" as a Markdown file extension.
This pull request replaces the static `⋯` character we used to insert
when folding a range with a custom render function that return an
`AnyElement`. We plan to use this in the assistant, but for now this
should be behavior-preserving.
Release Notes:
- N/A
---------
Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Conrad <conrad@zed.dev>
This PR fixes some issues preventing `rustfmt` from running properly in
`dev_servers.rs`.
The culprit was some long strings being inlined.
Release Notes:
- N/A
Builds on top of existing work from #2249, but here's a showcase:
https://github.com/zed-industries/zed/assets/53836821/4b346965-6654-496c-b379-75425d9b493f
TODO:
- [x] handle line wrapping
- [x] implement handling in multibuffer (crashes currently)
- [x] add configuration option
- [x] new theme properties? What colors to use?
- [x] Possibly support indents with different colors or background
colors
- [x] investigate edge cases (e.g. indent guides and folds continue on
empty lines even if the next indent is different)
- [x] add more tests (also test `find_active_indent_index`)
- [x] docs (will do in a follow up PR)
- [x] benchmark performance impact
Release Notes:
- Added indent guides
([#5373](https://github.com/zed-industries/zed/issues/5373))
---------
Co-authored-by: Nate Butler <1714999+iamnbutler@users.noreply.github.com>
Co-authored-by: Remco <djsmits12@gmail.com>
This PR adds a new `github_release_by_tag_name` method to the
`zed_extension_api` to allow for retrieving a GitHub release by its tag
name.
Release Notes:
- N/A
This PR restricts usage of v0.0.7 of the `zed_extension_api` to dev
builds, for now.
As we're still making changes to it, we don't want to ship a version of
Zed to Preview/Stable that claims to support a yet-unreleased version of
the extension API.
Release Notes:
- N/A
This PR forks a new version of the `zed_extension_api` in preparation
for some upcoming changes that require breaking changes to the WIT.
Release Notes:
- N/A
---------
Co-authored-by: Max <max@zed.dev>