Commit Graph

14719 Commits

Author SHA1 Message Date
Marshall Bowers
c116a7ca5b
Clean up Picker constructor signature (#9500)
This PR cleans up the (internal) `Picker` constructor signature, mainly
to remove the consecutive boolean parameters.

Release Notes:

- N/A
2024-03-18 12:27:51 -04:00
Andrew Lygin
7512c9949c
Allow Picker to be headless (#9099)
At the moment, `Picker` always has an editor at the top, that allows the
user to search list elements by text. Sometimes, the UI doesn't need
such an editor. Like in the [tab
switcher](https://github.com/zed-industries/zed/issues/7653) that will
confirm selection on the modifier keys release, so there will be no
searching capabilities.

This PR adds support for a "headless picker" that doesn't display an
editor. It only has an invisible element to hold input focus for
preventing it from jumping back to the workspace.

At the moment, none of the picker implementations is made headless. It's
for the future implementations. But I'd like to make it a separate PR to
keep it focused on this particular feature.

Release Notes:

- N/A

Related Issues:
- Part of #7653

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-03-18 11:59:53 -04:00
Robin Pfäffle
ad97c357a5
Add regex syntax highlighting for JS and TS (#7851)
<img width="544" alt="SCR-20240215-pvzy"
src="https://github.com/zed-industries/zed/assets/67913738/e4d463a6-1795-4728-ac24-6c8e03e7ea5b">

Release Notes:

- Added support for regex syntax highlighting in `JS` and `TS`.
2024-03-18 09:49:01 -06:00
Ezekiel Warren
9f96c43ff7
windows: Don't report 'shift' for certain keys (#9479)
allows keybindings for character such as `:`, `?`, etc. (important for
vim mode!)

alternative solution is here: #9478

Release Notes:

- N/A
2024-03-18 09:33:28 -06:00
白山風露
c2d5b33c20
windows: Fix Clippy warnings (#9426)
Just handling clippy warnings

Release Notes:

- N/A
2024-03-18 10:16:03 -04:00
Ezekiel Warren
ee50d22add
windows: Add manifest for storybook (#9453)
allows `cargo run -p storybook` to work on Windows

Release Notes:

- N/A
2024-03-18 10:14:01 -04:00
Piotr Osiewicz
f60774bbdd
chore: Wrap WorkspaceId in newtype (#9492)
Release Notes:

- N/A
2024-03-18 12:39:03 +01:00
Piotr Osiewicz
07dbee8651
task: Add ZED_PACKAGE task variable in Rust files. (#9491)
This variable is experimental, as I expect it to be superseded by
whatever the extensions can provide (once we get them)

Release Notes:

- Added experimental ZED_PACKAGE task variable which contains name of
the current crate in Rust files.

---------

Co-authored-by: Kirill <kirill@zed.dev>
2024-03-18 12:18:42 +01:00
Thorsten Ball
a69eddc081
Limit project search to avoid unresponsive app (#9404)
This fixes #[#9135](https://github.com/zed-industries/zed/issues/9135)
by introducing file/results limit to project search.

It does this by changing how project search works in multiple ways.

User-facing changes:

- Number files that are being searched is now limited to 5000
- Number of search results in all files is now limited to 10000
- If a limit is reached, search is stopped and a message is displayed
  to the user

Under the hood, we also reworked `Project::search_local`:

- Code has been refactored so that the concurrency-logic is easier to
  distinguish from the search logic.
- We now limit the number of concurrent `open_buffer` operations, since
  that is being done on the main thread and can lead to beachballs when
  finding a lot of results.

Note for reviewer:

@SomeoneToIgnore since you know this code, can you take a look at this?
The changes might look bigger than they are in certain places because I
only extracted code into functions, but the middle part — the sorting of
file paths — has changed in order to avoid too many tasks opening
buffers at the same time and making app unresponsive.

What's also curious is that I think there was a bug in that we searched
ignored entries _twice_: once in `search_snapshots` and then later in
the dedicated `search_ignored_entry` function. I changed the `entries()`
call in `search_snapshots` so that it's always `false`, but that caused
tests to fail (see `test_search_in_gitignored_dirs`). @bennetbo and I
think that there's some state in the Project that made the tests pass
before, because the last of the 3 assertions in that test only passes
when the other two queries run. So we changed the test to be more
stateless and included the possible fix in `search_snapshots`.

Release Notes:

- Fixed project-wide search leading to unresponsive application when
searching in ignored files, by limiting the number of files that are
searched (to 5000) and the number of overall search results to 10000.
Additional performance improvements have also been made in order to
offload more work onto a background thread.
([#9135](https://github.com/zed-industries/zed/issues/9135)).

---------

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
Co-authored-by: Bennet <bennetbo@gmx.de>
2024-03-18 10:49:27 +01:00
Antonio Scandurra
52a9bc3e1b
Automatically create a hitbox for focusable elements (#9485)
Closes #9462

This fixes the focus story in the storybook.

Release Notes:

- N/A
2024-03-18 09:58:31 +01:00
Kirill Bulatov
9df92c3fb6
Correctly handle network issues during LSP server installation (#9460)
Closes https://github.com/zed-industries/zed/issues/9458

When flying in a plane being totally offline, I've discovered that my
Rust projects do not have any LSP support and rust-analyzer disappeared
out of `~/Library/Application Support/Zed/languages/rust-analyzer/`
directory.

Looking at the
[bad.log](https://github.com/zed-industries/zed/files/14627508/bad.log),
it appears that `get_language_server_command` tries to find a newer LSP
server version and fails on
80bc6c8cc8/crates/language/src/language.rs (L339)

bailing out of all installation related-methods up to here:


80bc6c8cc8/crates/project/src/project.rs (L2916)

where the code thinks that the binary installation process had failed,
cleans the existing directory and tries to install the language server
again:

```log
[2024-03-17T15:14:13+02:00 WARN  isahc::handler] request completed with error: failed to resolve host name
[2024-03-17T15:14:13+02:00 ERROR project] failed to start language server "rust-analyzer": error fetching latest release
[2024-03-17T15:14:13+02:00 ERROR project] server stderr: Some("")
[2024-03-17T15:14:13+02:00 INFO  project] retrying installation of language server "rust-analyzer" in 1s
[2024-03-17T15:14:13+02:00 ERROR util] crates/lsp/src/lsp.rs:720: oneshot canceled
[2024-03-17T15:14:14+02:00 INFO  project] About to spawn test binary
[2024-03-17T15:14:14+02:00 WARN  project] test binary failed to launch
[2024-03-17T15:14:14+02:00 WARN  project] test binary check failed
[2024-03-17T15:14:14+02:00 INFO  project] beginning to reinstall server
[2024-03-17T15:14:14+02:00 INFO  language::language_registry] deleting server container
[2024-03-17T15:14:14+02:00 INFO  language::language_registry] starting language server "rust-analyzer", path: "/Users/someonetoignore/work/other/local_test", id: 2
[2024-03-17T15:14:14+02:00 INFO  language] fetching latest version of language server "rust-analyzer"
[2024-03-17T15:14:14+02:00 WARN  isahc::handler] request completed with error: failed to resolve host name
[2024-03-17T15:14:14+02:00 ERROR project] failed to start language server "rust-analyzer": error fetching latest release
[2024-03-17T15:14:14+02:00 ERROR project] server stderr: Some("")
[2024-03-17T15:14:14+02:00 INFO  project] retrying installation of language server "rust-analyzer" in 1s
[2024-03-17T15:14:15+02:00 ERROR util] crates/languages/src/rust.rs:335: no cached binary
[2024-03-17T15:14:15+02:00 INFO  project] About to spawn test binary
............
```

The PR extracts away all binary fetching-related code into a single
method that does not fail the entire `get_language_server_command` and
allows it to recover and reuse the existing binary:


[good.log](https://github.com/zed-industries/zed/files/14627507/good.log)

```log
[2024-03-17T15:12:24+02:00 INFO  language::language_registry] starting language server "rust-analyzer", path: "/Users/someonetoignore/work/other/local_test", id: 1
[2024-03-17T15:12:24+02:00 INFO  language] fetching latest version of language server "rust-analyzer"
[2024-03-17T15:12:24+02:00 WARN  isahc::handler] request completed with error: failed to resolve host name
[2024-03-17T15:12:24+02:00 INFO  language] failed to fetch newest version of language server LanguageServerName("rust-analyzer"). falling back to using "/Users/someonetoignore/Library/Application Support/Zed/languages/rust-analyzer/rust-analyzer-2024-03-11"
[2024-03-17T15:12:24+02:00 INFO  lsp] starting language server. binary path: "/Users/someonetoignore/Library/Application Support/Zed/languages/rust-analyzer/rust-analyzer-2024-03-11", working directory: "/Users/someonetoignore/work/other/local_test", args: []
```

Release Notes:

- Fixed language servers erased from the disk when project is opened
offline
2024-03-17 15:41:00 +02:00
Tobias Decking
80bc6c8cc8
Small cleanup of gpui manifest file (#9439)
Currently, gpui depends on env_logger as both a normal dependency and a
dev-dependency without
using the workspace defined version. This fixes it.
2024-03-16 12:59:18 +01:00
Conrad Irwin
f1d98dc748
Fix segfault in "install:cli" when app is not yet installed (#9427)
Release Notes:

- Fixed a panic running `cli: Install` or `cli: Register Zed Scheme`
before installing the app.
2024-03-15 21:16:09 -06:00
白山風露
c2b42e2bab
Windows: direct load DCompositionWaitForCompositorClock and fallback (#9351)
…timer

Fix: #9166

Release Notes:

- N/A
2024-03-15 17:17:26 -07:00
Conrad Irwin
ca6e588085
collab logging (#9420)
- **Log errors inside the connection span**
- **Tidy up collab logging**


Release Notes:

- N/A
2024-03-15 16:02:37 -06:00
Marshall Bowers
0329b4a5cb
Allow loading "Segoe Fluent Icons" font on macOS (#9421)
This PR updates the `TextSystem` on macOS to allow loading the "Segoe
Fluent Icons" font.

We're using this font in the Storybook to render the `TitleBar` as it
would appear on Windows despite us running it on macOS. This is to make
things easier for iterating on UI design without needing to test on each
individual platform.

However, the "Segoe Fluent Icons" font does not have a glyph for the `m`
character, causing it to run afoul of a precautionary check added in
#4029, which ultimately results in the font not being loaded (and thus
rendering as a missing glyph).

We work around this by simply ignoring this check if the font we're
trying to load is specifically "Segoe Fluent Icons".

I think longer-term we'll need to revisit the behavior in the editor
that is causing the panics when the `m` glyph is missing from the font,
but that's a problem for a different day.

#### Before

<img width="1283" alt="Screenshot 2024-03-15 at 3 34 38 PM"
src="https://github.com/zed-industries/zed/assets/1486634/c0ddd46d-8599-4729-ac98-75522b33e25b">

#### After

<img width="1113" alt="Screenshot 2024-03-15 at 5 12 36 PM"
src="https://github.com/zed-industries/zed/assets/1486634/183c2b43-5e4f-4516-8856-7a2d45ed8b2e">

Note that you currently need to install the "Segoe Fluent Icons" font
yourself—either installing it globally or placing the `.ttf` file in the
`assets/fonts` directory—in order to see the icons rendered. I'd like to
look into getting this, but there are restrictions on the distribution
of the font on non-Windows platforms that will need to be followed.

Release Notes:

- N/A
2024-03-15 17:35:10 -04:00
Mikayla Maki
41071b093c
Always remember the last window size and position (#9416)
make new runs of zed always match the window of the previous run of Zed,
even if it's not the same workspace

fixes https://github.com/zed-industries/zed/issues/5258

Release Notes:

- Zed will always open new windows with the same position and location
as the previous instance of Zed.
2024-03-15 14:24:44 -07:00
Robin Pfäffle
eecbafb94e
Add JSDoc syntax highlighting support (#7826)
![SCR-20240215-mokn](https://github.com/zed-industries/zed/assets/67913738/17750eb5-bf48-4e23-adc5-0f7a5e15a41b)

Closes #4926

Release Notes:

- Added support for [JSDoc](https://jsdoc.app) syntax highlighting
([#7224](https://github.com/zed-industries/zed/issues/7224)).
2024-03-15 15:17:06 -06:00
Tobias Decking
24e7cfb0d5
Fix hex_to_hsla inside the color crate (#9412)
Previously, when `hex_to_hsla` was called with a color string using the
#rgb format, the expansion
did not add alpha values, leading to an incorrect result. This patch
fixes the issue.

In addition to that, parsing has been reworked, and the new function no
longer makes
calls to the global allocator in addition to generation much smaller
code. Parsing should
therefore be a bit more performant.
2024-03-15 16:58:46 -04:00
Marshall Bowers
c1f1c5e75f
ui: Refine TitleBar component (#9415)
This PR continues the refinements to the `TitleBar` component.

Here are the notable changes:

- `KeyBindingDisplay` and `PlatformStyle` have been unified into a
single `PlatformStyle`.
- This provides us a consistent way for adapting UI to different
platform styles.
- `PlatformTitlebar` has been renamed to `TitleBar`.
  - The `Platform` prefix was irrelevant.
- The Windows window controls have been factored out into a separate
module and have been componentized.

<img width="1283" alt="Screenshot 2024-03-15 at 3 34 38 PM"
src="https://github.com/zed-industries/zed/assets/1486634/07da391f-828b-48bf-8849-58863f4ccce7">

> I'm missing the Segoe Fluent Icons font, so that's why the aren't
rendering properly.

Release Notes:

- N/A
2024-03-15 15:48:07 -04:00
Conrad Irwin
dd33330648
Finish migration to role instead of is_admin (#9414)
Release Notes:

- Fixed a bug signing in for five users
([#4323](https://github.com/zed-industries/zed/issues/4323)).
2024-03-15 13:04:48 -06:00
Marshall Bowers
123d3ee282
ui: Clean up PlatformTitlebar implementation (#9413)
This PR cleans up the implementation of the `PlatformTitlebar` component
to better match our conventions for building UI components.

Release Notes:

- N/A
2024-03-15 14:31:02 -04:00
Ezekiel Warren
db43479be8
windows: active window implementation (#9314)
active window implementation - bonus vim mode works on windows now

Release Notes:

- N/A
2024-03-15 10:54:45 -07:00
Mikayla Maki
328aa2cc95
Cross-platform titlebar (#9405)
This PR reverts https://github.com/zed-industries/zed/pull/9392 and
fixes the regressions that led to the reversion.

Release Notes:

- N/A

---------

Co-authored-by: Ezekiel Warren <ezekiel@seaube.com>
2024-03-15 10:40:58 -07:00
Mikayla Maki
487ae73bcc
Fix sharp corners on images (#9408)
Release Notes:

- N/A
2024-03-15 10:22:32 -07:00
Matthias Grandl
b38e3f16ad
gpui: img element object-fit (#9393)
Release Notes:

- Added [object-fit
API](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) to the
`img` element. This allows the user to decide how the image is scaled
within the element bounds.
- Fixes corner radius not working as expected on overflowing elements.
2024-03-15 10:06:07 -07:00
Marshall Bowers
55f4c8e51b
Encapsulate CommandPaletteFilter and CommandPaletteInterceptor (#9402)
This PR refactors the `CommandPaletteFilter` and
`CommandPaletteInterceptor` to better encapsulate their internals.

Previously these globals and their fields were publicly accessible,
which meant that there was a lot of reaching in and making
modifications.

These changes should make it easier to add additional consumers of these
hooks (right now they're primarily used by Vim mode).

Release Notes:

- N/A
2024-03-15 12:37:25 -04:00
Kirill Bulatov
dcdd1ece1c
Small improvements of the task terminal spawn behavior (#9399)
* Add a `reveal: always|never` field in task definitions from tasks.json
, allowing to customize task terminal behavior on spawn
* Ensure reveal: always reveals the terminal even if the old task is
already running


Release Notes:

- Added a `reveal: always|never` (`always` is a default) field in task
definitions from tasks.json , allowing to customize task terminal
behavior on spawn

---------

Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
2024-03-15 18:32:59 +02:00
Joseph T. Lyons
276139f792
Implement updating for node-based language servers (#9361)
Fixes: https://github.com/zed-industries/zed/issues/9234

This doesn't address `vue` as it has a slightly different install code,
but it should be fairly simple to add - I'll add it in in a follow-up.

This PR will allow all (except `vue`) node-based language servers to
update. It is mostly just throwing in a method into the `NodeRuntime`
trait that is used for checking if a package doesn't exist locally, or
is out of date, by checking the version against what's newest, and
installing. If any parsing of the `package.json` data fails along the
way, it assumes something has gone awry on the users system, logs the
error, and then proceeds with trying to install the package, so that
users don't get stuck on version if their package has some bad data.
Outside of adding this method, it just adds that check in all of the
language server's individual `fetch_server_binary` methods.

Release Notes:

- Added updating for node-based language servers
([#9234](https://github.com/zed-industries/zed/issues/9234)).
2024-03-15 11:40:28 -04:00
Daniel Zhu
cb16003133
Fill context menu of Zed macOS dock icon with recent projects (#8952)
Fixes https://github.com/zed-industries/zed/issues/8416

Release Notes:

- Added recent projects into Zed's macOS dock icon context menu ([8416](https://github.com/zed-industries/zed/issues/8416))

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2024-03-15 16:22:43 +02:00
Thorsten Ball
5bf0c8ed2d
Revert "windows: better looking titlebar" and follow-up (#9392)
This reverts #9053 and #9375 because they introduced a regression on
`main` that broke the titlebars on macOS:


![image](https://github.com/zed-industries/zed/assets/1185253/d046003b-5c66-4a42-9385-623f5d58c9a4)

Two things are off:

- Left padding is missing
- Titlebar height is less than it was before, which means the
traffic-light buttons are not centered vertically

What @as-cii and I noticed while looking into this: the `cfg!(macos)`
macros that were used don't work like that. You need to check for
`cfg!(target = "macos")` etc. Means that on macOS we never used the
macOS-specific code because the condition was always false.

Overall height, we're not sure about.

Release Notes:

- N/A
2024-03-15 12:25:51 +01:00
Antonio Scandurra
5ae145145e
Fix flickering when interacting with the language server logs (#9390)
Fixes https://github.com/zed-industries/zed/issues/9340

The flickering was caused by the pane trying to restore focus on a
`FocusHandle` that wasn't being rendered anymore. This commit uses the
new `WeakFocusHandle` to avoid retaining a reference to focus handles
that don't exist anymore.

Release Notes:

- Fixed a bug that caused flickering when interacting with the language
server logs
([#9340](https://github.com/zed-industries/zed/issues/9340)).
2024-03-15 11:15:07 +01:00
Jack T
b9f7a37f5d
Add option to collapse all folders in root (#9372)
Release Notes:

- Added option to root project folder to collapse all subfolders
2024-03-15 09:48:56 +02:00
Hans
badcd3f4d6
Remove Copy trait for enum Operator (#9378)
In this commit, the Copy trait has been removed from Operator. This
change was necessary due to the value of operator may wish to attach a
motion type, which is not compatible with the Copy trait.

All instances where Operator was previously copied have been updated to
use the clone() or cloned() method instead. This includes function
parameters, variable assignments, and closures.
2024-03-14 22:20:55 -06:00
Robin Pfäffle
ee260910cd
Improve TS and JSON syntax highlighting (#9302)
Successor to #7767.

Release Notes:

- Improved syntax highlighting for TS/TSX and JSON.
2024-03-14 20:58:17 -06:00
Hans
27bcb7f179
Fix#9253 Duplicate menu item for "Emojis & Symbols" (#9377)
Fix #9253
2024-03-14 20:57:32 -06:00
Evren Sen
de1db8b6be
Rework/redesign message replies (#9049)
Hello! This PR proposes a redesigned replying system in Zeds chat panel,
inspired by chat applications like [Slack](https://slack.com) and
[Discord](https://discord.com). Feedback and suggestions are welcome! 😄

### TODOs

- [x] Handle replies to removed messages
- [x] Add replied user's profile picture to reply indicator
- [x] Highlight the message that's been selected for replying

--------

### Current Status


https://github.com/zed-industries/zed/assets/146845123/4ed2c2d7-a586-48bd-973c-0d3f033e2c6b

--------

Release Notes:

- Redesigned message replies in the chat panel

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-03-14 20:45:53 -06:00
Max
71aaefc5b2
Add multi_cursor_modifier setting (#9014)
this PR allows users to use `cmd` instead of `alt` as the
`multi_cursor_modifier` for creating multiple cursors/selections

closes #4339

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-03-14 20:33:54 -06:00
Hans
e836a979a2
vim: Add Multi Replace mode in Vim (#8469)
For #4440, I've only added support for normal, if it's visual mode,
would we like this to delete the current selection row and enter insert
mode?

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-03-14 20:31:53 -06:00
Kyle Kelley
72d36d0213
Foundations for Open All the Things (#9353)
This is the beginning of setting up a flexible way to open items beyond
the text buffer -- think notebooks, images, GeoJSON, etc. The primary
requirement to allow opening an arbitrary file is `try_open` on the
`project::Item` trait. Now we can make new `Item`s for other types with
their own ways to render.

Under the hood, `register_project_item` uses this new opening scheme. It
supports a dynamic array of opener functions, that will handle specific
item types. By default, a `Buffer` should be able to be able to open any
file that another opener did not.

A key detail here is that the order of registration matters. The last
item has primacy. Here's an example:

```rust
workspace::register_project_item::<Editor>(cx);
workspace::register_project_item::<Notebook>(cx);
workspace::register_project_item::<ImageViewer>(cx);
```

When a project item (file) is attempted to be opened, it's first tried
with the `ImageViewer`, followed by the `Notebook`, then the `Editor`.

The tests are set up in a way that should make it _hopefully_ easy to
learn how to write a new opener. First to go after should probably be
image files.

Release Notes:

N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-14 18:01:40 -07:00
Ezekiel Warren
f9b9123606
chore: cleanup more windows use (#9376) 2024-03-14 18:00:03 -07:00
Ivan Buryak
ff8a4a89c7
Add outlines for CSS (#8706)
Add outlines for .css files

⚠️I also added `workspace = { workspace = true, features =
["test-support"] }` to dev deps of 'languages' crate to make unit tests
work.

![Css
outlines](https://github.com/zed-industries/zed/assets/4057095/0cade407-79e7-4d0f-9b80-3502509e373d)
2024-03-14 20:31:52 -04:00
Mikayla Maki
8c43e10de7
whoops (#9375)
Release Notes:

- N/A
2024-03-14 17:22:00 -07:00
Ezekiel Warren
948b3827c8
windows: better looking titlebar (#9053)
~~work in progress. not ready for review. made for visibility only, but
feel free to comment :)~~

TODO:
- [x] add close/min/max buttons (to be rendered with gpui)
- [x] snap layout support
- [x] fix issues with clicking items in titlebar
- [x] cleanup/document

Release Notes:

- Added custom windows titlebar

![](https://media.discordapp.net/attachments/1208481909676576818/1216985375969378324/caption-buttons-working.gif?ex=660260f4&is=65efebf4&hm=53a17af6e2f233eba54302a5adb9efe23900f4d6f6d1d854bec887120789130c&=)

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-03-14 17:20:30 -07:00
Ezekiel Warren
6bbc5e2efa
windows: cleanup window crate uses (#9374) 2024-03-14 16:42:53 -07:00
Marshall Bowers
a92dcccf48
Enable clippy::non_canonical_clone_impl (#9373)
This PR enables the
[`clippy::non_canonical_clone_impl`](https://rust-lang.github.io/rust-clippy/master/index.html#/non_canonical_clone_impl)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-14 18:49:51 -04:00
张小白
845eb64615
Windows: IME support (#9188)
Waiting for #9180 to be merged.

The behavior of IME windows is consistent with VS Code.



https://github.com/zed-industries/zed/assets/14981363/14913219-7345-4fec-9cc5-623d0c60acc9




Release Notes:
- N/A
2024-03-14 15:29:25 -07:00
张小白
c2d27c44f9
Use Windows native API to impl dispatcher (#9280)
Using `Threadpool` and `TimerQueue` which are provided by the native
Windows APIs, to implement the corresponding interfaces, we do not need
to sort tasks ourselves as Windows will handle it in a relatively more
efficient manner, I guess. I am unsure if Zed would welcome this PR, and
suggestions are welcome.

Release Notes:

- N/A
2024-03-14 15:13:26 -07:00
Marshall Bowers
4939d23bd3
Enable clippy::derive_ord_xor_partial_ord (#9371)
This PR enables the
[`clippy::derive_ord_xor_partial_ord`](https://rust-lang.github.io/rust-clippy/master/index.html#/derive_ord_xor_partial_ord)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-14 17:55:57 -04:00
Mikayla Maki
35c9216ed7
Fix window restoration bugs (#9358)
- [x] fixes https://github.com/zed-industries/zed/issues/9349
- [x] fixes https://github.com/zed-industries/zed/issues/4656
- [x] fixes https://github.com/zed-industries/zed/issues/8345

Release Notes:

- TODO
2024-03-14 14:25:12 -07:00
Marshall Bowers
14cdafb0a8
Enable clippy::eq_op (#9369)
This PR enables the
[`clippy::eq_op`](https://rust-lang.github.io/rust-clippy/master/index.html#/eq_op)
rule and fixes the outstanding violations.

Enabling this rule seems to have caught two bugs!

Release Notes:

- N/A
2024-03-14 17:05:07 -04:00
Marshall Bowers
404adbce5b
Encode rem values derived from pixels using rems_from_px (#9367)
This PR adds a new `rems_from_px` helper function that can be used to
compute rem values based on a pixel value.

This is something we do fairly commonly, where we want to express a size
that is a given pixel size at the base rem size (e.g., "14px when the
rem size is 16px").

`rems_from_px` helps make the intent more explicit, as well as prevent
the base rem size from being duplicated everywhere.

Note: Ideally we would want `rems_from_px` to be `const`, but that
depends on https://github.com/rust-lang/rust/issues/57241.

Release Notes:

- N/A
2024-03-14 16:39:55 -04:00
Marshall Bowers
7f3f296e81
Enable clippy::await_holding_lock (#9362)
This PR enables the
[`clippy::await_holding_lock`](https://rust-lang.github.io/rust-clippy/master/index.html#/await_holding_lock)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-14 15:24:19 -04:00
Conrad Irwin
b0ce25b67a
Log numbers as numbers (#9363)
Release Notes:

- N/A
2024-03-14 12:58:00 -06:00
Kirpal Grewal
61225ecef7
Enable clippy::never_loop (#9006)
Three changes: two of which are changing `while let` construct to `if
let` as they unconditionally broke and one of which was removing a loop
in the `start_default_prettier` as it unconditionally broke in the
control flow for match installation task: the diff for this is larger
than needed as removing the loop changed a lot of indentation for
`rustfmt`.
2024-03-14 14:07:50 -04:00
Conrad Irwin
60044a5f56
Fix panic by preventing opening local files in a remote project (#9304)
Release Notes:

- Fixed a panic caused by allowing the CLI to re-use workspaces

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-14 13:51:33 -04:00
张小白
cbf960e979
Windows: make fs to use workspace windows crate (#9350)
Release Notes:

- N/A
2024-03-14 10:43:06 -07:00
Marshall Bowers
a183c33367
Prevent long extension descriptions from overflowing (#9348)
This PR fixes an issue where long extension descriptions could take up
more room than intended, pushing the GitHub repository icon off the
screen.

<img width="901" alt="Screenshot 2024-03-14 at 12 54 14 PM"
src="https://github.com/zed-industries/zed/assets/1486634/befce468-f8df-4183-b3cc-9d088dd53b4e">

Fixes #9331.

Release Notes:

- Fixed an issue where long extension descriptions could push the GitHub
repository icon off the screen
([#9331](https://github.com/zed-industries/zed/issues/9331)).
2024-03-14 13:06:42 -04:00
Marshall Bowers
3610b076a0
Restore --all-targets for clippy (#9346)
This PR restores the `--all-targets` flag when running `cargo clippy`.

Without it, there are areas that Clippy does not check, as evidenced by
the violations that were caught once the flag was re-added.

Release Notes:

- N/A
2024-03-14 12:39:45 -04:00
Piotr Osiewicz
5f02ef701d
fs: Remove unused import (#9344)
Followup to #9341 as I've noticed a CI failure on bundling step of my
other PR
(https://github.com/zed-industries/zed/actions/runs/8283419386/job/22666698264)
Release Notes:

- N/A
2024-03-14 16:55:32 +01:00
Antonio Scandurra
fab55486f5
Fix project search filtering on projects with multiple worktrees (#9337)
Fixes #9285

Release Notes:

- Fixed a bug that broke search filtering when searching a project with
multiple worktrees
([#9285](https://github.com/zed-industries/zed/issues/9285)).

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-03-14 16:40:48 +01:00
Thorsten Ball
7629c16162
Always read files to string on a background thread (#9341)
We noticed that when you open a lot of files (i.e. project-wide search
with multi-buffer) that the main thread can become unresponsive, because
while we are async, we still load these files on the main thread.

What this change does is it uses `smol::unblock` to load files on a
different thread.

Release Notes:

- Improved responsiveness when loading files into memory.

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Kirill <kirill@zed.dev>
2024-03-14 16:17:12 +01:00
Thorsten Ball
c015baa638
Do not start searching if query is empty (#9333)
This avoids the problem of a search being kicked off involuntarily and
potentially using a large amount of CPU when toggling on the `Search
Ignored Files` option.

What would happen is that someone would turn the option on, we'd kick
off a search, and go through all of the files in, say, `node_modules`.
Even if no query was given.

This avoids that.

Release Notes:

- Fixed an empty search being kicked off involuntarily if no query was
typed in yet but an option was toggled.
2024-03-14 15:06:00 +01:00
Kirill Bulatov
f142568172
Allow navigating back to multibuffers (#9334)
Fixes
https://github.com/orgs/zed-industries/projects/14/views/1?pane=issue&itemId=56263346

Fixes a state where Zed multi buffers were not reachable after going to
an excerpt inside it (with alt-enter).
I suspect, we will have to come back to multi buffer history and check
the way it behaves on inner excerpts clicking, but now this change seems
to restore the main thing: multi buffers not being shown in the history
at all.



Release Notes:

- Fixes "go backwards" not considering multibuffers in history
2024-03-14 15:05:08 +02:00
Piotr Osiewicz
b795b0eb77
editor: Do not autoindent on line removals in vim mode. (#9332)
Fixes #8942

Release Notes:

- Fixed overeager auto-indentation on line removals in Vim mode.
2024-03-14 13:23:33 +01:00
Antonio Scandurra
51261c553f
Fix double-clicking titlebar to zoom (#9323)
Fixes https://github.com/zed-industries/zed/issues/9300

This was a regression caused by not inserting a hitbox when a div only
had click listeners on it.

Release Notes:

- Fixed a regression that disabled double-clicking on the titlebar to
zoom the window.
([#9300](https://github.com/zed-industries/zed/issues/9300))
(preview-only)
2024-03-14 09:37:31 +01:00
Conrad Irwin
bffde43c12
Improve vim undo (#9317)
The important change here is to ensure that undo never lands you in
visual mode; but we also take care to restore the selection the same way
vim does (visual line goes to beginning of line, visual block to the top
left, etc.).

To help make this behaviour feel right we also group any deletions that
started insert mode with the first text inserted.

Fixes: #7521

Release Notes:

- vim: Improved undo. It will now restore you to normal mode in the same
position as vim, and group deletions caused by `c` or `s` with the
concomitant insert.
([#7521](https://github.com/zed-industries/zed/issues/7521)).
2024-03-13 23:12:12 -06:00
Andrew Lygin
6ae5274954
Scrollbar markers enhancements (#9080)
Several improvements in how various markers are displayed in the editor
scrollbar, as described in #9070, if you're ok with the proposal:
- Scrollbar has three columns:
  - 1st is for git markers
  - 2nd is for selections and search resulta highlightings
  - 3rd is for diagnostics
- Height of all markers is scaled, but there's a minimal allowed height
of 2px.
- Right border removed from both the scrollbar and thumb to make more
room for markers.

Release Notes:

- Improved scrollbar markers visualization (#9070).
2024-03-13 23:05:43 +02:00
Conrad Irwin
b65aa7e2a7
Fix accidental leak of text stack between frames (#9297)
Co-Authored-By: Max <max@zed.dev>
Co-Authored-By: Marshall <marshall@zed.dev>

Release Notes:

- Fixed a bug where text styles could leak between frames (preview only)

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
2024-03-13 15:03:45 -06:00
张小白
3274cc93df
Windows: impl WindowsDisplay (#9287)
Tested on my laptop, and I've noticed that when I move the window,
`WindowsPlatform::displays()` is being continuously called. Is this
intended?

Release Notes:

- N/A
2024-03-13 13:08:11 -07:00
张小白
36cbfbfb94
windows: Better keyboard input support (#9180)
### Description

Currently, there are some issues with input handling on Windows:

#### 1. Direct crash when encountering IME input.



https://github.com/zed-industries/zed/assets/14981363/598f7272-1948-4a42-99c5-2ef7b9162a1e


#### 2. Handling messages every 1/60 seconds in the main thread. Despite
being named "immediate_handle," it's not exactly immediate.

```rust
// actually halt here
let wait_result =
    unsafe { DCompositionWaitForCompositorClock(Some(&[self.inner.event]), INFINITE) };

// compositor clock ticked so we should draw a frame
if wait_result == 1 {
    unsafe { invalidate_thread_windows(GetCurrentThreadId()) };

    while unsafe { PeekMessageW(&mut msg, HWND::default(), 0, 0, PM_REMOVE) }.as_bool()
```

#### 3. According to Windows recommendations, character input should be
obtained using `WM_CHAR` instead of `WM_KEYDOWN`. Additionally, there
are problems with the handling within `WM_CHAR`.

```rust
fn handle_char_msg(&self, wparam: WPARAM) -> LRESULT {
        let mut callbacks = self.callbacks.borrow_mut();
        if let Some(callback) = callbacks.input.as_mut() {
            let modifiers = self.current_modifiers();
            let msg_char = wparam.0 as u8 as char; // these are u16 chars, cant treat them as u8
```

And, we don't handle `WM_SYSKEYDOWN` properly, which leads to `Alt + F4`
not working.

Release Notes:

- N/A
2024-03-13 12:10:22 -07:00
张小白
2abb5aeaf2
Fix crash when launching Zed.exe directly from target/debug dir (#9112)
As I described in #9111 , the PR fixs this crash.


Release Notes:

- N/A
2024-03-13 12:08:00 -07:00
Thorsten Ball
a56a260778
Add ability to specify binary path/args for rust-analyzer (#9293)
This fixes #9292 by adding a section to the language server settings
that allows users to specify the binary path and arguments with which to
start up a language server.

Example user settings for `rust-analyzer`:

```json
{
  "lsp": {
    "rust-analyzer": {
      "binary": {
        "path": "/Users/thorstenball/tmp/rust-analyzer-aarch64-apple-darwin",
        "arguments": ["--no-log-buffering"]
      }
    }
  }
}
```

Constraints:

* Right now this only allows ABSOLUTE paths.
* This is only used by `rust-analyzer` integration right now, but the
setting can be used for other language servers. We just need to update
the adapters to also respect that setting.



Release Notes:

- Added ability to specify `rust-analyzer` binary `path` (must be
absolute) and `arguments` in user settings. Example: `{"lsp":
{"rust-analyzer": {"binary": {"path": "/my/abs/path/rust-analyzer",
"arguments": ["--no-log-buffering"] }}}}`
([#9292](https://github.com/zed-industries/zed/issues/9292)).

Co-authored-by: Ricard Mallafre <rikitzzz@gmail.com>
2024-03-13 18:42:03 +01:00
Conrad Irwin
6655b964ab k8s syntax 2024-03-13 11:28:17 -06:00
Max Brunsfeld
724c19a223
Add a setting for custom associations between languages and files (#9290)
Closes #5178

Release Notes:

- Added a `file_types` setting that can be used to associate languages
with file names and file extensions. For example, to interpret all `.c`
files as C++, and files called `MyLockFile` as TOML, add the following
to `settings.json`:

    ```json
    {
      "file_types": {
        "C++": ["c"],
        "TOML": ["MyLockFile"]
      }
    }
    ```

As with most zed settings, this can be configured on a per-directory
basis by including a local `.zed/settings.json` file in that directory.

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-13 10:23:30 -07:00
Conrad Irwin
77de5689a3
Allow setting a channel for new users to auto-join (#9291)
Release Notes:

- Automatically add new users to the #zed channel
2024-03-13 11:11:31 -06:00
Julia
88e33a1dbe
Account for all hover heights & prevent un-hover between popovers (#9257)
Fixes https://github.com/zed-industries/zed/issues/5227
Fixes https://github.com/zed-industries/zed/issues/7304

Release Notes:

- Fixed an issue where not all editor hover popovers would be accounted
for when choosing to hover above or below the mouse cursor
([#5227](https://github.com/zed-industries/zed/issues/5227)).
- Fixed an issue where editor hover could be dismissed by moving the
mouse between hover popovers
([#7304](https://github.com/zed-industries/zed/issues/7304)).

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2024-03-13 12:55:15 -04:00
Antonio Scandurra
139bb3275a
Automatically reset cursor style when hit test changes (#9289)
Release Notes:

- N/A

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2024-03-13 17:21:25 +01:00
Joseph T. Lyons
7f0e373358 v0.128.x dev 2024-03-13 11:57:44 -04:00
Igal Tabachnik
6286d86262
Set the correct dispatch action for the double-click handler for the pane tab bar (#9221)
Fixes #9003

Release Notes:

- Fixed the double-click action on the terminal tab bar opening a new
buffer instead of a new terminal
([#9003](https://github.com/zed-industries/zed/issues/9003)).
2024-03-13 17:30:10 +02:00
Antonio Scandurra
fc9f84446a
Always stop propagation in div's scroll wheel listener (#9282)
Fixes #9274

This fixes a bug that was preventing the editor hover popovers from
being scrolled with the trackpad.

Release Notes:

- N/A
2024-03-13 15:48:22 +01:00
Kirill Bulatov
109482761b
Omit .git worktree indexing (#9281)
Closes https://github.com/zed-industries/zed/issues/9174

Release Notes:

- Fixed panics when `.git` was opened as a Zed worktree
([9174](https://github.com/zed-industries/zed/issues/9174))
2024-03-13 16:35:44 +02:00
Kirill Bulatov
572ba3f93b
Fall back to FindAllReferences if cmd-click did not preform GoToDefinition elsewhere (#9243) 2024-03-13 13:00:04 +02:00
Piotr Osiewicz
427d66990c
gpui: Do not emit MouseUpEvent when exiting drag & drop (#9273)
Fixes #9198

Release Notes:

- Fixed a bug where empty panes could be created during drag & drop.
2024-03-13 11:37:34 +01:00
Thorsten Ball
ac4bbb6135
Correctly re-render mouse cursor when hovering over pane group divider (#9270)
Before this change, the hitbox felt one-sided because the cursor didn't
consistently change into the drag-handle cursor.

The reason was that we didn't trigger a redraw on hover, so we'd only
change the cursor if we detected hover AND something else caused a
redraw.

Release Notes:

- Fixed the pane resize handler not consistently triggering on mouse
hover.

Co-authored-by: Antonio <antonio@zed.dev>
2024-03-13 10:57:10 +01:00
Thorsten Ball
754df9356d
Fix segfault when dropping MacWindow (#9267)
This avoids calling `window.setDelegate(nil)` when the window was
already closed.

Release Notes:

- Fixed a segfault that could show up when closing windows.

Co-authored-by: Antonio <antonio@zed.dev>
2024-03-13 10:41:25 +01:00
Thorsten Ball
3c28282108
Redraw when toggling between windows (#9236)
Before this change we didn't consistently trigger focus events when
toggling between with windows `Cmd-backtick`. We only triggered them
when the OS decided to trigger a redraw.

That lead to a nasty bug that showed up in Vim mode where a cursor would
still be active in the hidden window, even though it was deactivated.

One then had to manually try to trigger a focus event in the new window
to activate the cursor.

With this change, we call `cx.refresh` when the window activation status
changed which triggers focus events consistently and fixes this bug.

With logging we can observe this:

**BEFORE**:


https://github.com/zed-industries/zed/assets/1185253/e1ad8878-129c-44ba-9d8b-c720f9dca5b6


**AFTER**:


https://github.com/zed-industries/zed/assets/1185253/733fdadb-d1ea-47fe-a2c1-7b50af299cc0


Release Notes:

- Fixed focus not being consistently changed when switching between
multiple Zed windows via `Cmd-backtick`.

---------

Co-authored-by: Manu Raj <git@manuraj.dev>
Co-authored-by: Antonio <antonio@zed.dev>
2024-03-13 10:15:22 +01:00
Rajesh Malviya
80b80dfa78
gpui: Switch to x11rb (#9113)
Switch to using `x11rb` crate instead of current `xcb` crate for gpui's
x11 platform.

Also fixes the crash on resize, and white flashing on resize.

Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-12 21:47:08 -07:00
Joseph T. Lyons
47afc70979
Update Lua config.toml (#9260)
Release Notes:

- Added autoclosing of `(` and `'` in Lua.
2024-03-13 00:32:45 -04:00
Conrad Irwin
646f69583a
Allow opening non-extant files (#9256)
Fixes #7400



Release Notes:

- Improved the `zed` command to not create files until you save them in
the editor ([#7400](https://github.com/zed-industries/zed/issues/7400)).
2024-03-12 22:30:04 -06:00
Mikayla Maki
e792c1a5c5
Open new windows with a default size and position (#9204)
This PR changes GPUI to open windows with a default size and location,
and to otherwise inherit from their spawning window.

Note: The linux build now crashes on startup.

Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Ezekiel Warren <zaucy@users.noreply.github.com>
2024-03-12 21:19:51 -07:00
张小白
9a2dceeea1
windows: Support dropping targets with filenames longer than 260 characters (#9115)
use `Vec` instead of slice to support dynamic filename length.

Release Notes:
- N/A
2024-03-12 21:19:31 -07:00
Bennet Bo Fenner
fb83cf2042
notification panel: rework time formatting (#8997)
Follow up of #7994 to rework the notification panel timestamps.
This PR also includes some of the changes @evrsen proposed in #8996 
Here is what it looks like now:


https://github.com/zed-industries/zed/assets/53836821/d85450e7-eab6-4fe7-bd11-1d76c0e87258

Release Notes:
- Reworked date time formatting in the chat and the notification panel
- Added hover style to notifications and hovering tooltip on timestamps

---------

Co-authored-by: Evren Sen <146845123+evrsen@users.noreply.github.com>
2024-03-12 21:02:04 -06:00
bbb651
a105b5f215
Wayland: Remove bogus wl_surface::commits on resize (with integer scaling) (#9245)
Release Notes:
- N/A

This prevents a crash on sway (on older versions without fractional
scaling). This means the resize is delayed until the next this we
present a frame, we need to investigate if this is the correct this to
do.
2024-03-12 19:46:18 -07:00
Piotr Osiewicz
aeb2a98058
chore: Move new util deps to workspace level (#9250)
I've missed a comment from @maxdeviant on #9247 before hitting merge;
mea culpa

Release Notes:

- N/A
2024-03-13 00:37:10 +01:00
Piotr Osiewicz
34f09bae4f
chore: Clean up util dependencies. (#9247)
This allows this crate to start building sooner + it reduces our total
build graph size by 13 units (1104 -> 1091).

Release Notes:

- N.A
2024-03-13 00:10:49 +01:00
Kirill Bulatov
c09fe1ce8a
Do not allow concurrent FindAllReferences requests for the same multibuffer anchors (#9242)
FindAllReferences LSP requests might take a long time to complete, and
currently Zed allows multiple requests spawned concurrently for the same
Anchor in the multi buffer. That results in multiple search results'
multi buffers appearing, sometimes at once, which is not what we want.

Part of https://github.com/zed-industries/zed/issues/5351 that helps to
reduce the amount of search results after clicks that did not resolve
instantly.


Release Notes:

- Improved FindAllReferences action by not allowing concurrent requests
for the same multi buffer source
2024-03-12 23:02:34 +02:00
Max Brunsfeld
64219ba49f
When fetching extensions from blob store, don't halt on invalid extensions. (#9241)
This fixes an error where we were failing to sync extensions from the
blob store because of the presence of one invalid extensions
(`gentle-dark`), which was missing the `authors` field in its manifest.

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-12 16:36:40 -04:00
Conrad Irwin
05dfe96f0c
Add --add/--new to control CLI behaviour (#9202)
When neither is specified, if you open a directory you get a new
workspace, otherwise files are added to your existing workspace.

With --new files are always opened in a new workspace
With --add directories are always added to an existing workspace

Fixes #9076
Fixes #4861
Fixes #5370

Release Notes:

- Added `-n/--new` and `-a/--add` to the zed CLI. When neither is
specified, if you open a directory you get a new workspace, otherwise
files are added to your existing workspace. With `--new` files are
always opened in a new workspace, with `--add` directories are always
added to an existing workspace.
([#9076](https://github.com/zed-industries/zed/issues/9096),
[#4861](https://github.com/zed-industries/zed/issues/4861),
[#5370](https://github.com/zed-industries/zed/issues/5370)).
2024-03-12 14:27:58 -06:00
dalton-oliveira
41d8ba12ec
Remove wezterm fork from dependencie (#8998)
Improves build time by removing wezterm dependency
([#8604](https://github.com/zed-industries/zed/issues/8604)).

Release Notes:

- N/A
2024-03-12 21:27:40 +02:00
Antonio Scandurra
e7289c385d
Correctly show the shift icon for keybindings on macOS (#9235)
Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
2024-03-12 18:27:24 +01:00
Thorsten Ball
8c87b349dc
Show formatting failure (#9229)
This fixes #8072 and #9061 by surfacing formatting errors in the
activity indicator.

It shows a message in the activity indicator if the last attempt
to format a buffer failed.

It only keeps track of the last attempt, so any further formatting
that succeeds will reset or update the error message.

I chose to only keep track of that, because everything else (keeping
track of formatting state per buffer, per project, per worktree) seems
complicated with little benefit, since we'd have to keep track of that
state, update it, clean it, etc.

We can still do that should we decide that we need to keep track
of the state on a per-buffer basis, but I think for now this is a
good, simple solution.

This also changes the `OpenLog` action to scroll to the end of the
buffer
and to not mark the buffer as dirty.


Release Notes:

- Added message to activity indicator if last attempt to format a buffer
failed. Message will get reset when next formatting succeeds. Clicking
on message opens log with more information.
([#8072](https://github.com/zed-industries/zed/issues/8072) and
[#9061](https://github.com/zed-industries/zed/issues/9061)).
- Changed `zed: Open Log` action to not mark the opened log file as
dirty and to always scroll to the bottom of the log.


https://github.com/zed-industries/zed/assets/1185253/951fb9ac-8b8b-483a-a46d-712e52878a4d
2024-03-12 16:30:08 +01:00
Antonio Scandurra
39a0841ea8
Center dock resize handle hitboxes (#9225)
Also, add a `deferred` function which takes an element to paint after
the current element tree.

Release Notes:

- Improved the size and position of the hitbox for resizing left, right,
and bottom panels.
([#8855](https://github.com/zed-industries/zed/issues/8855))

Co-authored-by: Julia <julia@zed.dev>
Co-authored-by: Nathan <nathan@zed.dev>
2024-03-12 15:42:18 +01:00
Antonio Scandurra
409aa513d4
Fix mouse interactions with the project and branch switchers (#9222)
Previously, we were considering the mouse to be "out" of a div when its
hitbox wasn't hovered. However, if a parent listened for
"mouse_down_out" and a child occluded the parent, the parent would
always think the mouse was out even when the user clicked the child.

This commit changes the definition of "mouse out" to simply mean "does
not contain the point", without accounting for occlusion.

Release Notes:

- N/A

Co-authored-by: Julia <julia@zed.dev>
2024-03-12 15:30:27 +01:00
Antonio Scandurra
d5796dc5eb
Show only prefix/suffix if there are more than 12 breadcrumbs (#9220)
Fixes https://github.com/zed-industries/zed/issues/9079

This should fix the arena panic we were observing. I saw that breadcrumb
rendering was on the stack trace for some of the panics, so my suspicion
is that it's being caused by some people navigating into deeply nested
files.

Release Notes:

- Fixed a panic that could occur when displaying too many breadcrumbs.
([#9079](https://github.com/zed-industries/zed/issues/9079))
2024-03-12 14:33:12 +01:00
Thorsten Ball
9f396948bb
Improve error messages when fetching single GitHub release (#9219)
Release Notes:

- N/A
2024-03-12 14:12:44 +01:00
Piotr Osiewicz
e103607134
copilot: Track focus of modal + close modal on ESC (#9217)
I've also made Copilot's modal regain focus whenever you click on it, as
otherwise there's nothing inside of it that can gain focus. Clicks do
not fall through a modal, which I think is nice.



Release Notes:

- Fixed the issue where pressing ESC (`menu::Cancel`) did not exit the
Copilot modal. Fixes #8852
2024-03-12 13:08:55 +01:00
Antonio Scandurra
0a341261d0
Insert hitbox when an interactive element can be scrolled (#9216)
Fixes https://github.com/zed-industries/zed/issues/9199


Release Notes:

- N/A
2024-03-12 12:24:15 +01:00
Bennet Bo Fenner
d362588055
markdown preview: highlight code blocks (#9087)
![image](https://github.com/zed-industries/zed/assets/53836821/e20acd87-9680-4e1c-818d-7ae900bf0e31)

Release Notes:

- Added syntax highlighting to code blocks in markdown preview
- Fixed scroll position in markdown preview when editing a markdown file
(#9208)
2024-03-12 12:54:12 +02:00
Remco Smits
e5bd9f184b
Fix prettier plugins does not seem to be picked up (#9193)
This fixed the issue that prettier plugins were not picked up. The old
code would always send an empty array to the prettier plugin that
happens inside the `prettier_server.js`.

**Before**
The `options.plugins` key is an empty array, which is not correct.
```log
stderr: Resolved config: {"singleQuote":true,"trailingComma":"all","plugins":["prettier-plugin-organize-imports"]}, will format file '/Users/remcosmits/Documents/code/prettier-test/src/app/page.tsx' with options: {"singleQuote":true,"trailingComma":"all","plugins":[],"parser":"typescript","path":"/Users/remcosmits/Documents/code/prettier-test/src/app/page.tsx"}
```


https://github.com/zed-industries/zed/assets/62463826/52f2aad0-2f96-43a9-81ec-9d4630c495b2

**After**
The `options.plugins` contains the `prettier-plugin-organize-imports`
plugin as expected.
```log
stderr: Resolved config: {"singleQuote":true,"trailingComma":"all","plugins":["prettier-plugin-organize-imports"]}, will format file '/Users/remcosmits/Documents/code/prettier-test/src/app/page.tsx' with options: {"singleQuote":true,"trailingComma":"all","plugins":["prettier-plugin-organize-imports"],"parser":"typescript","path":"/Users/remcosmits/Documents/code/prettier-test/src/app/page.tsx"}
```


https://github.com/zed-industries/zed/assets/62463826/9045028d-aeca-4df1-819c-01905d83216c


Release Notes:
- Fixed send plugins correctly to the prettier plugin
([#8841](https://github.com/zed-industries/zed/issues/8841)).
2024-03-12 11:38:30 +01:00
Thorsten Ball
98cf494057
Fix broken ESLint by pinning to 2.2.20-Insiders release (#9215)
This fixes #9213 by pinning ESLint to `2.2.20-Insiders` which is the
last known version to work well with Zed.

Once this fix is out, we can take a closer look at upgrading to 2.4.x or
even 3.x once that's out of prerelease.

Release Notes:

- Fixed ESLint integration being broken after Mar 7 2024 due to ESLint
3.0.1 alpha release being pushed.
([#9213](https://github.com/zed-industries/zed/issues/9213)).
2024-03-12 11:20:25 +01:00
Kirill Bulatov
3be1402a3d
Fix the double click and update the default settings (#9214) 2024-03-12 12:15:55 +02:00
Ivan Žužak
44adb0a316
Detect URLs at beginning and end of buffer as well (#9212)
Release Notes:

- Fixed URL detection at very beginning and very end of buffer
([#9210](https://github.com/zed-industries/zed/issues/9210)).

| Before | After |
| ------ | ----- |
| ![Screenshot 2024-03-12 at 07 09
52](https://github.com/zed-industries/zed/assets/38924/5c0beb28-f63b-4455-a5cd-31cec2d9a775)
| ![Screenshot 2024-03-12 at 07 11
03](https://github.com/zed-industries/zed/assets/38924/116f76a2-21e8-4c77-ac6e-a4e3c594b09d)
|
2024-03-12 07:59:32 +01:00
Marshall Bowers
14a0d8039b
ui: Center Checkbox within its container (#9201)
This PR fixes an issue with the `Checkbox` component where the checkbox
wasn't being centered within its container element.

The problem can be seen when applying a background color to the
container element:

#### Before

<img width="439" alt="Screenshot 2024-03-11 at 5 44 10 PM"
src="https://github.com/zed-industries/zed/assets/1486634/11704b1a-3c3e-4250-99c3-973fb442287a">

#### After

<img width="447" alt="Screenshot 2024-03-11 at 5 45 59 PM"
src="https://github.com/zed-industries/zed/assets/1486634/569a850b-4bd7-4711-8327-bf426fa5d265">

This resulted in issues where, under certain conditions, the checkbox
could get cut off, as seen in #8868.

Centering the checkbox fixes this issue:

<img width="305" alt="Screenshot 2024-03-11 at 5 51 00 PM"
src="https://github.com/zed-industries/zed/assets/1486634/14e5642f-59ad-4288-bc25-ea7da2a008a7">

Fixes #8868.

Release Notes:

- Fixed a positioning issue with checkboxes
([#8868](https://github.com/zed-industries/zed/issues/8868)).
2024-03-11 18:08:31 -04:00
Marshall Bowers
c0b1f74794
Inset ContextMenu headers (#9197)
This PR insets the headers within `ContextMenu`s to give them some more
breathing room.

#### Before

<img width="347" alt="Screenshot 2024-03-11 at 4 13 31 PM"
src="https://github.com/zed-industries/zed/assets/1486634/73a56d68-d40e-4396-b584-f443197b69d6">

#### After

<img width="354" alt="Screenshot 2024-03-11 at 4 12 43 PM"
src="https://github.com/zed-industries/zed/assets/1486634/44c12a07-0784-4c94-b194-245f5cf94b2b">

Release Notes:

- Added padding to headers in context menus.
2024-03-11 16:28:16 -04:00
Kirill Bulatov
02dcdd0228
Open excerpt on double click in multibuffer by default. (#9196)
Closes https://github.com/zed-industries/zed/issues/5275

Double click with `alt` modifier pressed will do the regular word
selection.

Adds a setting to disable this behavior and instead select a word, as in
the regular buffer.

```
// What to do when multibuffer is double clicked in some of its excerpts
// (parts of singleton buffers).
// May take 2 values:
//  1. Behave as a regular buffer and select the whole word.
//         "double_click_in_multibuffer": "select"
//  2. Open the excerpt clicked as a new buffer in the new tab (default).
//         "double_click_in_multibuffer": "open",
// For the case of "open", regular selection behavior can be achieved by holding `alt` when double clicking.
"double_click_in_multibuffer": "open",
```


Release Notes:

- Made multibuffer to open excerpts in new tabs on double click by
default (changing settings or keeping alt restores the word selection
behavior). ([5275](https://github.com/zed-industries/zed/issues/5275))
2024-03-11 22:06:06 +02:00
Marshall Bowers
25c471f9e4
Render + separators for keybindings on non-macOS platforms (#9194)
This PR adjusts the rendering of keybindings on non-macOS platforms to
have a `+` separator instead of just a blank space.

<img width="952" alt="Screenshot 2024-03-11 at 3 18 17 PM"
src="https://github.com/zed-industries/zed/assets/1486634/1573823d-4329-41f0-bef4-7a6c09f3e632">

<img width="584" alt="Screenshot 2024-03-11 at 3 16 25 PM"
src="https://github.com/zed-industries/zed/assets/1486634/aae41b22-dfde-40a6-9e0e-cee855522d3a">

Release Notes:

- N/A
2024-03-11 15:57:31 -04:00
Thorsten Ball
fe70a2646f
Fix relative glob patterns not working for language servers (#9179)
If a language server would send us a glob pattern like `**/*.rb` or
`**/{package.json}` we'd end up ignoring it and never sending the
language server any notifications, because we try to `strip_prefix` the
projects absolute path from the pattern, BUT if that path is not in the
pattern, we'd return `None`.

This change fixes that.

Release Notes:

- Fixed language server glob patterns for file watching being ignored if
they were relative patterns.

Co-authored-by: Bennet <bennetbo@gmx.de>
Co-authored-by: Remco <djsmits12@gmail.com>
2024-03-11 20:39:07 +01:00
Thorsten Ball
b2981f4baa
Fix completion-filtering by checking actual word boundaries & reduce Ruby word chars (#9170)
This fixes https://github.com/zed-industries/zed/issues/9069 by

1. reverting https://github.com/zed-industries/zed/issues/7819 
2. fixing completion filtering with regards to word boudaries

For (2) see explanation in commit message:

> Previously, this would only split words on upper-lower boundaries or
> on `_`/`-`.
> 
> The result was that we would filter out completions too aggressively.
> The filter works by taking a suggested completion, say `foo_bar_lol`,
split
> it up into words - `foo`, `bar, `lol` - and check whether any of the
words
> start with the same characters as what the user already typed: `fo`,
or `bar`,
> ...
> 
> In the case of Ruby, though, `:` wasn't considered a word boundary. If
the
> LSP would return `:foobar` when the user typed `:foo`, we'd check if
there are
> any completions that match `foo` (because that's the current word) but
> we'd compare against `foobar`, not `:` or `:foobar`.
> 
> With this change, we get more match candidates and thus more
completions in Ruby.

With that we can do (1) because we don't need these characters as word
characters anymore to trigger completions.

Release Notes:

- Fixed word boundaries in Ruby by restoring old behavior (`@`, `:`, ...
are no longer considered word characters)
([#9069](https://github.com/zed-industries/zed/issues/9069))
- Fixed completions being filtered out when they happened at word
boundaries on special characters (e.g. `:`)

---------

Co-authored-by: Max <max@zed.dev>
2024-03-11 20:38:37 +01:00
Marshall Bowers
f2aa183512
ui: Extend KeyBinding with support for displaying keybindings for other platforms (#9192)
This PR extends the `KeyBinding` component with support for displaying
keybindings for platforms other than macOS.

<img width="824" alt="Screenshot 2024-03-11 at 2 41 59 PM"
src="https://github.com/zed-industries/zed/assets/1486634/7108b17d-dfc3-42ee-9bfd-c58b334d7374">

Release Notes:

- N/A
2024-03-11 15:03:55 -04:00
Max Brunsfeld
dfcc143ead
Rename 'project_core' crate to 'worktree', make it just about worktrees (#9189)
This is just a refactor. I noticed that we now have a `project_core`
crate, which mainly contains the `Worktree` type and its private
helpers, plus the project's settings.

In this PR, I've renamed that crate to `worktree` and did some minor
simplification to its module structure. I also extracted a new
`WorktreeSettings` settings type from the `ProjectSettings`, so that the
worktree settings could live in the worktree crate. This way, the crate
is now exclusively about worktree logic.

Release Notes:

- N/A
2024-03-11 11:35:27 -07:00
Antonio Scandurra
2b67bb27cf Occlude only modal and not the space around it used to center it 2024-03-11 18:13:00 +01:00
Antonio Scandurra
91a0923fc4
Fix a few regressions related to the flicker fix (#9190)
This pull request fixes
https://github.com/zed-industries/zed/issues/9187 and fixes also ix a
rendering problem that would show cursors on the same plane:


![image](https://github.com/zed-industries/zed/assets/482957/208304a4-286a-4fd9-a3d8-e2913e3a3dc7)


Release Notes:

- N/A
2024-03-11 18:07:26 +01:00
Ivan Žužak
b4ddc83e85
Allow overriding font style and weight via experimental.theme_overrides in settings (#9122)
Release Notes:

- Added support for overriding the current theme's syntax font styles
and weights in settings
([#9121](https://github.com/zed-industries/zed/issues/9121)).

| Before | After |
| ------ | ----- |
| ![Screenshot 2024-03-09 at 22 20
01@2x](https://github.com/zed-industries/zed/assets/38924/c693468d-1e04-45b4-b7c0-869e2a22a44c)
| ![Screenshot 2024-03-09 at 22 21
09@2x](https://github.com/zed-industries/zed/assets/38924/d8b09676-dd8b-46ac-8e9d-6cf2094a9c7e)
|
2024-03-11 12:21:37 -04:00
Vitor Ramos
3bd9d14420
linux: Fix panic missing screen mode for crtc specified mode ID (#9106)
Fix panic caused by missing screen mode for specified crtc mode id #9105
by searching over all crtcs instead of using the first one which may be
invalid.
2024-03-11 09:04:05 -07:00
charles-r-earp
95b311cb90
linux: gpui add Keysym::ISO_Left_Tab (#9126)
Fixes #9089.

On linux, pressing shift and tab together can potentially produce
`ISO_Left_Tab`. This PR maps this key to "tab" with the shift modifier,
similar to `SHIFT_TAB_KEY` in gpui::platform::mac::events.

Note: The [default linux
keymaps](https://github.com/zed-industries/zed/blob/main/assets/keymaps/default-linux.json)
have shift-tab mapped to editor::TabPrev and ctrl-[ mapped to
editor::Outdent. Both actions appear to have the same effect.

Release Notes:

- Support shift-tab on linux (#9089).
2024-03-11 09:03:15 -07:00
Antonio Scandurra
8eea281288
Show modals on top of zoomed pane (#9183)
Release Notes:

- N/A
2024-03-11 16:57:17 +01:00
Kirill Bulatov
373a4e7614
Properly display deleted diff hunks (#9182)
Follow-up of https://github.com/zed-industries/zed/pull/9068 

Release Notes:

- Fixed removal diff hunks not being displayed properly in the editor
2024-03-11 17:53:45 +02:00
Piotr Osiewicz
f9f9f0670f
editor: Rearrange float operations in layout (#9176)
We were seeing weird layouts with large files, where - starting with
some verylargelineindex - lines were rendered at weird y offsets. It
turned out that in some cases we're doing operations on Pixel values of
different magnitude, which then led to wrong results in calculations.
This commit addresses some of these problems, visible at glance when
working with large plaintext files. I *did not* dig into things like
inlay hints or diagnostics to see if they are subject to the same
potential precision loss.

Fixes #5371 

Release Notes:

- Fixed editor layout for large files, where the lines might have been
laid out with incorrect Y offset from the top.
2024-03-11 16:46:20 +01:00
Joel Selvaraj
20d5f5e8da
linux: wayland cursor fixes (#9047)
Release Notes:

- Fixed wayland cursor style handling


In upcoming Gnome 46, cursor icon names are considerably changing. For
example: this commit
74e9b79471
removed/modified a lot of cursor names. Then some of the names were
reintroduced in this commit
6f64dc55dc.
I also tried upcoming KDE Plasma 6. Some of the cursor names are not
used commonly between Gnome and KDE. From my analysis, these set of
cursor names should be more widely available in both previous and
upcoming release of Gnome and KDE.

Also, If a cursor style is not available, let's fallback to default
cursor style. This avoids scenarios where we get stuck with special
cursor styles like IBeam/Resize* because the current cursor style is not
available. This will lead to an unpleasant/broken experience. Falling
back to default cursor seems to be more acceptable.
2024-03-11 08:38:52 -07:00
Thorsten Ball
f066dd268f
Fix race when language server registers for workspace/didChangeWatchedFiles (#9177)
This fixes #8896 by storing the `watched_paths` in a separate HashMap,
allowing us to handle the request even before we mark the language
server as running.

Downside is that we have yet another data structure for language
servers, but it also makes the `Running` enum case a bit smaller.

And it fixes the race condition.

Release Notes:

- Fixed language servers not being notified of file changes if language
server registers for file-notification right after starting up.
([#8896](https://github.com/zed-industries/zed/issues/8896)).

Co-authored-by: Bennet <bennetbo@gmx.de>
Co-authored-by: Remco <djsmits12@gmail.com>
2024-03-11 16:30:30 +01:00
白山風露
a04932c4eb
Windows: fix crash with unhandled window (#9164)
On Windows, some windows may be created that are not managed by the
application.
For example, the Japanese IME creates pop-ups like this one.

<img width="325" alt="image"
src="https://github.com/zed-industries/zed/assets/6465609/503aaa0a-7568-485a-a138-e689ae67001c">

The internal data associated with such a window is different from
`WindowsWindowInner` and will crash if referenced.
Therefore, before calling `try_get_window_inner`, it checks if it is an
owned window.


Release Notes:

- N/A
2024-03-11 08:28:18 -07:00
Antonio Scandurra
ceadb39c38
Prevent text from wrapping in code actions menu (#9178)
Right now we're basing the width of the menu on the longest code action
title. That is only an approximation and doesn't always coincide
perfectly with the true, longest code action.

Given that it's pretty close, however, this commit simply disables text
wrapping on the code action menu.

Release Notes:

- Fixed a rendering glitch that could cause code actions to not display
correctly ([#8341](https://github.com/zed-industries/zed/issues/8341))
2024-03-11 16:25:17 +01:00
白山風露
2244419dfd
Add missed pad (#9175)
Sorry I missed explicitly `Quad::pad` insertion at #9172.

The struct layout is unchanged and does not affect the behavior.

Release Notes:

- N/A
2024-03-11 08:21:52 -07:00
Bennet Bo Fenner
a8fa1f7363
chat: fix emoji completions when word consists of emojis (#9107)
https://github.com/zed-industries/zed/assets/53836821/f4b31c47-d306-43f5-b971-0969f64a48f9

Fix for #9096 @JosephTLyons 

Release Notes:
- Fixed emoji completion not showing up when word contains only emojis
(#9096)
2024-03-11 09:08:18 -06:00
白山風露
eb5e18c66d
Fix blade validation failure (#9172)
Fix: #9167

Release Notes:

- N/A
2024-03-11 08:06:20 -07:00
Antonio Scandurra
830e107921
Hide hover popover when mouse hovers over negative space (#9173)
Fixes https://github.com/zed-industries/zed/issues/8340

Release Notes:

- Fixed a bug that would cause hover information to not be dismissed
when hovering over negative space.
2024-03-11 15:29:44 +01:00
Piotr Osiewicz
45c4d35da8 rope: Preallocate chunks buffer
This commit also specializes 'fn push' for large text quantities. That specialized version uses a Vec instead of SmallVec.
This commit shaves off about ~100ms out of 800ms when loading a 600Mb text buffer.
2024-03-11 13:28:10 +01:00
Antonio Scandurra
298314d526
Fix regressions introduced by flicker fix (#9162)
This pull request fixes a couple of easy regressions we discovered right
after using #9012 on nightly:

- Popover buttons for a chat message were being occluded by the message
itself.
- Scrolling was not working on the `List` element.

Release Notes:

- N/A
2024-03-11 12:11:51 +01:00
Kirill Bulatov
2f6c78b0c0
Fix incorrect outline selections after submit (#9160)
Follow-up of https://github.com/zed-industries/zed/pull/9153

Release Notes:

- N/A
2024-03-11 12:07:42 +02:00
Antonio Scandurra
4700d33728
Fix flickering (#9012)
See https://zed.dev/channel/gpui-536

Fixes https://github.com/zed-industries/zed/issues/9010
Fixes https://github.com/zed-industries/zed/issues/8883
Fixes https://github.com/zed-industries/zed/issues/8640
Fixes https://github.com/zed-industries/zed/issues/8598
Fixes https://github.com/zed-industries/zed/issues/8579
Fixes https://github.com/zed-industries/zed/issues/8363
Fixes https://github.com/zed-industries/zed/issues/8207


### Problem

After transitioning Zed to GPUI 2, we started noticing that interacting
with the mouse on many UI elements would lead to a pretty annoying
flicker. The main issue with the old approach was that hover state was
calculated based on the previous frame. That is, when computing whether
a given element was hovered in the current frame, we would use
information about the same element in the previous frame.

However, inspecting the previous frame tells us very little about what
should be hovered in the current frame, as elements in the current frame
may have changed significantly.

### Solution

This pull request's main contribution is the introduction of a new
`after_layout` phase when redrawing the window. The key idea is that
we'll give every element a chance to register a hitbox (see
`ElementContext::insert_hitbox`) before painting anything. Then, during
the `paint` phase, elements can determine whether they're the topmost
and draw their hover state accordingly.

We are also removing the ability to give an arbitrary z-index to
elements. Instead, we will follow the much simpler painter's algorithm.
That is, an element that gets painted after will be drawn on top of an
element that got painted earlier. Elements can still escape their
current "stacking context" by using the new `ElementContext::defer_draw`
method (see `Overlay` for an example). Elements drawn using this method
will still be logically considered as being children of their original
parent (for keybinding, focus and cache invalidation purposes) but their
layout and paint passes will be deferred until the currently-drawn
element is done.

With these changes we also reworked geometry batching within the
`Scene`. The new approach uses an AABB tree to determine geometry
occlusion, which allows the GPU to render non-overlapping geometry in
parallel.

### Performance

Performance is slightly better than on `main` even though this new
approach is more correct and we're maintaining an extra data structure
(the AABB tree).


![before_after](https://github.com/zed-industries/zed/assets/482957/c8120b07-1dbd-4776-834a-d040e569a71e)

Release Notes:

- Fixed a bug that was causing popovers to flicker.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Thorsten <thorsten@zed.dev>
2024-03-11 10:45:57 +01:00
Yanguk
9ff3cff6f8
Respect eslint.nodePath setting (#9073)
I'm using Yarn Plug'n'Play.
In this case, by default, eslint cannot find the path, so configuration
like `"eslint.nodePath": ".yarn/sdks"` is required.
So, I want to add this!

Release Notes:

- Added eslint config nodePath
2024-03-11 10:15:06 +01:00
Hans
269848775c
Fix Vim code formating (#9098)
- N/A
2024-03-11 10:03:51 +02:00
Andrew
39bd12a557
gpui: add set menus example (#9131)
Add an example showing how to add a menu item, register an action with
the `AppContext`, and successfully call the action.

Release Notes:

- N/A
2024-03-11 09:56:45 +02:00
Max
e1f8a1e8b2
Fix <!DOCTYPE html> syntax highlighting (#9108)
Release Notes:

- Added `<!DOCTYPE html>` syntax highlighting ([4318](https://github.com/zed-industries/zed/issues/4318))
2024-03-11 09:56:35 +02:00
Kirill Bulatov
41dc5fc412
Allow highlighting editor rows from multiple sources concurrently (#9153) 2024-03-11 02:17:32 +02:00
Thorsten Ball
f4a86e6fea
Always single-quote directory when cd'ing to get shell env (#9145)
This avoids us potentially executing code (if someone were to name their
directory `$(echo you-are-pwned > /secure-files)`, for example).

Works with zsh, bash, fish, nushell. Tested locally with all of them.

Release Notes:

- N/A
2024-03-10 13:53:24 +01:00
Kirill Bulatov
597465b0f5
Slightly simplify editor highlights code (#9123)
Prepare for git diff hunk highlights by grouping all inlay highlight
properties into one struct, and removing the dead background highlight
code.


Release Notes:

- N/A
2024-03-10 00:38:45 +02:00
Max
ccc939124f
Remove obsolete separator (#9117) 2024-03-09 15:33:19 -05:00
Joseph T. Lyons
a03fecafbb
Remove feedback button from status bar (#9100)
This PR removes the feedback button from the status bar, as Nathan and I
discussed. We discussed the fact that we likely no longer need to take
up valuable screen real estate for this, with where Zed as at now.

This PR also moves the `Share Feedback...` collab menu item to the
`Help` menu, as that's where VS Code puts their action to send in-app
feedback (which might help with future discoverability) and renames it
to `Give Feedback...`, to make it consistent with the name of the
command palette action.

Release Notes:

- Removed the feedback button from the status bar.
2024-03-09 06:15:08 -05:00
Mikayla Maki
ca696fd5f6
Add rs-notify implementation of fs::watch (#9040)
This PR simplifies the Zed file system abstraction and implements
`Fs::watch` for linux and windows.

TODO:
- [x] Figure out why this fails to initialize the file watchers when we
have to initialize the config directory paths, but succeeds on
subsequent runs.
- [x] Fix macOS dependencies on old fsevents::Event crate

Release Notes:

- N/A
2024-03-08 22:18:44 -08:00
Jason Wen
456efb53ad
windows: Add file dialog using IFileOpenDialog (#8919)
Release Notes:

- Added a file dialog for Windows
2024-03-08 20:07:48 -08:00
Adam
d4ec78f328
Add strikethrough to deprecated methods in CompletionsMenu (#9086)
Release Notes:

- Added ([#8390](https://github.com/zed-industries/zed/issues/8390)).
- Also Grays out deprecated methods

Before

<img width="730" alt="image"
src="https://github.com/zed-industries/zed/assets/71665039/8b5e8009-22c2-43f7-b85b-79e571a5d282">

After

<img width="773" alt="image"
src="https://github.com/zed-industries/zed/assets/71665039/0aff572b-6d3f-4ed9-b08b-d925ee650817">
2024-03-08 20:01:28 -08:00
bbb651
efe5203a09
GPUI: Wayland: Add fullscreen, minimize and avoid unnecessary resizes (#9060)
Release Notes:
- N/A
2024-03-08 19:52:36 -08:00
Kirill Bulatov
146971fb02
Splice remove suggesion hints when those are cleared in the editor. (#9088)
Closes https://github.com/zed-industries/zed/issues/6793

Release Notes:

- Fixed copilot suggestions not disappearing after disabling the tool
([6793](https://github.com/zed-industries/zed/issues/6793))
2024-03-09 02:00:01 +02:00
Kirill Bulatov
347178039c
Add editor::RevertSelectedHunks to revert git diff hunks in the editor (#9068)
https://github.com/zed-industries/zed/assets/2690773/653b5658-e3f3-4aee-9a9d-0f2153b4141b

Release Notes:

- Added `editor::RevertSelectedHunks` (`cmd-alt-z` by default) for
reverting git hunks from the editor
2024-03-09 01:37:24 +02:00
Jadi
6a7a3b257a
Add missing docstrings to settings.rs (#9054)
![image](https://github.com/zed-industries/zed/assets/1290639/46c13110-8506-4b03-91d4-b1cfcafe824a)

Add documentation for theme-related settings.

Release Notes:

- Add documentation for theme-related settings ([8383](https://github.com/zed-industries/zed/issues/8383))
2024-03-09 00:46:47 +02:00
Max Brunsfeld
8a6264d933
Provide wasm extensions with APIs needed for using pre-installed LSP binaries (#9085)
In this PR, we've added two new methods that LSP extensions can call:
* `shell_env()`, for retrieving the environment variables set in the
user's default shell in the worktree
* `which(command)`, for looking up paths to an executable (accounting
for the user's shell env in the worktree)

To test this out, we moved the `uiua` language support into an
extension. We went ahead and removed the built-in support, since this
language is extremely obscure. Sorry @mikayla-maki. To continue coding
in Uiua in Zed, for now you can `Add Dev Extension` from the extensions
pane, and select the `extensions/uiua` directory in the Zed repo. Very
soon, we'll support publishing these extensions so that you'll be able
to just install it normally.

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-08 17:18:06 -05:00
Jason Lee
5abcc1c3c5
Let LineColumn on StatusBar as clickable to open GoToLineColumn (#9002)
Release Notes:

- Added to let LineColumn on StatusBar as clickable to open
GoToLineColumn.
- Added placeholder to GoToLineColumn input, and show help message on
input changed.

## Screenshot


![go-to-line-column](https://github.com/zed-industries/zed/assets/5518/90a4f644-07d4-4208-8caa-5510e1537f37)
2024-03-08 14:11:17 -07:00
Conrad Irwin
977af37cfe
open zed urls (#9081)
Release Notes:

- Added support for opening files on the zed protocol `open
zed:///Users/example/Desktop/a.txt`
([#8482](https://github.com/zed-industries/zed/issues/8482)).
2024-03-08 13:44:01 -07:00
Evren Sen
1756c1fc1e
Improve UI of popover buttons when hovering over chat messages (#9041)
### Before


https://github.com/zed-industries/zed/assets/146845123/4a16c1ce-a671-4e39-abc9-3a0cb25bc0cd

### After


https://github.com/zed-industries/zed/assets/146845123/cfab3d00-246e-427d-9c40-8ee520a0a186




Release Notes:
- Improved the UI of popover buttons when hovering over chat messages.
2024-03-08 12:46:51 -07:00
Max Brunsfeld
51ebe0eb01
Allow wasm extensions to do arbitrary file I/O in their own directory to install language servers (#9043)
This PR provides WASM extensions with write access to their own specific
working directory under the Zed `extensions` dir. This directory is set
as the extensions `current_dir` when they run. Extensions can return
relative paths from the `Extension::language_server_command` method, and
those relative paths will be interpreted relative to this working dir.

With this functionality, most language servers that we currently build
into zed can be installed using extensions.

Release Notes:

- N/A
2024-03-08 08:49:27 -08:00
张小白
a550b9cecf
Impl prompts and savefile dialog on Windows (#9009)
### Description
This is a part of #8809 , and this PR dose not include `open file
dialog`, as I already saw two PRs impl this.



https://github.com/zed-industries/zed/assets/14981363/3223490a-de77-4892-986f-97cf85aec3ae




Release Notes:

- N/A
2024-03-08 08:14:47 -08:00
Piotr Osiewicz
bf295eac90 Task::spawn now takes an optional task name as an argument.
If it is not set, we fall back to opening a modal. This allows user to spawn tasks via keybind.
2024-03-08 15:28:42 +01:00
Piotr Osiewicz
7b73e2824b
fs: allocate backing storage once in Fs::load (#9020)
`futures_lite::AsyncReadExt::read_to_string` (that we use in
`RealFs::load`) explicitly does not allocate memory for String contents
up front, which leads to excessive reallocations. That reallocation time
is a significant contributor to the time we spend loading files (esp
large ones). For example, out of ~1s that it takes to open up a 650Mb
ASCII buffer on my machine (after changes related to fingerprinting from
#9007), 350ms is spent in `RealFs::load`.
This change slashes that figure to ~110ms, which is still *a lot*. About
60ms out of 110ms remaining is spent zeroing memory. Sadly,
`AsyncReadExt` API forces us to zero a buffer we're reading into
(whether it's via read_to_string or read_exact), but at the very least
this commit alleviates unnecessary reallocations.

We could probably use something like
[simdutf8](https://docs.rs/simdutf8/latest/simdutf8/) to speed up UTF8
validation in this method as well, though that takes only about ~18ms
out of 110ms, so while it is significant, I've left that out for now.
Memory zeroing is a bigger problem at this point.

Before:

![image](https://github.com/zed-industries/zed/assets/24362066/5e53c004-8a02-47db-bc75-04cb4113a6bc)

After:

![image](https://github.com/zed-industries/zed/assets/24362066/00099032-d647-4683-b290-eaeb969cac4a)

/cc @as-cii 

Release Notes:

- Improved performance when loading large files.
2024-03-08 14:40:26 +01:00
Conrad Irwin
ed8aa6d200
Fix panic in layout_line when Y coordinate is too high (#9052)
Release Notes:

- N/A
2024-03-07 22:33:44 -07:00
Valentine Briese
af564242e1
Make comment above util::fs::remove_matching a doc comment (#9051)
Just this one little thing, noticed it while working on an unrelated
pull request.

Release Notes:

- N/A
2024-03-07 21:15:52 -08:00
EricApostal
aa7be4b5d8
Add clipboard support for Windows (#8978)
Release Notes:

- Added Read / Write clipboard support to Windows via copypasta

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-07 20:16:38 -08:00
Conrad Irwin
866d791760
Fix joining hosted projects (#9038)
Release Notes:

- N/A
2024-03-07 19:56:41 -07:00
Rom Grk
f67abd2943
vim: smartcase find option (#9033)
Release Notes:

- Added option `use_smartcase_find` to the vim-mode
2024-03-07 19:44:20 -07:00
Rom Grk
d247086b21
vim: subword motions (#8725)
Add subword motions to vim, inspired by
[nvim-spider](https://github.com/chrisgrieser/nvim-spider),
[CamelCaseMotion](https://github.com/bkad/CamelCaseMotion).


Release Notes:

- Added subword motions to vim
2024-03-07 19:36:12 -07:00
rauan
467a179837
Add Elixir symbols in outline view (#8761)
Release Notes:

- Improved: Add `@callback`, `@type` and `@typep` Elixir symbols in
outline view



https://github.com/zed-industries/zed/assets/14976415/208d3def-f49e-41e0-a306-fb8e00317e6b
2024-03-07 19:35:01 -07:00
Small White
b50f86735f
Impl drag-drop action for Windows (#8959)
### Description

This is a part of #8809 



https://github.com/zed-industries/zed/assets/14981363/2b085b9d-8b83-4ac7-8b84-07c679760eba




Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-07 15:59:48 -08:00
Small White
e85d484952
Fix terminal on Windows (#8999)
### Description

Since [this PR](https://github.com/alacritty/alacritty/pull/7796) has
been merged, so we can delete the `todo`s in `terminal` module.


Release Notes:

- N/A
2024-03-07 15:54:58 -08:00
Rom Grk
2d83580df4
linux: enable test TextSystem (#9037)
Make text tests work on linux.
2024-03-07 15:51:52 -08:00
Kirill Bulatov
ffebe2e4a6
Initial Linux nightly bundles upload (#8913)
Changes Zed CI to build and upload Linux nightly bundles.

* `todo!(linux)` are replaced with `TODO linux` to make `todo!`-based
workflows more convenient
* renames `run-build-dmg` label into `run-bundling`, also renames a few
GH Actions entries to be more generic
* make another upload path for Linux, which keeps a separate file with SHA to version the nightly artifact.
* adds a `*.deb` package building with a couple of caveats, marked with
new `TODO linux` entries:

1. `cargo-bundle` is not very flexible, so it generates artifacts with
the structure and names that we're unable to alter before/during the
generation.
For that, a set of extra steps is made by repacking the *.deb package —
this is not very portable between different Linux distros, so later one
needs to find a way to combine multiple package types in this script.

2. `cargo-bundle` is not able to properly generate the *.msi bundle
despite declaring it in the features:
https://github.com/burtonageo/cargo-bundle/issues/116
Windows needs to invent its own way of bundling or fix the tool.

3. Both `cli` and `zed` binaries are added into the archive under
`/usr/local/bin/` path with their `-$channel` suffix
(-nightly/-preview/-dev/-stable) and a `/usr/local/bin/zed ->
/usr/local/bin/cli-nightly` symlink is made to make CLI work as Zed
launcher:
```
~/work/zed kb/linux-nightly:origin/kb/linux-nightly*​ ❯ dpkg -c target/zed_amd64.deb 
drwxr-xr-x allaptop/allaptop 0 2024-03-06 00:53 ./
drwxr-xr-x allaptop/allaptop 0 2024-03-06 00:53 ./usr/
drwxr-xr-x allaptop/allaptop 0 2024-03-06 00:53 ./usr/local/
drwxr-xr-x allaptop/allaptop 0 2024-03-06 00:53 ./usr/local/bin/
-rwxr-xr-x allaptop/allaptop 8746832 2024-03-06 00:53 ./usr/local/bin/cli-nightly
-rwxr-xr-x allaptop/allaptop 689078560 2024-03-06 00:53 ./usr/local/bin/zed-nightly
drwxr-xr-x allaptop/allaptop         0 2024-03-06 00:53 ./usr/share/
drwxr-xr-x allaptop/allaptop         0 2024-03-06 00:53 ./usr/share/applications/
-rw-r--r-- allaptop/allaptop       153 2024-03-06 00:53 ./usr/share/applications/zed.desktop
drwxr-xr-x allaptop/allaptop         0 2024-03-06 00:53 ./usr/share/icons/
drwxr-xr-x allaptop/allaptop         0 2024-03-06 00:53 ./usr/share/icons/hicolor/
drwxr-xr-x allaptop/allaptop         0 2024-03-06 00:53 ./usr/share/icons/hicolor/1024x1024@2x/
drwxr-xr-x allaptop/allaptop         0 2024-03-06 00:53 ./usr/share/icons/hicolor/1024x1024@2x/apps/
-rw-r--r-- allaptop/allaptop    716288 2024-03-06 00:53 ./usr/share/icons/hicolor/1024x1024@2x/apps/zed.png
drwxr-xr-x allaptop/allaptop         0 2024-03-06 00:53 ./usr/share/icons/hicolor/512x512/
drwxr-xr-x allaptop/allaptop         0 2024-03-06 00:53 ./usr/share/icons/hicolor/512x512/apps/
-rw-r--r-- allaptop/allaptop    239870 2024-03-06 00:53 ./usr/share/icons/hicolor/512x512/apps/zed.png
lrwxrwxrwx allaptop/allaptop         0 2024-03-06 00:53 ./usr/local/bin/zed -> /usr/local/bin/cli-nightly
```

But the CLI does not work under Linux yet and there's no way to install
that CLI from Zed now; Zed binary itself is not able to open
`file/location:12:34`-like things and set up the env properly, but is
able to start or open a directory.

So, this structure can be considered temporary and changed, if needed.

4. Zed Nightly on Linux does not know how to update itself, so all
nightly publishing is not picked up automatically.

5. Rust cache from `main` builds does not get shared between CI jobs,
due to being run in a different CI job that forms a different CI key, so
```
      - name: Cache dependencies
        uses: swatinem/rust-cache@v2
        with:
          save-if: ${{ false }}
```
would not work.
This makes Linux bundling jobs long.

Release Notes:

- N/A
2024-03-07 23:22:53 +02:00
Conrad Irwin
e85f190128
Fix 0 notes versions being always unread (#9030)
Co-Authored-By: Max <max@zed.dev>
Co-Authored-By: Nathan <nathan@zed.dev>

Release Notes:

- Fixed empty notes always showing as unread

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Nathan <nathan@zed.dev>
2024-03-07 13:53:05 -07:00
Conrad Irwin
284a57d4d1
Fix panic in open urls (#9032)
Co-Authored-By: Nathan <nathan@zed.dev>

Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
2024-03-07 13:52:50 -07:00
Rom Grk
9068911eb4
wayland: don't dispatch modifier key events (#9027)
Modifier keys are dispatched as events on wayland, unlike macos. This
prevents pending bindings from matching, because something like e.g. `g
shift-e` is received by the key matcher as `g shift shift-e`.
2024-03-07 12:42:48 -08:00
Max Brunsfeld
27518f4280 Fix extension store test failure on main due to wasi-sdk download 2024-03-07 10:53:28 -08:00
Conrad Irwin
86748a09e7
Denormalize buffer operations (#9026)
This should significantly reduce database load on redeploy.

Co-Authored-By: Max <max@zed.dev>
Co-Authored-By: Nathan <nathan@zed.dev>

Release Notes:

- Reduced likelihood of being disconnected during deploys

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Nathan <nathan@zed.dev>
2024-03-07 11:35:47 -07:00
d1y
b5370cd15a
Remove git_commit syntax highlighting from core Zed (#9025)
Fallback to extension
https://github.com/zed-industries/extensions/pull/307

Release Notes:

- Remove git_commit syntax highlighting from Zed core, `git-firefly` extension replaced that

Co-authored-by: William Desportes <williamdes@wdes.fr>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2024-03-07 20:23:44 +02:00
Kirpal Grewal
85e6bc94e9
Enable clippy::suspicious_to_owned (#9004)
Another small change: calling to owned on the `Cow` was cloning the
`Cow`, not its contents and so calling `clone` makes this more explicit
2024-03-07 11:30:40 -05:00
Yesterday17
105e654dce
Include font_features in cache key for fonts (#8928)
## Release Notes

- Fixed font ligatures not always respecting the setting
([#4313](https://github.com/zed-industries/zed/issues/4313)).

## Preview


![20240306133121_rec_-convert](https://github.com/zed-industries/zed/assets/8667822/dc2aaa00-41d0-4fe9-8d9c-80e1f047894d)
2024-03-07 11:06:19 -05:00
Max
6b8984279f
Pluralize and order user menu items for consistency (#9013)
Release Notes:

- N/A
2024-03-07 17:59:33 +02:00
Jason Lee
bc7fb9f253
Show tooltip with item paths for recent project picker items (#8987)
Before

![empty-tooltip](https://github.com/zed-industries/zed/assets/5518/4a00158c-5ae1-4ef9-8686-d4c188a99050)

After

![output](https://github.com/zed-industries/zed/assets/5518/b30f8272-485d-40e1-989a-facd122e96c8)

Release Notes:

- Fixed empty tooltip for recent projects picker items
2024-03-07 17:35:48 +02:00
Piotr Osiewicz
d450fde1ed language: Track buffer dirty state based on edits, not on file contents 2024-03-07 14:11:35 +01:00
Anthony Eid
4c9c9df730
Add ZED_SELECTED_TEXT variable to tasks (#8865)
Tasks are able to access a users selected text using the environment
variable "ZED_SELECTED_TEXT".

Release notes:

- Added ZED_SELECTED_TEXT task variable which contains contents of
selection
2024-03-07 11:59:25 +01:00
Piotr Osiewicz
3a9ec906af
task: make ZED_FILE return abs path, for real this time (#9000)
Release Notes:

- Fixed ZED_FILE environment variable containing a relative path, not an
absolute one.
2024-03-07 11:50:07 +01:00
Floyd Wang
01fe3eec4d
Fix project panel icon bouncing when renaming (#8988)
I found the project panel icon has a little bounce when I tried to
rename some files.

Release Notes:

- Fix project panel icon bouncing when renaming.

## Before



https://github.com/zed-industries/zed/assets/28998859/76f04c33-da68-40e2-9c83-045e78187679

**Set `buffer_line_height` to `standard`**


https://github.com/zed-industries/zed/assets/28998859/9a9eca93-5fda-4060-ba1d-0cd4e0486eb8



## After


https://github.com/zed-industries/zed/assets/28998859/29b49f1c-a9ae-4281-8921-8f1d8dd74262

**Set `buffer_line_height` to `standard`**


https://github.com/zed-industries/zed/assets/28998859/8f1ccbb5-fe0e-4905-97c4-cb7431e5dc46
2024-03-07 09:18:59 +01:00
Conrad Irwin
75a42c27db
Migrate from scrypt to sha256. (#8969)
This reduces the server time to compute the hash from 40ms to 5µs,
which should remove this as a noticable chunk of CPU time in production.

(An attacker who has access to our database will now need only 10^54
years of CPU time instead of 10^58 to brute force a token).

Release Notes:

- Improved sign in latency by 40ms.
2024-03-06 20:51:43 -07:00
Evren Sen
4d2156e2ad
Improved message hovering in chat panel (#8977)
Highlights messages on hover and fixed a more concise position for the
popover menu button.

Before:


https://github.com/zed-industries/zed/assets/146845123/39cab30f-659f-4164-a4ac-1dfee796e016

<img width="368" alt="Screenshot 2024-03-07 at 01 08 24"
src="https://github.com/zed-industries/zed/assets/146845123/74f41243-2dc2-4839-a733-9db3109e4665">

<img width="313" alt="Screenshot 2024-03-07 at 01 04 39"
src="https://github.com/zed-industries/zed/assets/146845123/f66c764d-488a-4303-b66e-f75835df6949">

After:


https://github.com/zed-industries/zed/assets/146845123/ac059c0d-7b16-4fd5-bbd7-ca96e1a6dfe1


<img width="368" alt="Screenshot 2024-03-07 at 01 09 42"
src="https://github.com/zed-industries/zed/assets/146845123/fa8940f6-52b4-489d-b0d3-d0e9443e2de2">

<img width="313" alt="Screenshot 2024-03-07 at 01 04 31"
src="https://github.com/zed-industries/zed/assets/146845123/850226f3-2c70-4a90-bb35-4a4cb0b7a219">


Thank you for the help @ConradIrwin and @RemcoSmitsDev !


Release Notes:
- Improved message hovering in chat panel
2024-03-06 20:47:19 -07:00
Mikayla Maki
8a92d28663
Remove todo! comments (#8981)
Switching fully to normal `todo` style

Release Notes:

- N/A
2024-03-06 18:25:20 -08:00
Bennet Bo Fenner
8be4b4d75d
Support emoji shortcodes in chat (#8455)
Completes: https://github.com/zed-industries/zed/issues/7299

Suggestions


https://github.com/zed-industries/zed/assets/53836821/2a81ba89-4634-4d94-8370-6f76ff3e9403

Automatically replacing shortcodes without using the completions (only
enabled when `message_editor` > `auto_replace_emoji_shortcode` is
enabled in the settings):


https://github.com/zed-industries/zed/assets/53836821/10ef2b4b-c67b-4202-b958-332a37dc088e






Release Notes:

- Added autocompletion for emojis in chat when typing emoji shortcodes
([#7299](https://github.com/zed-industries/zed/issues/7299)).
- Added support for automatically replacing emoji shortcodes in chat
(e.g. typing "👋" will be converted to "👋")

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-03-06 19:18:29 -07:00
Mikayla Maki
c0edb5bd6c
GPUI custom window prompts (#8980)
This adds a GPUI fallback for window prompts. Linux does not support
this feature by default, so we have to implement it ourselves.

This implementation also makes it possible for GPUI clients to override
the platform prompts with their own implementations.

This is just a first pass. These alerts are not keyboard accessible yet,
does not reflect the prompt level, they're implemented in-window, rather
than as popups, and the whole feature need a pass from a designer.
Regardless, this gets us one step closer to Linux support :)

<img width="650" alt="Screenshot 2024-03-06 at 5 58 08 PM"
src="https://github.com/zed-industries/zed/assets/2280405/972ebb55-fd1f-4066-969c-a87f63b22a6f">

Release Notes:

- N/A
2024-03-06 18:15:06 -08:00
bbb651
c8e03ce42a
Wayland: Support integer scaling without wp_fractional_scale (#8886)
Release Notes:
- N/A

`DoubleBuffered` is not currently very necessary because we only care
about a single field `OutputState::scale` but I think it can be useful
for other objects as it's a fairly common pattern in wayland.
2024-03-06 18:13:23 -08:00
intigonzalez
74e7611ceb
windows: get current display size (#8916)
For the moment the windows port has a single display with hard-coded
values.

This first PR is just to at least fetch the **actual size of the current
display**. The idea
is using this code as a first template to start getting familar with the
code base
and prepare the work for enumerating all displays.
2024-03-06 18:12:44 -08:00
Conrad Irwin
0b87be71e6
Make anchor_in_excerpt Optional (#8975)
We were seeing panics due to callers assuming they had valid
excerpt_ids, but that cannot easily be guaranteed across await points as
anyone may remove an excerpt.

Release Notes:

- Fixed a panic when hovering in a multibuffer
2024-03-06 18:55:36 -07:00
Kirill Bulatov
ae5ec9224c
Small fixes to task modal & long commands (#8974)
* Show the entire task tooltip on terminal tab hover:
<img width="979" alt="Screenshot 2024-03-07 at 01 40 56"
src="https://github.com/zed-industries/zed/assets/2690773/bc274a5c-70f6-4f3d-87b4-04aff3594089">

* Scroll to the end of the query when a menu label is reused as a query:
<img width="658" alt="Screenshot 2024-03-07 at 01 41 03"
src="https://github.com/zed-industries/zed/assets/2690773/972857f4-36db-49dc-8fa1-dd15e0470660">

Release Notes:

- Improved task modal UX with long bash-like commands
2024-03-07 03:21:11 +02:00
Max Brunsfeld
675ae24964
Add a command for building and installing a locally-developed Zed extension (#8781)
This PR adds an `zed: Install Local Extension` action, which lets you
select a path to a folder containing a Zed extension, and install that .
When you select a directory, the extension will be compiled (both the
Tree-sitter grammars and the Rust code for the extension itself) and
installed as a Zed extension, using a symlink.

### Details

A few dependencies are needed to build an extension:
* The Rust `wasm32-wasi` target. This is automatically installed if
needed via `rustup`.
* A wasi-preview1 adapter WASM module, for building WASM components with
Rust. This is automatically downloaded if needed from a `wasmtime`
GitHub release
* For building Tree-sitter parsers, a distribution of `wasi-sdk`. This
is automatically downloaded if needed from a `wasi-sdk` GitHub release.

The downloaded artifacts are cached in a support directory called
`Zed/extensions/build`.

### Tasks

UX

* [x] Show local extensions in the Extensions view
* [x] Provide a button for recompiling a linked extension
* [x] Make this action discoverable by adding a button for it on the
Extensions view
* [ ] Surface errors (don't just write them to the Zed log)

Packaging

* [ ] Create a separate executable that performs the extension
compilation. We'll switch the packaging system in our
[extensions](https://github.com/zed-industries/extensions) repo to use
this binary, so that there is one canonical definition of how to
build/package an extensions.

### Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-03-06 15:35:22 -08:00
Conrad Irwin
e273198ada
Debounce language server updates (#8953)
We'll send at least one every 100ms, but may send more if other messages
are sent on the connection.

Release Notes:

- Fixed some slowness when collaborating with verbose language servers.
2024-03-06 15:58:22 -07:00
Small White
af87fb98d0
Implement more GPUI services on windows. (#8940)
### Description

This is a part of #8809 , impl the following functions:

- `os_version`
- `local_timezone`
- `double_click_interval`
- `set_cursor_style`
- `open_url`
- `reveal_path`

Release Notes:
- N/A

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-06 12:48:43 -08:00
Andrew Lygin
effc317a06
Fix project panel scrolling position restoration (#8961)
Project panel loses the last scrolling position every time the user
hides/shows it. This PR fixes the problem.

The reason of the problem is that `UniformListScrollHandle`, which is
intended to store the scrolling position between redrawings, is only
used for ad-hoc autoscrollings to the list items, while the
`interactivity.scroll_handle` that is responsible for the scrolling
position, doesn't survive the project panel hiding.

How the problem looks:


https://github.com/zed-industries/zed/assets/2101250/7c7e3da6-9a9d-4f28-a181-ee9547349d4c

Release Notes:

- Fixed scrolling position restoration in the Project Panel.
2024-03-06 12:00:51 -08:00
Max Brunsfeld
6bbd09e28e
Emit the WorktreeUpdatedEntries event for all projects, not just local (#8963)
Fixes a regression introduced in
https://github.com/zed-industries/zed/pull/8846 (which hasn't yet been
released), in which the project panel didn't update correctly for remote
projects when collaborating.

Release Notes:

- N/A
2024-03-06 11:58:18 -08:00
Ezekiel Warren
06035dadea
windows: more frequent frame requests (#8921)
Note rust analyzer running in background now without keyboard/mouse
movement.

![](https://media.discordapp.net/attachments/1208481909676576818/1214769879098597416/high-framerate-windows.gif?ex=65fa519c&is=65e7dc9c&hm=4c9ba72fa3c3c548964e46d9c07f0c0bf9545ed9a9ae11495101dcae5db06d59&=)

Release Notes:

- Improved frame rate on Windows
2024-03-06 11:54:33 -08:00
Small White
8357039419
Set the default DPI awareness for Zed (#8936)
### Description

This is a part of #8809 


Release Notes:
- N/A
2024-03-06 11:45:18 -08:00
Ezekiel Warren
a0fac3866a
prevent empty cwd in terminal view (#8924)
closes #8825

Release Notes:

- N/A
2024-03-06 11:26:16 -08:00
Edvard Høiby
8352f39ff9
Improve bindings to better match VS-Code (#8584)
Release Notes:

- Changed default keybindings in the VS Code keymap so that
`alt-[up|down]` now move lines up/down and`alt-shift-[up|down]`
duplicate lines up/down. Previous bindings for selecting larger/smaller
syntax nodes are now bound to `ctrl-shift-[left|right]`.
([#4652](https://github.com/zed-industries/zed/issues/4652))([#7151](https://github.com/zed-industries/zed/issues/7151))

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-03-06 11:16:14 -08:00
Joseph T. Lyons
850ddddcac v0.127.x dev 2024-03-06 12:30:14 -05:00
Conrad Irwin
8eb0239d5a
Remove console-subscriber (#8955)
It doubles CPU and RAM usage for not really enough benefit

Release Notes:

- N/A
2024-03-06 10:26:59 -07:00
Kirpal Grewal
b622dcbc64
Enable clippy::cast_abs_to_unsigned (#8912)
Thankfully this one is a simple, single change that also prevents
overflow in the `abs()`
2024-03-06 12:21:48 -05:00
Jason Lee
2f15676b7c
Update App Menus to add ... for some modal action menu, and group menu items by type. (#8951)
Release Notes:

- Improved App Menu, add `...` for modal action menu, and group menu
items by type.

In macOS and Windows, the `...` suffix of menu item, is means that will
open a dialog.
2024-03-06 12:10:09 -05:00
Jason Lee
4a60326c1c
Remove workspace border, avoid the main window having double borders (#8922)
Release Notes:

- Fixed main window border, avoid double borders.



## Diff (Left is Before, Right is After)


![SCR-20240306-g2v](https://github.com/zed-industries/zed/assets/5518/b13bab55-9d74-4181-ae43-e338bb6f7112)

![SCR-20240306-g0x](https://github.com/zed-industries/zed/assets/5518/af9d4190-a974-4c26-8466-dce1c78c3f31)




Reference to Safari:

![SCR-20240306-ejo](https://github.com/zed-industries/zed/assets/5518/14c41898-8218-4bec-8574-8915a7186926)


## More Theme tests

![SCR-20240306-g0d](https://github.com/zed-industries/zed/assets/5518/8938671e-bc7c-4a6a-8c06-0992beb92bb1)

![SCR-20240306-g0j](https://github.com/zed-industries/zed/assets/5518/73a68663-70f5-4f83-aea0-2079236079e7)

![SCR-20240306-g0q](https://github.com/zed-industries/zed/assets/5518/0a2b4905-3dd1-4081-b538-a78728470004)



![SCR-20240306-fu9](https://github.com/zed-industries/zed/assets/5518/dd3a9e2c-ea28-46c6-a993-047dae8b2d8f)
2024-03-06 10:03:59 -05:00
Jason Lee
567fee4219
Update Project search to Project Search. (#8943)
Release notes:

- N/A
2024-03-06 15:23:55 +01:00
Max Brunsfeld
6036830049
Throttle the sending of UpdateFollowers messages (#8918)
## Problem

We're trying to figure out why we sometimes see high latency when
collaborating, even though the collab server logs indicate that messages
are not taking long to process.

We think that high volumes of certain types of messages, including
`UpdateFollowers` may cause a lot of messages to queue up, causing
delays before collab sees certain messages.

## Fix

This PR reduces the number of `UpdateFollowers` messages that clients
send to collab when scrolling around or moving the cursor, using a
time-based throttle.

The downside of this change is that scrolling will not be as smooth when
following someone. The advantage is that it will be much easier to keep
up with the stream of updates, since they will be sent much less
frequently.

## Release Notes:

- Fixed slowness that could occur when collaborating due to excessive
messages being sent to support following.

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Thorsten <thorsten@zed.dev>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-03-06 14:58:41 +01:00
Antonio Scandurra
c8383e3b18 Use a string for ZED_LOAD_BALANCER_SIZE_UNIT in k8s template
Co-Authored-By: Thorsten <thorsten@zed.dev>
2024-03-06 11:03:14 +01:00
Antonio Scandurra
e3a7192c11
Give a name to load balancers and increase node count for production (#8939)
Release Notes:

- N/A

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-03-06 10:38:17 +01:00
Conrad Irwin
c58422cb3f Fix YAML indentation 2024-03-05 22:11:58 -07:00
Conrad Irwin
6d53846824
0-downtime collab deploys? (#8926)
Before this change Kubernetes would send a SIGTERM to the old server
before the new one was ready. Now it will wait.

From my reading it seems like startupProbe should not be necessary if we
have a
readinessProbe; but from testing it seems like without startupProbe we
still
drop requests when using `rollout restart`

Release Notes:

- Fixed connectivity issues during Zed deploys.
2024-03-05 21:58:00 -07:00
Max Brunsfeld
01e5e4224a Fix numeric sign of queue duration in logs 2024-03-05 16:00:03 -08:00
Max Brunsfeld
ce6bde5a24
Install perf on collab image (#8910)
Release Notes:

- N/A

---------

Co-authored-by: Conrad <conrad@zed.dev>
2024-03-05 14:59:31 -08:00
Max Brunsfeld
35c516fda9
Log the time incoming RPC messages were queued (#8909)
Release Notes:

- N/A

Co-authored-by: Conrad <conrad@zed.dev>
2024-03-05 14:40:09 -08:00
Kirpal Grewal
bca98caa07
Enable clippy::unnecessary_to_owned (#8908)
lint for `unnecessary_to_owned` and fix the sole violation in the
codebase
2024-03-05 17:28:58 -05:00
Max Brunsfeld
b68a277b5e
Fix tracing subscriber after introducing Tokio-console (#8907)
We've also upgraded `Axum` in order to avoid having two versions of that
library in Collab (one due to Tokio-console).

Release Notes:

- N/A

---------

Co-authored-by: Conrad <conrad@zed.dev>
2024-03-05 14:11:33 -08:00
Kirill Bulatov
703c9655a0
Always resolve code action if needed (#8904)
Follow-up of https://github.com/zed-industries/zed/pull/8874 and
https://github.com/zed-industries/zed/pull/7635
Closes https://github.com/zed-industries/zed/issues/7609

* mentions all `lsp::CodeActions` properties in the Zed client resolve
capabilities to remove more json out of general actions request
potentially
* removes odd `CodeActions.data` field checks, as that field is opaque
and is intended to store data, needed by the langserver to resolve this
code action
* if any `CodeAction` lacks either `command` or `edits` fields, tries to
resolve the action

This all effectively causes Zed to always fire an action resolve
request, since we update actions list (replacing the resolved actions
with the new, unresolved ones) via `refresh_code_actions`

9e66d48ccd/crates/editor/src/editor.rs (L3650)
that is being called on selections change and the actions menu open.

Yet, we do not query the resolve until the action is either applied
(selected in the list), or called for formatting, so it seems to be fine
to resolve them always, as it's not a frequent operation such as
reacting to every keystroke.


Release Notes:

- Fixed certain code actions not being resolved properly ([7609](https://github.com/zed-industries/zed/issues/7609))

---------

Co-authored-by: Derrick Laird <swampdonk@gmail.com>
2024-03-05 23:42:12 +02:00
Marshall Bowers
addfcdea8d
Enable clippy::implied_bounds_in_impls (#8906)
This PR enables the
[`clippy::implied_bounds_in_impls`](https://rust-lang.github.io/rust-clippy/master/index.html#/implied_bounds_in_impls)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-05 16:04:55 -05:00
Conrad Irwin
d112bcfadf
Fix project subscription order (#8900)
Co-Authored-By: Antonio <as-cii@zed.dev>

Release Notes:

- Fixed a bug that prevents project joining

Co-authored-by: Antonio <as-cii@zed.dev>
2024-03-05 13:34:25 -07:00
Marshall Bowers
9e66d48ccd
Enable clippy::cmp_owned (#8899)
This PR enables the
[`clippy::cmp_owned`](https://rust-lang.github.io/rust-clippy/master/index.html#/cmp_owned)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-05 14:36:53 -05:00
Joseph T. Lyons
d98b61e3d6 Improve wording on recent projects placeholder instructions 2024-03-05 13:51:25 -05:00
Conrad Irwin
cfffa29f9a
Enable tokio-console (#8897)
Release Notes:

- Added tokio-console in production
2024-03-05 10:56:14 -07:00
白山風露
9a2ed4bf1a
Windows: use folders under AppData (#8828)
To be honest, I am not sure how to use these directories. But since it
is difficult to change these later, if we are going to change them, I
think it is time to do.

Release Notes:

- N/A
2024-03-05 09:48:27 -08:00
Marshall Bowers
b6af393e6d
Enable clippy::borrow_deref_ref (#8894)
This PR enables the
[`clippy::borrow_deref_ref`](https://rust-lang.github.io/rust-clippy/master/index.html#/borrow_deref_ref)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-05 12:24:54 -05:00
Marshall Bowers
22fe03913c
Move Clippy configuration to the workspace level (#8891)
This PR moves the Clippy configuration up to the workspace level.

We're using the [`lints`
table](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table)
to configure the Clippy ruleset in the workspace's `Cargo.toml`.

Each crate in the workspace now has the following in their own
`Cargo.toml` to inherit the lints from the workspace:

```toml
[lints]
workspace = true
```

This allows for configuring rust-analyzer to show Clippy lints in the
editor by using the following configuration in your Zed `settings.json`:

```json
{
  "lsp": {
    "rust-analyzer": {
      "initialization_options": {
        "check": {
          "command": "clippy"
        }
      }
    }
  }
```

Release Notes:

- N/A
2024-03-05 12:01:17 -05:00
Dzmitry Malyshau
52f750b216
Update blade to latest: work around Intel+NVidia driver bug (#8811)
Picks up https://github.com/kvark/blade/pull/92
Should unblock some of the unhappy users.
Upstream bug - https://gitlab.freedesktop.org/mesa/mesa/-/issues/4688

Release Notes:
- N/A
2024-03-05 08:48:34 -08:00
Ezekiel Warren
36c4831806
windows: mouse and keyboard (#8791)
Windows mouse and keyboard working! I also tweaked the message loop so
that it didn't get stuck. The peek message loop was almost never
returning for me during testing.

Release Notes:

- Added windows mouse and keyboard support

![windows-mouse-and-keyboard](https://github.com/zed-industries/zed/assets/1284289/08578fbf-0cb2-4e44-bab1-3c4f0291ea4b)
2024-03-05 08:35:07 -08:00
Nathan Sobo
7c9f680b1b
Request more resources for collab pods on Kubernetes (#8890)
Worried that if we don't do this, they don't give us enough. We're
maxing out the pod's CPU but the node is barely sweating.

Release Notes:

- N/A
2024-03-05 09:15:08 -07:00
Thorsten Ball
2b8b913b6b
Use correct worktree when getting permalink to line (#8888)
Previously this code would call `project.visible_worktrees(cx).next`
which might not necessarily return the worktree matching the currently
open file.

What this change does is it adds `get_repo` method on `Project` that
allows us to get the `GitRepository` for the current buffer.

Release Notes:

- Fixed `open permalink to line` not working when multiple folders are
added to the project.

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-03-05 16:59:00 +01:00
Jason Lee
0b34b1de7b
Fix first/last item margin on scroll (#8880)
![output](https://github.com/zed-industries/zed/assets/5518/e39a3600-99c4-4d3c-baee-efd53a474f38)

Before:

https://github.com/zed-industries/zed/assets/5518/f7a4563a-504a-4a41-bfd4-21e9439cd02b

After:

https://github.com/zed-industries/zed/assets/5518/0ba41527-46fd-404f-8207-1b8c5cf37434


Release Notes:

- Fixed first and last item margin when scroll view has padding
2024-03-05 15:54:48 +02:00
Jason Lee
fae5e83d93
Fix all Picker Item cursor to use Pointer. (#8877)
Before:

https://github.com/zed-industries/zed/assets/5518/84874858-7847-4fa4-b7a3-41ecc65a2f7d

After: 

https://github.com/zed-industries/zed/assets/5518/d395ea96-aa26-4de1-8bfc-73cc43ee75cf


Release Notes:

- Made picker items to use `Pointer` cursor style
2024-03-05 11:32:57 +02:00
Jason Lee
6a268e959f
Improve VCS Menu header top margin. (#8879)
## Before

![SCR-20240305-nga](https://github.com/zed-industries/zed/assets/5518/e814d770-a5b1-4289-acc4-808bf7d96690)

![SCR-20240305-nge](https://github.com/zed-industries/zed/assets/5518/abba4f7c-7e6c-447f-8e4f-fbecdf802f62)

## After

![SCR-20240305-nfp](https://github.com/zed-industries/zed/assets/5518/5539b15c-c67d-466b-9c46-44e488788b04)

![SCR-20240305-nfu](https://github.com/zed-industries/zed/assets/5518/5cfdf861-b55c-4f1e-a41f-dcd42a449488)

Release Notes:

- Improve VCS Menu header top margin, and use `TextMuted` color for
matched count label.
2024-03-05 10:19:52 +01:00
Conrad Irwin
e0c66b30c8
Fix panic in enclosing bracket ranges (#8870)
This function was operating in the wrong co-ordinate space (c.f. #8081)

Release Notes:

- Fixed a panic on `ctrl-m` in a multibuffer
2024-03-04 21:27:01 -07:00
Conrad Irwin
27c5343707
hosted projects (#8627)
- **Allow joining a hosted project**

You can't yet do anything in a hosted project, but you can join it and
look how empty it is.

Release Notes:

- N/A
2024-03-04 19:17:40 -07:00
Quadri A. Adekunle
4167c66b86
macOS: Fix center window with fixed bounds size (#8475)
This PR fixes window showing up in the center of the monitor when
`center: true` option is provided.

The idea is to set the `window_wize` when creating the `window` using
`native_window.initWithContentRect_styleMask_backing_defer_screen_()`

Before: 

<img width="851" alt="SCR-20240227-qokf"
src="https://github.com/zed-industries/zed/assets/20229808/27494966-2e97-4771-8837-ccb6658ced78">

After:

<img width="1132" alt="SCR-20240227-qlmg"
src="https://github.com/zed-industries/zed/assets/20229808/439568da-d380-4331-8d19-cd501f211c4c">


Release Notes:

- N/A
2024-03-04 17:08:29 -07:00
Noritada Kobayashi
d223fe446d
vim: Add support for ap and ip paragraph text objects (#7687)
This PR adds support for `ap`/`ip` text objects in Vim mode and allows
users to perform paragraph-based operations.

Cases where compatibility with Neovim's behavior is checked, cases where
there are known differences in behavior with Neovim (cases where the
landing position is other than the beginning of the line), and cases
where the Neovim behavior in the test suite seems strange are separated
in the test code so that they can be identified.

Release Notes:

- Added support for `ap` and `ip` paragraph text objects in Vim mode
([#7359](https://github.com/zed-industries/zed/issues/7359)).
2024-03-04 16:39:02 -07:00
Conrad Irwin
f53823c840
Remove release channel from Zed URLs (#8863)
Also adds a new command `cli: Register Zed Scheme` that will cause URLs
to be opened in the current zed version, and we call this implicitly if
you install the CLI

Also add some status reporting to install cli

Fixes: #8857



Release Notes:

- Added success/error reporting to `cli: Install Cli`
([#8857](https://github.com/zed-industries/zed/issues/8857)).
- Removed `zed-{preview,nightly,dev}:` url schemes (used by channel
links)
- Added `cli: Register Zed Scheme` to control which zed handles the
`zed://` scheme (defaults to the most recently installed, or
the version that you last used `cli: Install Cli` with)
2024-03-04 16:08:47 -07:00
Piotr Osiewicz
2201b9b116
task: Add task contexts (#8675)
This PR supplements tasks with additional environment variables; ideally
we'll be able to write a task like:
`cargo test -p $ZED_CURRENT_PACKAGE -- $ZED_CURRENT_FUNCTION`
- [x] Flesh out multibuffer interactions
- [x] Add ZED_SYMBOL detection based on tree-sitter queries
- [ ] Add release note and demo
- [x] Figure out a solution for rerun dilemma - should `task: rerun`
reevaluate contexts for tasks?

This PR introduced the following variables:
- ZED_COLUMN - current line column
- ZED_ROW - current line row
and the following, which are available for buffers with associated
files:
- ZED_WORKTREE_ROOT - absolute path to the root of the current worktree.
- ZED_FILE - absolute path to the file
- ZED_SYMBOL - currently selected symbol; should match the last symbol
shown in a symbol breadcrumb (e.g. `mod tests > fn test_task_contexts`
should be equal to ZED_SYMBOL of `test_task_contexts`). Note that this
isn't necessarily a test function or a function at all.

Also, you can use them in `cwd` field of definitions (note though that
we're using https://docs.rs/subst/latest/subst/#features for that, so
don't expect a full shell functionality to work); the syntax should
match up with your typical Unix shell.


Release Notes:

- Added task contexts, which are additional environment variables set by
Zed for task execution; task content is dependent on the state of the
editor at the time the task is spawned.

---------

Co-authored-by: Anthony <anthonyeid7@protonmail.com>
2024-03-04 21:04:53 +01:00
Conrad Irwin
b2f18cfe71
Ensure followed cursors are always visible (#8849)
Before this change they would disappear if you blurred the pane.

Release Notes:

- Fixed an issue where the followed users' cursor would disappear if you
blurred the pane.
2024-03-04 12:39:08 -07:00
Joseph T. Lyons
95e532c56d
Add option to sign in to copilot from welcome screen (#8853)
Fixes: https://github.com/zed-industries/zed/issues/8851


https://github.com/zed-industries/zed/assets/19867440/5d391289-34e8-4abc-9337-b7e253f4e513

Release Notes:

- Added GitHub Copilot sign in on welcome screen
([#8851](https://github.com/zed-industries/zed/issues/8851)).
2024-03-04 14:38:28 -05:00
Andrew Lygin
d7b5c883fe
Optimize project panel subscriptions (#8846)
The project panel now both observes all the project updates and
subscribes to project events it's interested in. The observing handler
updates the list of visible entries on any notification, which looks
pretty excessive.

This PR removes the observer completely, and adds missing event handlers
to the subscription, thus removing unnecessary work.

Release Notes:

- N/A
2024-03-04 20:56:17 +02:00
Marshall Bowers
78fa596839
Enable clippy::crate_in_macro_def (#8845)
This PR enables the
[`clippy::crate_in_macro_def`](https://rust-lang.github.io/rust-clippy/master/index.html#/crate_in_macro_def)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-04 13:37:23 -05:00