Commit Graph

20006 Commits

Author SHA1 Message Date
Jakob Hellermann
8e07fd2214
Update time crate to fix compilation error (#12189)
run `cargo update --package time` due to
https://github.com/time-rs/time/issues/681

Release Notes:

- N/A
2024-05-26 16:44:15 -07:00
apricotbucket28
d8605c8614
x11: Implement various window functions (#12070)
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
2024-05-26 16:43:24 -07:00
张小白
c0259a448d
windows: Slightly improve font rendering quality (#12015)
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
2024-05-26 16:41:55 -07:00
Mikayla Maki
a9e3d4ec4e
Improve context expansion (#10957)
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>
2024-05-26 16:30:09 -07:00
Piotr Osiewicz
a0f91299dd
task: Do not wrap custom task variables in braces (#12322)
Fixes #10998

Release Notes:

- N/A
2024-05-27 00:15:53 +02:00
Piotr Osiewicz
71451b59cd
php/ruby: bump version to 0.0.5 (#12330)
Includes: https://github.com/zed-industries/zed/pull/12237

Release Notes:

- N/A
2024-05-27 00:07:33 +02:00
Anıl Şenay
ddb551c794
go: Add runnables for Go (#12003)
Implemented runnables for specially for running tests for Go.

I'm grateful for your feedback because this is my first experience with
Rust and Zed codebase.
![resim](https://github.com/zed-industries/zed/assets/1047345/789b31da-554f-47cd-a08c-444eced104f4)

https://github.com/zed-industries/zed/assets/1047345/ae1abd9e-3657-4322-9c28-02d0752b5ccd


Release Notes:

- Added Runnables/Tasks for:
  - Run test functions which start with "Test"
  - Run subtests
  - Run benchmark tests
  - Run main function



---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-05-26 15:16:52 +02:00
Remco Smits
5665cad250
json: Add runnable for package.json and composer.json scripts (#12285)
**Package.json**


https://github.com/zed-industries/zed/assets/62463826/f8ca12a5-1292-4465-83e1-3c2ab65f5833

**Composer.json**


https://github.com/zed-industries/zed/assets/62463826/61f9e74d-c6ed-4329-855b-d0161e0a117b

Release Notes:

- Added runnable for `package.json` and `composer.json` scripts
([#12215](https://github.com/zed-industries/zed/issues/12215)).
2024-05-26 13:47:49 +02:00
Jakob Hellermann
a1e5b122e7
Fix some warnings/issues uncovered by the new cfg checking (#12310)
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
2024-05-26 12:50:20 +02:00
Marshall Bowers
78aaa29d5b
assistant: Replace an expect with a precondition check (#12292)
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
2024-05-25 15:59:40 -04:00
Marshall Bowers
8450d63ed6
Remove potential crash when missing worktrees (#12291)
This PR removes a potential crash when there are no worktrees in the
project.

Present on Nightly only.

Release Notes:

- N/A
2024-05-25 15:24:15 -04:00
Marshall Bowers
ace371a0d8
node_runtime: Restrict the windows dependency to the Windows target (#12284)
This PR fixes an issue where the `windows` dependency was being included
on non-Windows targets.

Resolves https://github.com/zed-industries/zed/issues/12282.

Release Notes:

- N/A
2024-05-25 11:04:22 -04:00
Marshall Bowers
66e40a5d7e
docs: Update Ruby docs (#12283)
This PR updates the Ruby docs with a note on how to switch to using
`ruby-lsp`.

Release Notes:

- N/A
2024-05-25 10:50:54 -04:00
Danilo Leal
5213f6207d
docs: Add tweaks to the "Remote development" page (#12267)
Mostly tiny stuff. Quick run-down of the changes:
- Using `*Note*` instead of `NOTE` for the blockquote callouts
(piggybacking from https://github.com/zed-industries/zed/pull/11724)
- Use hyphens for bullet lists instead of asterisks
- Capitalize every (applicable) mention to Zed
- Capitalize mentions of other products (e.g., google cloud → Google
Cloud)
- Swap e.g. → for example — for clarity (latinisms may be unfamiliar for
some non-native English speakers, surprisingly!)

Release Notes:

N/A
2024-05-25 15:33:11 +03:00
Piotr Osiewicz
e5085dfef6
lsp: explicitly drop locks in handle_input (#12276)
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
2024-05-25 12:25:17 +02:00
Kirill Bulatov
32f11dfa00
Use language settings' prettier parsers as a fallback for files with no path (#12273)
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.
2024-05-25 10:50:53 +03:00
Nate Butler
d5fe2c85d8
Order prompts by default (#12268)
Prompts in the prompt library will be in A->Z order by default.

Release Notes:

- N/A
2024-05-24 22:59:37 -04:00
Max Brunsfeld
f7a86967fd
Avoid holding worktree lock for a long time while updating large repos' git status (#12266)
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.
2024-05-24 17:41:35 -07:00
Nate Butler
800c1ba916
Rework prompt frontmatter (#12262)
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
2024-05-24 19:15:02 -04:00
Avinash Thakur
461e7d00a6
Create a new directory when a new file ends with / (#12018)
Release Notes:

- Made project panel to create directories when renaming into paths ending with `/`
2024-05-24 23:46:19 +03:00
Marshall Bowers
82f5f36422
Allow defining slash commands in extensions (#12255)
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
2024-05-24 15:44:32 -04:00
Kirill Bulatov
055a13a9b6
Allow clients to run Zed tasks on remote projects (#12199)
Release Notes:

- Enabled Zed tasks on remote projects with ssh connection string
specified

---------

Co-authored-by: Conrad Irwin <conrad@zed.dev>
2024-05-24 22:26:57 +03:00
Kirill Bulatov
df35fd0026
Show Delete shortcuts in project panel context menu (#12250)
Closes https://github.com/zed-industries/zed/issues/12234 by making both
default keymap and the menu `Delete` action declarations to have the
same `skip_prompt` value.
`Trash` action got more explicit `skip_prompt` declarations in this PR,
but those were the defaults already, so not changed.

Now, `Delete` action in the project panel will always show a prompt
before removing, both on the keystroke and menu item click.
To note, VSCode does skips prompt for the `Trash` action, so we might
want to change that too (later?), the PR does not alter it.

Release Notes:

- Shows Delete action binding keys in the project panel context menu
([12234](https://github.com/zed-industries/zed/issues/12234))
2024-05-24 22:02:21 +03:00
Piotr Osiewicz
27229bba6b
tasks: Provide task variables from matching runnable ranges in task modal (#12237)
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
2024-05-24 21:00:23 +02:00
Marshall Bowers
08a3d3a0c2
assistant: Add missing lints.workspace (#12253)
This PR adds the missing `lints.workspace` setting to the `assistant`
crate's `Cargo.toml`.

Release Notes:

- N/A
2024-05-24 13:14:27 -04:00
Marshall Bowers
8040e43520
Extract SlashCommand trait from assistant (#12252)
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
2024-05-24 13:03:41 -04:00
Bennet Bo Fenner
af3d7a60c8
indent guides: Fix tab handling (#12249)
Fixes indent guides when using tabs, 
Fixes: #12209, fixes #12210

Release Notes:

- N/A
2024-05-24 18:24:03 +02:00
Vitaly Slobodin
414f97f702
docs: Fix path to "configuring-zed" page in Python lang doc (#12233)
Fix path to the `configuring-zed` page in Python language documentation.

Release Notes:

- N/A
2024-05-24 10:31:32 -04:00
Piotr Osiewicz
0eff1eae76
task: Add ZED_DIRNAME and ZED_RELATIVE_FILE task variables (#12245)
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.
2024-05-24 16:04:24 +02:00
Congyu
b0d89d6f34
Fix jetbrains keymap alt-enter to do search::SelectAllMatches (#11951)
The default keymap uses alt-enter for `SelectAllMatches` for `context:
BufferSearchBar`.

Jetbrains keymap uses alt-enter for `ToggleCodeActions` for `context:
Editor`.

When focusing on search bar, currently alt-enter does not perform
`SelectAllMatches`, whereas `ToggleCodeActions` is triggered instead,
because search bar's text input element has `context: Editor
mode=single_line`.

This PR restricts `ToggleCodeActions` to `Editor (full mode)` context to
allow `SelectAllMatches` to be triggered for alt-enter when the search
bar is active.

Release Notes:

- Fixed alt-enter with JetBrains keymap ignoring `search::SelectAllMatches` in certain contexts ([11840](https://github.com/zed-industries/zed/issues/11840))
2024-05-24 12:47:38 +03:00
bbb651
d116f3c292
Use checked str slices in Rgba::TryFrom<str> (#12097)
Release Notes:

- N/A

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2024-05-24 12:32:46 +03:00
Ephram
70e8737918
Allow information popovers while showing autocomplete suggestions (#12157)
Allows information popovers to display while autocomplete suggestions
are also being displayed.

Before: 


https://github.com/zed-industries/zed/assets/50590465/a61f0b4e-1521-42de-84fd-c5a3586b74ab

After:


https://github.com/zed-industries/zed/assets/50590465/ad2daae7-aebc-4c71-ad4c-f9d2deb6d0d0

Release Notes:
- Allow hover and completion popovers to appear at the same time ([12152](https://github.com/zed-industries/zed/issues/12152))
2024-05-24 12:32:17 +03:00
Elliot Thomas
b9697fb487
Enable manual worktree organization (#11504)
Release Notes:

- Preserve order of worktrees in project
([#10883](https://github.com/zed-industries/zed/issues/10883)).
- Enable drag-and-drop reordering for project worktrees

Note: worktree order is not synced during collaboration but guests can
reorder their own project panels.

![Reordering
worktrees](https://github.com/zed-industries/zed/assets/1347854/1c63d83c-5d4e-4b55-b840-bfbf32521b2a)

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2024-05-24 12:15:48 +03:00
Remco Smits
1e5389a2be
rust: Add runnable icon for #[cfg(test)] mod tests (#12017)
This allows you to run all the tests inside the `mod tests` block. 
Fixes #11967.

<img width="366" alt="Screenshot 2024-05-18 at 16 07 32"
src="https://github.com/zed-industries/zed/assets/62463826/01fc378c-1546-421d-8250-fe0227c1e5a0">

<img width="874" alt="Screenshot 2024-05-18 at 16 37 21"
src="https://github.com/zed-industries/zed/assets/62463826/4a880b91-df84-4917-a16e-5d5fe20e22ac">

Release Notes:

- Added runnable icon for Rust `#[cfg(test)] mod tests` blocks
([#11967](https://github.com/zed-industries/zed/issues/11967)).
2024-05-24 11:02:23 +02:00
Philip Durbin
2177ee8cc0
Highlight files ending in mdwn as Markdown (#12224)
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.
2024-05-24 10:01:56 +03:00
Conrad Irwin
3ec94697b4
Make reconnects smoother for dev servers (#12223)
Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
2024-05-23 21:11:14 -06:00
Conrad Irwin
656edc4b2e
Vim smorgasbord (#12222)
Release Notes:

- vim: Added `]d/[d` for go to prev/next diagnostic
- vim: Added `]c/[c` to go to prev/next git change (`:diff` and
`:revert` show the diff and revert it)
- vim: Added `g cmd-d` for go to implementation
2024-05-23 21:09:32 -06:00
Conrad Irwin
ec4703a8d5
Add missing access control check (#12213)
Release Notes:

- N/A
2024-05-23 16:59:04 -06:00
Fernando Tagawa
3b14115c2f
X11: Implement missing XKB Compose (#12150)
Release Notes:

- N/A

We have implemented XKB Compose for Wayland, but we forgot to implement
it for X11.
Fixed #12089
2024-05-23 15:09:20 -07:00
Antonio Scandurra
57d570c281
Introduce custom fold placeholders (#12214)
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>
2024-05-23 15:22:30 -06:00
Marshall Bowers
e0cfba43aa
gleam: Detect tests using describe API for Startest (#12221)
This PR updates the Gleam runnables to detect tests using the `describe`
API in Startest.

This isn't entirely functional yet, as it is still just uses the test
function name to run the tests (which Startest doesn't yet support).

Release Notes:

- N/A
2024-05-23 17:20:06 -04:00
Max Brunsfeld
e15b902974
Fix double lease panic in Quote Selection command (#12217)
Release Notes:

- Fixed a panic that occurred when using the `assistant: quote
selection` command while signed out.
2024-05-23 12:14:34 -07:00
Conrad Irwin
9c35187aac
Fix line with invisibles positioning (#12211)
Release Notes:

- fixed positioning of whitespace dots on multibyte text
([#10332](https://github.com/zed-industries/zed/issues/10332)).
2024-05-23 12:16:16 -06:00
Marshall Bowers
951fbc57ba
Fix rustfmt issues in dev_servers.rs (#12205)
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
2024-05-23 11:46:15 -04:00
Bennet Bo Fenner
e903742d52
indent guides: Cache active indent range (#12204)
Caching the active indent range allows us to not re-compute the indent
range when it is not necessary

Release Notes:

- N/A
2024-05-23 17:44:31 +02:00
Bennet Bo Fenner
58a3ba02c6
indent guides: Toggle action (#12203)
Added a new action `editor: Toggle indent guides`, to show/hide indent
guides

Release Notes:

- N/A
2024-05-23 16:45:20 +02:00
Bennet Bo Fenner
feea607bac
Indent guides (#11503)
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>
2024-05-23 15:50:59 +02:00
Mikayla Maki
3eb0418bda
Make a macro for less boilerplate when moving variables (#12182)
Also: 
- Simplify open listener implementation
- Add set_global API to global traits

Release Notes:

- N/A
2024-05-22 22:07:29 -07:00
Conrad Irwin
8b57d6d4c6
remote config fixes (#12178)
Release Notes:

- N/A
2024-05-22 22:28:00 -06:00
Conrad Irwin
af8641ce5b
reconnect ssh (#12147)
Release Notes:

- N/A

---------

Co-authored-by: Bennet <bennet@zed.dev>
2024-05-22 21:25:38 -06:00