Commit Graph

14827 Commits

Author SHA1 Message Date
Waffle Maybe
eec8660759
Use .is_some_and() instead of .is_some() && .unwrap() (#9704)
That's nicer & more readable.

(I just noticed that this looks weird while trying to understand why zed
changes my cursor, so decided to make a quick fix (btw the issue with
the cursor is that zed always loads cursor named "default" on wayland))

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-03-25 11:11:35 -04:00
Kirill Bulatov
e3894a4e1e
Document main workspace structs (#9772) 2024-03-25 16:09:51 +01:00
Aaron Ruan
f83884518a
Change maximum height of TitleBar (#9758)
<img width="209" alt="image"
src="https://github.com/zed-industries/zed/assets/38318044/0dcc4d0b-db9e-4eba-aa36-5c35f185e7e3">

Release Notes:

- Fixed alignment of items in the title bar
([#9709](https://github.com/zed-industries/zed/issues/9709)).
2024-03-25 10:45:19 -04:00
Piotr Osiewicz
a7047f67fb
chore: Revert "gpui: update dependencies" (#9774)
Reverts zed-industries/zed#9741

/cc @niklaswimmer it looks like that PR change broke our rendering of
avatars (as @bennetbo found out) - they have a blue-ish tint now, which
I suppose might have to do with change between BGRA and RGBA. I'm gonna
revert it for now, let's reopen it though.


![image](https://github.com/zed-industries/zed/assets/24362066/3078d9c6-9638-441b-8b32-d969c46951e0)

Release Notes:

- N/A
2024-03-25 15:27:16 +01:00
Niklas Wimmer
7f9355e11f windows: update text system to new cosmic version
The same changes have been used on linux here 5003504031
and here 34832d49b09071846ff6f55f8ca1df019980a1df.

Signed-off-by: Niklas Wimmer <mail@nwimmer.me>
2024-03-25 13:03:57 +01:00
Niklas Wimmer
6a22c8a298 gpui: Update image dependency
The latest update to resvg bumped some transitive dependencies
which lead to duplicates. The update to the image dependency
unifies most of their versions again.

Most notably, gif and kurbo are still duplicated, which is best fixed
downstream however.

Signed-off-by: Niklas Wimmer <mail@nwimmer.me>
2024-03-25 13:03:57 +01:00
Niklas Wimmer
007acc4bc2 gpui: Update cosmic-text and resvg dependency
This unifies the rustybuzz dependency to the same version.

Signed-off-by: Niklas Wimmer <mail@nwimmer.me>
2024-03-25 13:03:57 +01:00
Niklas Wimmer
97f1d61a4a gpui: make build dependencies mac only
This removes bindgen and cbindgen from the dependency graph on non-macos
systems, improving compile times on those systems.

Signed-off-by: Niklas Wimmer <mail@nwimmer.me>
2024-03-25 13:03:57 +01:00
Niklas Wimmer
50ab60b9f0 gpui: update ashpd and open dependency
The ashpd update removes the dependency on an older zbus version which
decreases compile times.

Signed-off-by: Niklas Wimmer <mail@nwimmer.me>
2024-03-25 13:03:57 +01:00
Mayfield
4785520d99
Support newline and tab literals in regex search-and-replace operations (#9609)
Closes #7645

Release Notes:

- Added support for inserting newlines (`\n`) and tabs (`\t`) in editor
Regex search replacements
([#7645](https://github.com/zed-industries/zed/issues/7645)).
2024-03-25 12:21:04 +01:00
Hans
eb3264c0ad
change HashSet to BTreeSet (#9734)
I found that there may be some minor problems here, in editor.edit may
be more dependent on the order of operations, if the same set of
operations, different execution orders may lead to some different
results, so maybe we need to use BTreeSet instead of HashSet, because
HashSet may not be able to ensure that the same set of data order is
consistent, but maybe my worries are too much

Release notes:

- N/A
2024-03-25 12:13:44 +01:00
Bennet Bo Fenner
e77d313839
markdown preview: Improve task list visuals (#9695)
Instead of using some arbitrary unicode characters to render a task as
completed/not completed, I feel that using an actual checkbox from the
components crate makes it look more polished.

Before:

![image](https://github.com/zed-industries/zed/assets/53836821/700de8f8-2e01-4e03-b237-e3da2971f039)

After:

<img width="883" alt="image"
src="https://github.com/zed-industries/zed/assets/53836821/f63d56c3-bfbb-41c8-b150-8ebf973f75e2">


Release Notes:

- Improved visuals of task lists inside the markdown preview
2024-03-25 09:43:17 +01:00
Richard Taylor
5181d3f719
Workspace configuration for elixir-ls LSP (#9330)
This allows the workspace configuration settings to be passed to the
elixir-ls LSP via lsp settings.

This following example settings disable dialyzer in the LSP:

```
"lsp": {
  "elixir-ls": {
    "settings": {
      "dialyzerEnabled": false
    }
  }
}
```

It follows the same pattern used in
[#8568](https://github.com/zed-industries/zed/pull/8568) and resolves
[#4260](https://github.com/zed-industries/zed/issues/4260).

Zed's language server logs show the settings are being sent to the
language server:

```
Received client configuration via workspace/configuration
%{"dialyzerEnabled" => false}
Registering for workspace/didChangeConfiguration notifications
Starting build with MIX_ENV: test MIX_TARGET: host
client/registerCapability succeeded
Registering for workspace/didChangeWatchedFiles notifications
client/registerCapability succeeded
Received workspace/didChangeConfiguration
Received client configuration via workspace/didChangeConfiguration
%{"dialyzerEnabled" => false}
```

Release Notes:

- Added workspace configuration settings support for elixir-ls language
server. Those can now be configured by setting `{"lsp": {"elixir-ls": {
"settings: { "your-settings-here": "here"} } }` in Zed settings.
[#4260](https://github.com/zed-industries/zed/issues/4260).
2024-03-25 09:35:28 +01:00
Bennet Bo Fenner
6d78737973
markdown preview: Insert missing line break on hard break (#9687)
Closes #8990

For this input
```
Test \
Test
```

pulldown_cmark reports
```
Start(Paragraph)
Text(Borrowed("Test "))
HardBreak
Text(Borrowed("Test"))
End(Paragraph)
```

Previously `Event::HardBreak` just marked the paragraph block as
completed and ignored all the remaining text inside the paragraph.

Before:
See https://github.com/zed-industries/zed/issues/8990#issue-2173197637

After:

![image](https://github.com/zed-industries/zed/assets/53836821/48237ea6-d749-4207-89a3-b0f146b0e544)


Release Notes:

- Fixed markdown preview not handling hard breaks (e.g. `\`) correctly
([#8990](https://github.com/zed-industries/zed/issues/8990)).
2024-03-25 10:06:00 +02:00
Max Brunsfeld
6ebe599c98
Fix issues with extension API that come up when moving Svelte into an extension (#9611)
We're doing it. Svelte support is moving into an extension. This PR
fixes some issues that came up along the way.

Notes

* extensions need to be able to retrieve the path the `node` binary
installed by Zed
* previously we were silently swallowing any errors that occurred while
loading a grammar
* npm commands ran by extensions weren't run in the right directory
* Tree-sitter's WASM stdlib didn't support a C function (`strncmp`)
needed by the Svelte parser's external scanner
* the way that LSP installation status was reported was unnecessarily
complex

Release Notes:

- Removed built-in support for the Svelte and Gleam languages, because
full support for those languages is now available via extensions. These
extensions will be suggested for download when you open a `.svelte` or
`.gleam` file.

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-22 17:29:06 -07:00
Mikayla Maki
4459eacc98
Improve the clarity of multi buffer headers (#9722)
<img width="544" alt="Screenshot 2024-03-22 at 3 23 09 PM"
src="https://github.com/zed-industries/zed/assets/2280405/83fde9ad-76e1-4eed-a3f2-bc25d5a88d84">

Release Notes:


- Improved the clarity of the UI for diagnostic and search result
headers
2024-03-22 15:38:19 -07:00
Thorsten Ball
16a2013021
Update to vscode-eslint 2.4.4 & support flat config file extensions (#9708)
This upgrades to vscode-eslint 2.4.4 to support flat configs, in
multiple configuration files, ending in `.js`, `.cjs`, `.mjs`.

We changed the code to not use the GitHub release because we actually
don't need the artifacts of the release, we just need the source code,
which we compile anyway.

Fixes #7271.

Release Notes:

- Added support for ESLint flat config files.
([#7271](https://github.com/zed-industries/zed/issues/7271)).

Co-authored-by: Kristján Oddsson <koddsson@gmail.com>
2024-03-22 17:19:23 +01:00
Marshall Bowers
c6d479715d
Add setting to allow disabling the Assistant (#9706)
This PR adds a new `assistant.enabled` setting that controls whether the
Zed Assistant is enabled.

Some users have requested the ability to disable the AI-related features
in Zed if they don't use them. Changing `assistant.enabled` to `false`
will hide the Assistant icon in the status bar (taking priority over the
`assistant.button` setting) as well as filter out the `assistant:`
actions.

The Assistant is enabled by default.

Release Notes:

- Added an `assistant.enabled` setting to control whether the Assistant
is enabled.
2024-03-22 11:55:29 -04:00
Piotr Osiewicz
4dc61f7ccd
Extensions registering tasks (#9572)
This PR also introduces built-in tasks for Rust and Elixir. Note that
this is not a precedent for future PRs to include tasks for more
languages; we simply want to find the rough edges with tasks & language
integrations before proceeding to task contexts provided by extensions.

As is, we'll load tasks for all loaded languages, so in order to get
Elixir tasks, you have to open an Elixir buffer first. I think it sort
of makes sense (though it's not ideal), as in the future where
extensions do provide their own tasks.json, we'd like to limit the # of
tasks surfaced to the user to make them as relevant to the project at
hand as possible.

Release Notes:

- Added built-in tasks for Rust and Elixir files.
2024-03-22 16:18:33 +01:00
Conrad Irwin
cb4f868815
remoting (#9680)
This PR provides some of the plumbing needed for a "remote" zed
instance.

The way this will work is:
* From zed on your laptop you'll be able to manage a set of dev servers,
each of which is identified by a token.
* You'll run `zed --dev-server-token XXXX` to boot a remotable dev
server.
* From the zed on your laptop you'll be able to open directories and
work on the projects on the remote server (exactly like collaboration
works today).

For now all this PR does is provide the ability for a zed instance to
sign in
using a "dev server token". The next steps will be:
* Adding support to the collaboration protocol to instruct a dev server
to "open" a directory and share it into a channel.
* Adding UI to manage these servers and tokens (manually for now)

Related #5347

Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-03-22 08:44:56 -06:00
Nathan Sobo
f56707e076
Assign OPENAI_API_KEY from a k8s secret in the collab deployment (#9703)
Merging this eagerly because it's just a configuration change, and I want to test it on staging.
2024-03-22 08:36:52 -06:00
Bennet Bo Fenner
ce57db497e
chat panel: Fix tooltips not working for links (#9691)
Closes #9418 

Noticed a difference in the `cx.set_tooltip(...)` calls between `div`
and `InteractiveText`. `div` calls `cx.set_tooltip(...)` inside
`after_layout`, but `InteractiveText` was calling this inside `paint`. I
believe as #9012 was merged, we need to call `cx.set_tooltip` inside
`after_layout`, as inserting inside `paint` does not seem to be
supported anymore.

I moved the code for setting the tooltip to `after_layout` and hovering
over links inside the chat seems to bring up the tooltips again.

Before:

See https://github.com/zed-industries/zed/issues/9418#issue-2189398784

After:


![image](https://github.com/zed-industries/zed/assets/53836821/a623164c-1ce0-40d7-bc53-020f176fba4a)


Release Notes:

- Fixed tooltip not showing up when hovering over links inside the chat
panel ([#9418](https://github.com/zed-industries/zed/issues/9418))
2024-03-22 14:47:57 +01:00
Piotr Osiewicz
945d8c2112
Revert "Revert "chore: Bump Rust version to 1.77 (#9631)"" (#9672)
Reverts zed-industries/zed#9658, as the Docker image is now available.

Release notes:

- N/A
2024-03-22 11:17:16 +01:00
张小白
ae6f138b6c
Fix compute_width_for_char (#9643)
Release Notes:

- N/A
2024-03-22 09:10:42 +01:00
Nathan Sobo
6d5787cfdc
Hard code max token counts for supported models (#9675) 2024-03-21 20:30:33 -06:00
Daniel Zhu
441677c90a
Fix typo (mimized -> minimized) (#9674) 2024-03-21 16:14:31 -07:00
Ezekiel Warren
0f15fd37d6
windows: User installed language server support (#9606)
Release Notes:

- N/A
2024-03-21 15:25:26 -07:00
张小白
4183805a39
windows: fix window activate action (#9664)
Now, the window activation event can be triggered correctly. As shown in
the video, when the window is activated, the caret blinks; when the
window loses activation due to me clicking on the PowerShell window, the
caret stops blinking.



https://github.com/zed-industries/zed/assets/14981363/4c1b2bec-319d-4f21-879e-5a0af0a00d8e



Release Notes:

- N/A
2024-03-21 15:24:17 -07:00
Conrad Irwin
eaa803298e
Fix error handling in buffer open (#9667)
Co-Authored-By: Max <max@zed.dev>
Co-Authored-By: Marshall <marshall@zed.dev>

Release Notes:

- N/A

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
2024-03-21 15:57:20 -06:00
Conrad Irwin
caed275fbf Revert "language: Remove buffer fingerprinting (#9007)"
This reverts commit 6f2f61c9b1.
2024-03-21 14:10:18 -06:00
Remco Smits
35e3935e8f
Fix invalid highlight position for (edited) text (#9660)
This pull request fixes a bug that was inserting the wrong position for
the `(edited)` text. This is only an issue when you have other styling
inside the markdown that causes the `richt_text.text.len()` to increase.

**Before**
<img wdth="234" alt="Screenshot 2024-03-21 at 19 53 34"
src="https://github.com/zed-industries/zed/assets/62463826/bf9e7fec-1563-415b-9b14-f7b95fc7d784">
**After**
<img width="234" alt="Screenshot 2024-03-21 at 19 53 48"
src="https://github.com/zed-industries/zed/assets/62463826/c0b7ba3a-5bdc-4b9e-a4f2-c3df4064f0ec">

Release Notes:

- N/A
2024-03-21 13:37:45 -06:00
Stanislav Alekseev
3b7cd9cf1e
Remove incorrect venv base directory used (#9661)
Follow-up of https://github.com/zed-industries/zed/pull/8444

Release Notes:

- N/A
2024-03-21 21:34:14 +02:00
张小白
1e543b9755
windows: implement IME caret movement and editing while composing (#9659)
https://github.com/zed-industries/zed/assets/14981363/598440f7-0364-4053-9f44-710291f8aa92



Release Notes:

- N/A
2024-03-21 12:10:22 -07:00
Marshall Bowers
d557f8e36c
Revert "chore: Bump Rust version to 1.77 (#9631)" (#9658)
This reverts commit 6184278faf.

We can't upgrade to Rust 1.77 until there are Rust 1.77 Docker images
available
(https://github.com/docker-library/official-images/pull/16457).


Release Notes:

- N/A
2024-03-21 14:07:22 -04:00
Ezekiel Warren
b6201a34b9
Check for user installed clangd (#9605)
Release Notes:

- Improved C/C++ support using user installed clangd when available
2024-03-21 10:50:42 -07:00
Stanislav Alekseev
85fdcef564
Do not enable venv in terminal for bash-like oneshot task invocations (#8444)
Release Notes:
- Work around #8334 by only activating venv in the terminal not in tasks
(see #8440 for a proper solution)
- To use venv modify your tasks in the following way:
```json
{
  "label": "Python main.py",
  "command": "sh",
  "args": ["-c", "source .venv/bin/activate && python3 main.py"]
}
```

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2024-03-21 19:40:33 +02:00
Piotr Osiewicz
cd61297740
collab: Bump minimal client version to 0.127.3 (#9649)
Release Notes:

- N/A
2024-03-21 18:23:18 +01:00
Mikayla Maki
e07192e4e3
Implement is_minimized for macOS (#9651)
Release Notes:

- N/A
2024-03-21 09:36:54 -07:00
Marshall Bowers
adcb591629
extension_cli: Populate grammars from grammars directory for legacy extension formats (#9650)
This PR makes the extension CLI populate the grammars in the manifest
from the contents of the `grammars` directory for legacy extensions
using the `extension.json` format (`schema_version == 0`).

This allows us to continue packaging these older extensions until they
can be migrated to the new schema version.

Release Notes:

- N/A
2024-03-21 12:31:53 -04:00
张小白
d89905fc3d
Fix IME window position with scale factor greater than 1.0 (#9637)
In #9456 I forgot to handle this...

Release Notes:

- N/A
2024-03-21 09:31:43 -07:00
白山風露
e1d1d575c3
Windows: Fix XButton direction (#9629)
Release Notes:

- N/A
2024-03-21 09:31:19 -07:00
张小白
3fd62a2313
windows: display icon (#9571)
Now `Zed` can display icons. The image below shows the icon of the
`zed.exe` file and the icon in the right-click properties.

![Screenshot 2024-03-20
181054](https://github.com/zed-industries/zed/assets/14981363/8f1ccc7f-aab0-46cf-8c32-a3545ba710a3)

I used the `crates\zed\resources\app-icon@2x.png` file to generate the
`.ico` file. Due to some blank space around the logo in the original
file, the logo appears slightly smaller on Windows compared to other
software.

![Screenshot 2024-03-20
181155](https://github.com/zed-industries/zed/assets/14981363/874c5ed3-6796-428c-9a91-f91231bb6510)

The current `.ico` file contains logo files of multiple sizes: 16x16,
24x24, 32x32, 48x48, 64x64, 96x96, 128x128, 256x256, 512x512.

Release Notes:

- N/A
2024-03-21 09:30:01 -07:00
白山風露
f179158913
windows: Avoid recording minimized position to database (#9407)
Minimizing window records strange position to DB. When Zed is restarted,
the window goes far away.
<img width="975" alt="image"
src="https://github.com/zed-industries/zed/assets/6465609/98dbab71-fdbb-4911-b41a-9c3e498e5478">

So I fixed.

Release Notes:

- N/A
2024-03-21 09:15:16 -07:00
白山風露
f88f1bce20
Windows: Not logging frequent WM_PAINTs (#9566)
The logging of WM_PAINT for each frame was not very meaningful, so it
was eliminated.
Other logging levels were also reduced to trace.

Release Notes:

- N/A

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-21 09:11:33 -07:00
Piotr Osiewicz
6f2f61c9b1
language: Remove buffer fingerprinting (#9007)
Followup to #9005 that actually removes buffer fingerprinting.

Release Notes:

- N/A
2024-03-21 17:03:26 +01:00
Marshall Bowers
1f21088591
Normalize - to _ in resulting Wasm file names (#9644)
This PR updates the extension builder to normalize `-` to `_` in the
Rust package names when computing the resulting `.wasm` file name.

The `wasm32-wasi` target does this normalization internally already, so
we need to do the same to ensure we're looking for the resulting `.wasm`
file in the right spot.

Release Notes:

- N/A
2024-03-21 11:48:08 -04:00
Marshall Bowers
3831088251
extension_cli: Don't propagate errors caused by trying to read Cargo.toml (#9641)
This PR fixes an issue where the extension CLI would error if a
`Cargo.toml` didn't exist when we were trying to check for its
existence. Since we're just checking if it exists for the purposes of
detecting a Rust extension, we can safely ignore the errors.

Also improved the logging/error handling in a few spots to make other
errors easier to troubleshoot in the future.

Release Notes:

- N/A
2024-03-21 11:29:35 -04:00
Piotr Osiewicz
e20508f66c
lsp: Add partial support for insert/replace completions (#9634)
Most notably, this should do away with completions overriding the whole
word around completion trigger text. Fixes: #4816



Release Notes:

- Fixed code completions overriding text around the cursor.
2024-03-21 16:19:21 +01:00
Piotr Osiewicz
6184278faf
chore: Bump Rust version to 1.77 (#9631)
Release Notes:

- N/A
2024-03-21 15:42:59 +01:00
Remco Smits
65152baa3f
Fix prettier-plugin-organize-imports plugin removes used imports (#9598)
### Issue
So this pull request fixes an issue that was driven me crazy. The issue
was that when you use the `prettier-plugin-organize-imports` It would
remove some imports that should not be removed before they were used
inside the module itself.

You can reproduce it with the following `prettierrc.json` config and
source code. When you **save** the file, it would remove the `import
clsx from "clsx";` import from the file.

**Prettier config**
```json
{
  "semi": true,
  "tabWidth": 4,
  "trailingComma": "es5",
  "useTabs": true,
  "plugins": [
    "prettier-plugin-tailwindcss",
    "prettier-plugin-organize-imports"
  ]
}
```

**Source code**
```typescript
import clsx from "clsx";

export default function Home() {
  return (
      <main>
	      {clsx("asdjklasdjlkasd", "asdjlkasjdjlk")}
      </main>
  );
}
``` 

### Findings
After a deep dive with @mrnugget, I was debugging deep down the prettier
plugin system and found the issue that was causing this issue. When I
was looking inside the
`node_modules/prettier-plugin-organize-imports/lib/organize.js`. I saw
the following code that looked strange to me because it falls back to
`file.ts` if `filepath` is not passed through inside the prettier config
options.

<img width="860" alt="Screenshot 2024-03-20 at 21 31 46"
src="https://github.com/zed-industries/zed/assets/62463826/47177fe5-e5a9-41d8-9f2f-0304b2c2159f">

So the issue was small, if you look at the following code, the `path`
key should be `filepath` inside the
`crates/prettier/src/prettier_server.js:205`
![Screenshot 2024-03-20 at 21 35
25](https://github.com/zed-industries/zed/assets/62463826/1eea0a88-c886-4632-9c69-9f3095126971)

Release Notes:

- Fixed prettier integration not using the correct filepath when
invoking prettier, which could lead to some prettier plugins failing to
format correctly.
([#9496](https://github.com/zed-industries/zed/issues/9496)).
2024-03-21 08:23:15 +01:00
Conrad Irwin
ac4c6c60f1
Make it (a tiny bit) easier to run your own collab (#9557)
* Allow creating channels when seeding
* Allow configuring a custom `SEED_PATH`
* Seed the database when creating/migrating it so you don't need a
  separate step for this.

Release Notes:

- N/A
2024-03-20 21:00:02 -06:00
Conrad Irwin
1062c5bd26
Fix copilot modal (#9613)
Release Notes:

- Fixed copilot modal not responding
([#9596](https://github.com/zed-industries/zed/issues/9596)). (preview
only)
2024-03-20 20:37:40 -06:00
Mikayla Maki
0b019282c3
Wayland: double click (#9608)
This PR builds off of an earlier version of
https://github.com/zed-industries/zed/pull/9595, rearranges some of the
logic, and removes an unused platform API.

Release Notes:

- N/A

---------

Co-authored-by: apricotbucket28 <agustin.nicolas.marcos@outlook.com>
2024-03-20 19:22:47 -07:00
Ezekiel Warren
9b0949b6fb
Allow specifying no base keymap (#9471)
This PR is a bit of a shot in the dark. I'm not sure if this will be
acceptable and I understand if it gets rejected.

I've been trying to integrate Zed as my daily driver and the key
bindings have been a major hurdle for me. Mostly due to the
windows/linux keybindings being messed up, but also me wanting to have
more chained key bindings similar to helix or common in custom neovim
configurations.

I think having a `None` base keymap would allow someone to more easily
implement a new base keymap (#4642) and would make my daily use of Zed a
little nicer 😅.

Also I am aware that there would need to be a little more work done in
this PR for the other base keymaps such as 'atom' since they assume the
'default' (vscode) base keymaps are loaded. I'm happy to do that work if
a 'none' base keymap is acceptable.

Release Notes:

- Added ability to specify no base keymap which allows for full
keybinding customization
2024-03-20 18:52:17 -06:00
Andrew Lygin
5602c48136
Action release handlers (#8782)
This PR adds support for handling action releases &mdash; events that
are fired when the user releases all the modifier keys that were part of
an action-triggering shortcut.

If the user holds modifiers and invokes several actions sequentially via
shortcuts (same or different), only the last action is "released" when
its modifier keys released.

~The following methods were added to `Div`:~
- ~`capture_action_release()`~
- ~`on_action_release()`~
- ~`on_boxed_action_release()`~

~They work similarly to `capture_action()`, `on_action()` and
`on_boxed_action()`.~

See the implementation details in [this
comment](https://github.com/zed-industries/zed/pull/8782#issuecomment-2009154646).

Release Notes:

- Added a fast-switch mode to the file finder: hit `p` or `shift-p`
while holding down `cmd` to select a file immediately. (#8258).

Related Issues:

- Implements #8757 
- Implements #8258
- Part of #7653 

Co-authored-by: @ConradIrwin
2024-03-20 18:43:31 -06:00
Mikayla Maki
91ab95ec82
Fix bugs in linux text system (#9604)
Supersedes https://github.com/zed-industries/zed/pull/9579 by manually
including it.

Release Notes:

- N/A
2024-03-20 15:27:56 -07:00
Max Brunsfeld
585e8671e3
Add a schema to extensions, to prevent installing extensions on too old of a Zed version (#9599)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-20 17:33:26 -04:00
白山風露
b1feeb9f29
Windows: Refactoring (#9580)
Aggregate `DefWindowProc` calls with individual handler return value as
`Option<isize>`

Release Notes:

- N/A
2024-03-20 13:36:28 -07:00
Mikayla Maki
78e116c111
Fix skip prompt warning (#9590)
This fixes a non-panicking log error caused by
https://github.com/zed-industries/zed/pull/9452

Release Notes:

- N/A
2024-03-20 13:35:29 -07:00
Max Brunsfeld
d699b8e104
Allow extensions to define more of the methods in the LspAdapter trait (#9554)
Our goal is to extract Svelte support into an extension, since we've
seen problems with the Tree-sitter Svelte parser crashing due to bugs in
the external scanner. In order to do this, we need a couple more
capabilities in LSP extensions:

* [x] `initialization_options` - programmatically controlling the JSON
initialization params sent to the language server
* [x] `prettier_plugins` - statically specifying a list of prettier
plugins that apply for a given language.
* [x] `npm_install_package`

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-03-20 12:47:04 -07:00
Jason Lee
0ce5cdc48f
Only allow opening one Extensions view (#9569)
Release Notes:

- Changed the extensions view to only allow one open instance at a time.


## Before

<img width="494" alt="image"
src="https://github.com/zed-industries/zed/assets/5518/9329e685-1946-4384-bec3-f7eadf18a0cc">
2024-03-20 14:49:36 -04:00
Thorsten Ball
3853991c20
Format prettier_server.js (#9583)
This PURELY formats the file by opening it in Zed and hitting save with
save-on-format on.

It's been bugging me that I can't change the file without the whole
thing getting reformatted, so here we are.

Release Notes:

- N/A
2024-03-20 19:49:14 +01:00
Marshall Bowers
3a2eb12f68
Fix binary name for extension CLI (#9591)
This PR fixes the binary name for the extension CLI.

This was originally done in #9541, but got accidentally reverted in
#9549.

Release Notes:

- N/A
2024-03-20 14:16:23 -04:00
Mikayla
59bc81d1bc
v0.129.x dev 2024-03-20 09:16:41 -07:00
Anthony Eid
88857f8149
VS Code -> Zed tasks converter (#9538)
We can convert shell, npm and gulp tasks to a Zed format. Additionally, we convert a subset of task variables that VsCode supports.

Release notes:

- Zed can now load tasks in Visual Studio Code task format

---------

Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-03-20 16:37:26 +01:00
Jason Lee
269d2513ca
Add support for applying theme after extension is installed (#9529)
Release Notes:

- Added support for opening the theme selector with installed themes
after installing an extension containing themes.
([#9228](https://github.com/zed-industries/zed/issues/9228)).

<img width="1315" alt="Screenshot 2024-03-20 at 11 00 35 AM"
src="https://github.com/zed-industries/zed/assets/1486634/593389b3-eade-4bce-ae17-25c02a074f21">

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-03-20 11:13:58 -04:00
Marshall Bowers
6cec389125
ui: Make top_padding an associated function on the TitleBar (#9577)
This PR makes the function for computing the top padding for the
`TitleBar` an associated function.

Release Notes:

- N/A
2024-03-20 10:55:09 -04:00
Antonio Scandurra
9ab7a22fa8 Fix licensing errors 2024-03-20 15:52:02 +01:00
Antonio Scandurra
f2394c76f5 Fix licensing 2024-03-20 13:03:13 +01:00
Tim Masliuchenko
7855b9e9a8
Allow to handle autoclosed characters differently (#8666)
Adds the `always_treat_brackets_as_autoclosed` setting to control how
the autoclosed characters are handled.

The setting is off by default, meaning the behaviour stays the same
(following how VSCode handles autoclosed characters).
When set to `true`, the autoclosed characters are always skipped over
and auto-removed no matter how they were inserted (following how Sublime
Text/Xcode handle this).


https://github.com/zed-industries/zed/assets/471335/304cd04a-59fe-450f-9c65-cc31b781b0db


https://github.com/zed-industries/zed/assets/471335/0f5b09c2-260f-48d4-8528-23f122dee45f

Release Notes:

- Added the setting `always_treat_brackets_as_autoclosed` (default:
`false`) to always treat brackets as "auto-closed" brackets, i.e.
deleting the pair when deleting start/end, etc.
([#7146](https://github.com/zed-industries/zed/issues/7146)).

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-03-20 09:35:42 +01:00
Ezekiel Warren
d5e0817fbc
windows: Fix title bar height when maximized (#9449)
screenshots and description incoming

## title bar when window is maximized
| before | after |
| ---    | ---   |
|
![image](https://github.com/zed-industries/zed/assets/1284289/075a943d-54db-4b71-9fa0-15f823255182)
|
![image](https://github.com/zed-industries/zed/assets/1284289/39a1d381-fcfd-4651-aab4-231a8ec3bd99)
|

## ~~caption buttons at 200%~~
~~buttons are now properly responsive at different scales~~
~~closes #9438~~
~~proper scale factor handling in follow up PR (possibly #9440)~~

<details>
  <summary>out of date image</summary>


![scale-factor](https://github.com/zed-industries/zed/assets/1284289/299d37b8-0d2e-4f2e-81db-2fff6fc59a62)
</details>

should be fixed by https://github.com/zed-industries/zed/pull/9456


Release Notes:

- N/A
2024-03-19 20:54:00 -07:00
Remco Smits
3dadfe4787
Channel chat: Add edit message (#9035)
**Summary**:
- Removed reply message from message_menu
- Made render_popover_buttons a bit more reusable
- Fixed issue that you can't close the reply/edit preview when you are
not focusing the message editor
- Notify only the new people that were mentioned inside the edited
message

**Follow up**
- Fix that we update the notification message for the people that we
mentioned already
- Fix that we remove the notification when a message gets deleted.
  - Fix last acknowledge message id is in correct now

**Todo**:
- [x] Add tests
- [x] Change new added bindings to the `Editor::Cancel` event.

Release Notes:

- Added editing of chat messages
([#6707](https://github.com/zed-industries/zed/issues/6707)).

<img width="239" alt="Screenshot 2024-03-09 at 11 55 23"
src="https://github.com/zed-industries/zed/assets/62463826/b0949f0d-0f8b-43e1-ac20-4c6d40ac41e1">
<img width="240" alt="Screenshot 2024-03-13 at 13 34 23"
src="https://github.com/zed-industries/zed/assets/62463826/d0636da2-c5aa-4fed-858e-4bebe5695ba7">

---------

Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-03-19 19:49:04 -06:00
Conrad Irwin
5139aa3811
Fix merge conflict in collab (#9550)
Release Notes:

- N/A
2024-03-19 16:02:33 -06:00
Max Brunsfeld
fd11bd68f2
Perform extension packaging in extension-cli (#9549)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-19 17:26:06 -04:00
张小白
85c294da9a
windows: Implement app_version (#9410)
#### Call `app_version`:

![Screenshot 2024-03-16
011821](https://github.com/zed-industries/zed/assets/14981363/9e618e49-fee2-4e7a-b884-6b0be05a0c95)

#### `Zed.exe` info:

![Screenshot 2024-03-16
011856](https://github.com/zed-industries/zed/assets/14981363/2b17a5df-ad38-42d0-8396-53680d77101d)


Release Notes:

- N/A
2024-03-19 12:40:57 -07:00
Luke Jones
cfa0fc96f0
wayland: change some borrow_mut to borrow, reduce borrow scopes, fix two crashes (#9306)
Release Notes:

- N/A
2024-03-19 12:40:09 -07:00
张小白
086f4e63c5
windows: Properly handle DPI (#9456)
As I mentioned before, there are the following issues with how GPUI
handles scale factors greater than 1.0:
1. The title bar buttons do not function correctly, with minimizing
button performing maximization and maximizing button performing closure.
2. As discussed in #8809, setting a scale factor greater than 1.0 causes
GPUI's drawing content to be pushed off the screen.

This PR introduces `LogicalSize` and `PhysicalSize` to differentiate
between coordinate systems for proper GPUI rendering, and now scale
factors above 1.5 are working correctly.

`Zed` with a scale factor equals 1.5, and change between different scale
factors:



https://github.com/zed-industries/zed/assets/14981363/3348536d-8bd3-41dd-82f6-052723312a5b



Release Notes:

- N/A
2024-03-19 12:39:36 -07:00
apricotbucket28
2c36652be2
wayland: fix handling of non-discrete scroll events (#9548)
https://github.com/zed-industries/zed/pull/9103 broke touchpad scrolling
on Wayland
This PR correctly filters the `Axis` to handle all non-discrete scroll
events (see
https://wayland.app/protocols/wayland#wl_pointer:enum:axis_source)

Should fix https://github.com/zed-industries/zed/issues/9525

Release Notes:

- N/A
2024-03-19 12:25:10 -07:00
Nathan Sobo
8ae5a3b61a
Allow AI interactions to be proxied through Zed's server so you don't need an API key (#7367)
Co-authored-by: Antonio <antonio@zed.dev>

Resurrected this from some assistant work I did in Spring of 2023.
- [x] Resurrect streaming responses
- [x] Use streaming responses to enable AI via Zed's servers by default
(but preserve API key option for now)
- [x] Simplify protobuf
- [x] Proxy to OpenAI on zed.dev
- [x] Proxy to Gemini on zed.dev
- [x] Improve UX for switching between openAI and google models
- We current disallow cycling when setting a custom model, but we need a
better solution to keep OpenAI models available while testing the google
ones
- [x] Show remaining tokens correctly for Google models
- [x] Remove semantic index
- [x] Delete `ai` crate
- [x] Cloud front so we can ban abuse
- [x] Rate-limiting
- [x] Fix panic when using inline assistant
- [x] Double check the upgraded `AssistantSettings` are
backwards-compatible
- [x] Add hosted LLM interaction behind a `language-models` feature
flag.

Release Notes:

- We are temporarily removing the semantic index in order to redesign it
from scratch.

---------

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Thorsten <thorsten@zed.dev>
Co-authored-by: Max <max@zed.dev>
2024-03-19 19:22:26 +01:00
Antonio Scandurra
2ea333fff6
Insert hitbox if div contains tooltip (#9545)
Release Notes:

- Fixed a bug that would cause certain tooltips to not show up
(preview-only).
2024-03-19 19:02:59 +01:00
Ezekiel Warren
ac6c4f3ca8
windows: fix 'space' keystroke keydown event (#9476)
the space key was being reported as key " " which didn't allow it to be
used in keybindings

Release Notes:

- N/A
2024-03-19 10:35:28 -07:00
Mikayla Maki
fd0071f2af
Add an animation to the LSP checking indicator (#9463)
Spinner go spinny.

Extra thanks to @kvark for helping me with the shaders.



https://github.com/zed-industries/zed/assets/2280405/9d5f4f4e-0d43-44d2-a089-5d69939938e9


Release Notes:

- Added a spinning animation to the LSP checking indicator

---------

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2024-03-19 10:16:18 -07:00
Kyle Kelley
56bd96bc64
Image viewer (#9425)
This builds on #9353 by adding an image viewer to Zed. Closes #5251.

Release Notes:

- Added support for rendering image files
([#5251](https://github.com/zed-industries/zed/issues/5251)).

<img width="1840" alt="image"
src="https://github.com/zed-industries/zed/assets/836375/3bccfa8e-aa5c-421f-9dfa-671caa274c3c">

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-19 10:13:10 -07:00
Marshall Bowers
8d515a620f
Update binary name for extension CLI (#9541)
This PR updates the binary name used by the extension CLI from
`extension_cli` to `zed-extension`.

Release Notes:

- N/A
2024-03-19 12:36:53 -04:00
Conrad Irwin
d6b7f14b51
suggested extensions (#9526)
Follow-up from #9138

Release Notes:

- Adds suggested extensions for some filetypes
([#7096](https://github.com/zed-industries/zed/issues/7096)).

---------

Co-authored-by: Felix Zeller <felixazeller@gmail.com>
2024-03-19 10:06:01 -06:00
Niklas Wimmer
7573f35e8e
Simplify and document parts of linux text system code (#9443)
I mainly focused on improving the `font_id` function, see the
description of e286483262 for more
details. The rest are some drive-by changes I could not resist to.

When I am right about af4d6c43ce, someone
with a Mac could change it there as well.

This PR is probably best reviewed commit by commit :)

cc @gabydd @h3mosphere

Release Notes:

- N/A

---------

Signed-off-by: Niklas Wimmer <mail@nwimmer.me>
2024-03-19 08:27:48 -07:00
白山風露
250528d28f
Windows: Auto close HANDLE (#9429)
`HANDLE` is wrapped in a RAII struct.

Release Notes:

- N/A

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-19 08:21:01 -07:00
Max Brunsfeld
868616d62e
Introduce extension-cli binary, for packaging extensions in CI (#9523)
This will be used in the
[extensions](https://github.com/zed-industries/extensions) repository
for packaging the extensions that users submit.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-03-19 10:50:21 -04:00
Ben Hamment
7ef6600cdd
Improve Ruby language to recognize Guardfiles (#9530)
Release Notes:

- Improved Ruby language to recognize Guardfile.
2024-03-19 10:44:32 -04:00
Tobias Decking
97fbec9b33
Clean up the live_kit_client manifest file (#9532)
Removes some redundant dependency defenitions and updates one
dependency.
2024-03-19 14:31:47 +01:00
Piotr Osiewicz
080e25dd45 chore: Merge zed lib with zed binary.
TL;DR:
- shaves off about 0.5 seconds from most of our debug builds.
- It would've slightly regressed release build due to preventing build pipelining, but as a tradeoff I've bumped up codegen-units for zed.

\# What did you come up with this time Piotr
In our zed repository I've noticed that merely *loading dependencies* in each crate takes non-trivial amount of time (~800ms in case of editor).
That is to say, the moment you \`use editor\`, your build time increases by 800ms - this happens just once in crate though, as it looks like compiler has to load .rlibs of all of the referenced dependencies.
This is visible under rustc's self-profile. Repro steps on twitter: https://twitter.com/PiotrOsiewicz/status/1762845413072101567

\# How does this commit alleviate this?
zed lib + zed bin are on critical path of every build and cumulatively take about 3s to build. This commit bundles all of this up into ~2.2s of bin build time instead.

\# Wait, splitting binary targets is good, no?
Splitting up a binary target into lib + bin is generally considered to be a good practice, as you can then reuse the lib part elsewhere if needed.
It also allows the build to kick off the moment metadata for all of the dependencies is available (thus, you don't need to wait for codegen).

However, we do not really use zed as a lib, so the first benefit is not really a thing for us.
The latter *is* indeed something we lose out on in release mode (in dev codegen phase of leaf-ish crates is insignificant, as we use shared generics - thus we don't spend much time codegening).
That's why I've bumped codegen units for zed crate to 16 in release mode to keep build times in tact.
2024-03-19 10:54:36 +01:00
Hans
79a424f28f
Add Vue language server auto update (#9474)
For #9401

---------

Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
2024-03-19 09:58:07 +01:00
Andrew Lygin
192cd5f2d2
Fix file git status refresh on .gitignore update (#9466)
This PR fixes file name coloring in the project panel and tabs when
.gitignore file is updated. It's intended to fix #7831.

There's another, less vivid, problem with git-aware labels coloring.
It's about files that are both ignored and contained in the git index.
I'll file a separate issue for it to keep this fix focused.

Release Notes:

- Fixed file Git status refreshing on .gitignore update (#7831).
2024-03-18 20:35:38 -06:00
Tobias Decking
1e1fb21c81
Merge prost dependecies (#9522)
This patch puts the prost, prost-build, and prost-types dependencies
together and unifies their version. This improves organization a bit in
addition to improving build time slightly, since a redundant version of
prost is now removed.

The dependencies are _not_ updated to the newest versions, because the
newest versions add a dependency on the `protoc` application, which is
not provided by cargo and thus breaks the building process.
2024-03-18 20:33:20 -06:00
Conrad Irwin
0c82585ea2
Bump collab min version (#9521)
We made a change last week to allow creating files with names. This
means some files have null saved_mtime, which old versions of zed panic
on.

A fix is available in 0.126.3 and above

Release Notes:


- N/A
2024-03-18 16:59:51 -06:00
apricotbucket28
d8e32c3e3c
linux: scrolling improvements (#9103)
This PR adjusts scrolling to be a lot faster on Linux and also makes
terminal scrolling work.

For Wayland, it makes scrolling faster by handling the `AxisValue120`
event (which also allows high-resolution scrolling on supported mice)
On X11, changed the 1 line per scroll to 3.

### Different solutions

I tried replicating Chromium's scrolling behaviour, but it was
inconsistent in X11/Wayland and found it too fast on Wayland. Plus, it
also didn't match VSCode, since it seems that they do something
different.

Release Notes:

- Made scrolling faster on Linux
- Made terminal scroll on Linux
2024-03-18 14:50:29 -07:00
白山風露
c0f8581b29
Windows: implement symlink (#9508)
Since Windows has a distinction between symlinks for directories and
symlinks for files, the implementation is adapted to this distinction.

Release Notes:

- N/A
2024-03-18 14:27:39 -07:00
Conrad Irwin
cd9b865e0a
maintain channel subscriptions in RAM (#9512)
This avoids a giant database query on every leave/join event.

Release Notes:

- N/A
2024-03-18 15:14:16 -06:00
Conrad Irwin
18fa84b17e
Fix panic loading language queries (#9506)
Release Notes:

- Fixed a panic when loading a language with queries but no grammar
2024-03-18 14:25:26 -06:00
Conrad Irwin
f738bfd703
Don't panic on missing mtime (#9513)
This is expected as of zed 0.128 when a new unsaved file is created

Release Notes:

- Fixed a panic when collaborating with newer zed versions
2024-03-18 14:19:33 -06:00
Tobias Decking
df94906508
Make the cli crate depend on workspace clap (#9507)
This fixes an outstanding TODO.

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-03-18 20:00:37 +01:00
Mayfield
7c0a0e21ab
Add keyboard shortcut to suppress prompt while deleting files/dirs (#9452)
Completes #7228.
Adds back Backspace as the main delete key binding and makes Linux
bindings consistent with macOS

Release Notes:
- ⌘-Delete/⌘-Backspace will now suppress deletion confirmation prompts
in project panel
([#7228](https://github.com/zed-industries/zed/issues/7228)).
2024-03-18 11:43:43 -07:00
Ezekiel Warren
e22d31b52d
windows: Respect "appears transparent" for title bar (#9454)
now respecting the 'appears transparent' titlebar option which is used
in the storybook crate. created for #9453

# storybook

running

```
cargo run -p storybook components/text
```

| before | after |
| ---    | ---   |
|
![image](https://github.com/zed-industries/zed/assets/1284289/88cd93de-4ca9-40d6-aa53-aa7bc65e1f5c)
|
![image](https://github.com/zed-industries/zed/assets/1284289/b3528775-219b-46b7-9f99-da5b88330fbd)
|

Release Notes:

- N/A

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-18 11:39:46 -07:00
Ezekiel Warren
31aaee9130
windows: Don't propagate window char message (#9470)
we were accidentally calling the input handler even when the keydown
event asked it not to be propagated

Release Notes:

- N/A
2024-03-18 11:02:15 -07:00
Ezekiel Warren
0e83b22583
windows: Dispatch missing foreground tasks (#9469)
Some foreground tasks were being missed causing some unresponsiveness in
Zed. The foreground tasks used to happen but it was changed in #9351
(here:
https://github.com/zed-industries/zed/pull/9351/files#diff-5b5e706f04c15d77efd23989ec5b1b1cf73d36144e2d066a074de165533ecaeaL227)

Release Notes:

- N/A
2024-03-18 11:01:51 -07:00
Antonio Scandurra
3d08e20c72
Fix dispatching global actions from a window (#9502)
Fixes https://github.com/zed-industries/zed/issues/9313

Release Notes:

- Fixed a regression that caused global actions to stop working when
invoked from a window (preview-only)
([#9313](https://github.com/zed-industries/zed/issues/9313)).

Co-authored-by: Conrad <conrad@zed.dev>
2024-03-18 18:31:47 +01:00
Ezekiel Warren
4e17ce3b37
windows: credentials implementation (#9385)
Release Notes:

- N/A
2024-03-18 10:16:29 -07:00
张小白
64ebbb4afc
Update display info when window moved to another monitor (#9360)
Release Notes:

- N/A
2024-03-18 09:49:40 -07:00
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