Commit Graph

16625 Commits

Author SHA1 Message Date
Kirill Bulatov
eedef487ac
Add more context to the terminal assistant (#15492)
Release Notes:

- N/A
2024-07-30 20:21:45 +03:00
Jason Lee
1982a5aed1
gpui: Improve img element to support load from Assets (#15482)
Release Notes:

- N/A


Currently, the `img` element provided by GPUI only supports FilePath or
URL, but in actual applications we need to let `img` load an image
embedded in Assets.

The `svg` element can currently support this, but `img` cannot.

For example:

We have such an Assets directory:

```
assets
|- icons
|- images
|--- foo.png
```

```rs
// If give a path, considered an Asset
img("images/foo.png");
// If give a URI, considered a Remote image
img("https://foo.bar/images/foo.png");
// If give a PathBuf, considered a Local file
img(PathBuf::from("path/to/foo.png"));
```


## Example test

```
cargo run -p gpui --example image 
```

<img width="827" alt="image"
src="https://github.com/user-attachments/assets/e45dcf7f-4626-4fb0-aca9-9b6e1045a952">

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-07-30 10:55:48 -04:00
Antonio Scandurra
99bc90a372
Allow customization of the model used for tool calling (#15479)
We also eliminate the `completion` crate and moved its logic into
`LanguageModelRegistry`.

Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-30 16:18:53 +02:00
Kirill Bulatov
1bfea9d443
Show "full" paths in the /file command output (#15483)
Same as /tabs command outputs them

Before:
![Screenshot 2024-07-30 at 16 52
11](https://github.com/user-attachments/assets/acf1c79e-4607-41fc-bd5e-b20dc668eff4)

![Screenshot 2024-07-30 at 16 52
03](https://github.com/user-attachments/assets/dd7fa42f-3ba8-4f1c-9420-2a0246df64b7)

After:
![Screenshot 2024-07-30 at 16 53
16](https://github.com/user-attachments/assets/ee866ecb-2142-4303-9385-c6b856310d43)

![Screenshot 2024-07-30 at 16 53
21](https://github.com/user-attachments/assets/d42b9c77-d5e9-4aaf-8de9-3b160078e622)


Release Notes:

- N/A
2024-07-30 17:03:16 +03:00
Marshall Bowers
b160e13f20
collab: Keep track of last seen Stripe event for each record (#15480)
This PR improves our Stripe event handling by keeping track of the last
event we've seen for each record.

The `billing_customers` and `billing_subscriptions` tables both have a
new `last_stripe_event_id` column. When we apply an event to one of
these records, we store the event ID that was applied.

Then, when we are going through events we can ignore any event that has
an ID that came before the `last_stripe_event_id` (based on the
lexicographical ordering of the IDs).

Release Notes:

- N/A
2024-07-30 10:00:16 -04:00
Bennet Bo Fenner
2ada2964c5
assistant: Make it easier to define custom models (#15442)
This PR makes it easier to specify custom models for the Google, OpenAI,
and Anthropic provider:

Before (google):

```json
{
  "language_models": {
    "google": {
      "available_models": [
        {
          "custom": {
            "name": "my-custom-google-model",
            "max_tokens": 12345
          }
        }
      ]
    }
  }
}
```

After (google):

```json
{
  "language_models": {
    "google": {
      "available_models": [
        {
          "name": "my-custom-google-model",
          "max_tokens": 12345
        }
      ]
    }
  }
}
```

Before (anthropic):

```json
{
  "language_models": {
    "anthropic": {
      "available_models": [
        {
          "custom": {
            "name": "my-custom-anthropic-model",
            "max_tokens": 12345
          }
        }
      ]
    }
  }
}
```

After (anthropic):

```json
{
  "language_models": {
    "anthropic": {
      "version": "1",
      "available_models": [
        {
          "name": "my-custom-anthropic-model",
          "max_tokens": 12345
        }
      ]
    }
  }
}

```

The settings will be auto-upgraded so the old versions will continue to
work (except for Google since that one has not been released).

/cc @as-cii 

Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-07-30 15:46:39 +02:00
Santeri Salmijärvi
13dcb42c1c
Change PathLikeWithPosition<P> into a non-generic type and replace ad-hoc Windows path parsing (#15373)
This simplifies `PathWithPosition` by making the common use case
concrete and removing the manual, incomplete Windows path parsing.
Windows paths also don't get '/'s replaced by '\\'s anymore to limit the
responsibility of the code to just parsing out the suffix and creating
`PathBuf` from the rest. `Path::file_name()` is now used to extract the
filename and potential suffix instead of manual parsing from the full
input. This way e.g. Windows paths that begin with a drive letter are
handled correctly without platform-specific hacks.

Release Notes:

- N/A
2024-07-30 16:39:33 +03:00
Thorsten Ball
41c550cbe1
assistant panel: Avoid auth prompt on provider switch (#15478)
Previously, the following lead to a bug:

1. Set OpenAI key
2. Switch to Anthropic
3. Restart Zed
4. Switch provider to OpenAI -> get prompted for authentication prompt

With this change, you won't get prompted for the OpenAI key again.

Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
2024-07-30 14:25:02 +02:00
Piotr Osiewicz
21ebbc387a
Inline Assist: replace "accept" action on generation error with "restart" (#15476)
Release Notes:

- N/A
2024-07-30 13:40:22 +02:00
Piotr Osiewicz
530feecdaa
tab_switcher: Add support for tab switcher in assistant panel (#15475)
Additionally, I've generalized the implementation of tab switcher so
that - instead of explicitly listing panels it supports (at the time of
writing it was just the terminal panel and nothing else), it now relies
on Panel::pane trait method. As long as that's implemented, you get a
tab switcher support for free.

Release Notes:

- Added support for tab switcher in Assistant panel.
2024-07-30 13:32:13 +02:00
Bennet Bo Fenner
0540291204
settings: Introduce PRESERVED_KEYS to write default values (#15474)
This adds the optional `PRESERVED_KEYS` constant to the `Settings`
trait,
which allows users of the trait to specify which keys should be written
to
the settings file, even if their current value matches the default
value.

That's useful for tagged settings that have, for example, a `"version"`
field
that should always be present in the user settings file, so we can then
reparse
the user settings based on the version.

Co-Authored-By: Thorsten <thorsten@zed.dev>

Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-07-30 13:09:50 +02:00
Antonio Scandurra
fa19bc98ac
Provide user agent when performing HTTP requests (#15470)
Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-30 11:12:37 +02:00
Bennet Bo Fenner
2a649fa824
language model: Fix missing use_tool method in CopilotChatLanguageModel (#15466)
Broke CI after merging #14842 

Release Notes:

- N/A

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-07-30 09:54:42 +02:00
Jason Lee
0c8b17d252
Hide blinking cursor when window is deactivated (#15408)
## Before 

https://github.com/user-attachments/assets/affb8407-a20e-4258-a8f7-b271da5d7b77

## After

https://github.com/user-attachments/assets/654fe7b9-330a-40c8-8885-72e69fa85b0a

Release Notes:

- Hide blinking cursor when window is deactivated ([4710](https://github.com/zed-industries/zed/issues/4710))
2024-07-30 10:49:15 +03:00
Ryan Hawkins
6f0655810e
Add GitHub Copilot Chat Support (#14842)
# Summary

This commit implements Github Copilot Chat support within the existing
Assistant panel/framework. It required a little bit of trickery and
internal API modification, as Copilot doesn't use the same
authentication-style as all of the existing providers, opting to use
OAuth and a short lived API key instead of a straight API key. All
existing Assistant features should work.

Release Notes:
- Added Github Copilot Chat support
([#4673](https://github.com/zed-industries/zed/issues/4673)).

## Screenshots
<img width="1552" alt="A screenshot showing a conversation between a
user and Github Copilot Chat within the Zed editor."
src="https://github.com/user-attachments/assets/73eaf6a2-792b-4c40-a7fe-f763bd6417d7">

---------

Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
2024-07-30 09:32:58 +02:00
Marshall Bowers
d93891ba63
collab: Lay groundwork for reconciling with Stripe using the events API (#15459)
This PR lays the initial groundwork for using the Stripe events API to
reconcile the data in our system with what's in Stripe.

We're using the events API over webhooks so that we don't need to stand
up the associated infrastructure needed to handle webhooks effectively
(namely an asynchronous job queue).

Since we haven't configured the Stripe API keys yet, we won't actually
spawn the reconciliation background task yet, so this is currently a
no-op.

Release Notes:

- N/A
2024-07-29 23:50:07 -04:00
Marshall Bowers
28c14cdee4
collab: Add separate billing_customers table (#15457)
This PR adds a new `billing_customers` table to hold the billing
customers.

Previously we were storing both the `stripe_customer_id` and
`stripe_subscription_id` in the `billable_subscriptions` table. However,
this creates problems when we need to correlate subscription events back
to the subscription record, as we don't know the user that the Stripe
event corresponds to.

By moving the `stripe_customer_id` to a separate table we can create the
Stripe customer earlier in the flow—before we create the Stripe Checkout
session—and associate that customer with a user. This way when we
receive events down the line we can use the Stripe customer ID to
correlate it back to the user.

We're doing some destructive actions to the `billing_subscriptions`
table, but this is fine, as we haven't started using them yet.

Release Notes:

- N/A
2024-07-29 22:48:21 -04:00
Marshall Bowers
66121fa0e8
collab: Add endpoint for managing a billing subscription (#15455)
This PR adds a new `POST /billing/subscriptions/manage` endpoint that
can be used to manage a billing subscription.

The endpoint accepts a `github_user_id` to identify the user, as well as
an optional `subscription_id` for managing a specific subscription. If
`subscription_id` is not provided, it try and use the active
subscription, if there is only one.

Right now the endpoint only supports cancelling an active subscription.
This is done by passing `"intent": "cancel"` in the request body.

The endpoint will return the URL to a Stripe customer portal session,
which the caller can redirect the user to.

Here's an example of how to call it:

```sh
curl -X POST "http://localhost:8080/billing/subscriptions/manage" \
     -H "Authorization: <ADMIN_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{"github_user_id": 12345, "intent": "cancel"}'
```

Release Notes:

- N/A
2024-07-29 20:05:17 -04:00
Marshall Bowers
e15d59c445
collab: Add endpoint for initiating a billing subscription (#15452)
This PR adds a new `POST /billing/subscriptions` endpoint that can be
used to initiate a billing subscription.

The endpoint will use the provided `github_user_id` to look up a user,
generate a Stripe Checkout session, and then return the URL.

The caller would then redirect the user to the URL to initiate the
checkout flow.

Here's an example of how to call it:

```sh
curl -X POST "http://localhost:8080/billing/subscriptions" \
     -H "Authorization: <ADMIN_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{"github_user_id": 12345}'
```

Release Notes:

- N/A
2024-07-29 17:31:36 -04:00
Kyle Kelley
8bb34fd93e
repl: Log Jupyter kernel process stderr and stdout (#15391)
Super simple piping of logs from the Jupyter kernels to the Zed logs.

Release Notes:

- Added logging of stderr from Jupyter kernels to the Zed logs
2024-07-29 14:23:35 -07:00
Antonio Scandurra
02c51c9b56
Fix rendering of focused offscreen block when scrolled to bottom (#15449)
This change fixes a bug when a block is focused but offscreen.
Previously, we used the last row, but this caused a spurious block to be
rendered when scrolled to the end of the file. With this change we
always render off-screen blocks below the editor's clipping box.

Release Notes:

- Fixed a bug that caused the inline assistant to be displayed twice in
certain circumstances.

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-29 20:39:21 +02:00
Marshall Bowers
085d41b121
collab: Add billing_subscriptions table (#15448)
This PR adds a new `billing_subscriptions` table to the database, as
well as some accompanying models/queries.

In this table we store a minimal amount of data from Stripe:

- The Stripe customer ID
- The Stripe subscription ID
- The status of the Stripe subscription

This should be enough for interactions with the Stripe API (e.g., to
[create a customer portal
session](https://docs.stripe.com/api/customer_portal/sessions/create)),
as well as determine whether a subscription is active (based on the
`status`).

Release Notes:

- N/A
2024-07-29 14:32:13 -04:00
Joseph T. Lyons
0702ed5cd6
Add is_staff and destination to download events (#15445)
Release Notes:

- N/A
2024-07-29 14:21:29 -04:00
Antonio Scandurra
2b871a631a
Use fuzzy-matching to locate symbols when resolving edit steps (#15447)
Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-29 20:21:19 +02:00
Michael Angerman
5e1aa898d4
workspace: Remove unused code (#15440)
Release Notes:

- N/A
2024-07-29 12:12:10 -04:00
Marshall Bowers
aa1633ba40
assistant: Allow guests to create new contexts on the host (#15439)
This PR extends collaboration in the Assistant to allow guests to create
new contexts on the host when collaborating.

Release Notes:

- N/A
2024-07-29 12:01:09 -04:00
Thorsten Ball
2b0c60043d
file finder: Fix ./ breaking new-path prompt (#15438)
Fixes #15426.

The `./` was implicitly assumed to be there by the prompt, so we'd end
up with `././foobar` when typing in an explicit `./`.

This fixes the issue by stripping `./` from the query, like we also
strip `/`.

Release Notes:

- Fixed paths starting with `./` breaking the new-path file picker when
the system prompts are disabled.
([#15426](https://github.com/zed-industries/zed/issues/15426)).
2024-07-29 17:46:52 +02:00
Bennet Bo Fenner
0b4afe518b
assistant: Remove feature flag for terminal inline assistant (#15432)
This PR removes the feature flag for the terminal inline assistant,
making it available to everyone.

Release Notes:

- Use Ctrl+Enter to summon the inline assistant in the terminal, which
let's you generate terminal commands based on your description
([demo](https://twitter.com/thorstenball/status/1814241447383605329))
2024-07-29 17:37:11 +02:00
Suhun Han
f124ca6474
project_panel: Double-click on blank space in project panel to create a new file (#15353)
Similar feature implemented in VSCode.


https://github.com/user-attachments/assets/ae250b5f-283c-4211-8947-d5d5703eb2d0


Release Notes:

- Added double-click to create a new file when clicking on blank space
in the project panel.
2024-07-29 18:33:13 +03:00
Conrad Irwin
6db33b83d8
vim: Fix >... (#15404)
Co-Authored-By: @Alextopher

Release Notes:

- vim: Fixed a hang when repeating an aborted operation
([#15399](https://github.com/zed-industries/zed/issues/15399)).
2024-07-29 09:22:25 -06:00
Thorsten Ball
f58ef9b82b
zed: Persist window stack order across restarts (#15419)
This changes the workspace/session serialization to also persist the
order of windows across restarts.

Release Notes:

- Improved restoring of windows across restarts: the order of the
windows is now also restored. That means windows that were in the
foreground when Zed was quit will be in the foreground after restart.
(Right now only supported on Linux/X11, not on Linux/Wayland.)

Demo:



https://github.com/user-attachments/assets/0b8162f8-f06d-43df-88d3-c45d8460fb68
2024-07-29 17:05:56 +02:00
Antonio Scandurra
6e1f7c6e1d
Use tool calling instead of XML parsing to generate edit operations (#15385)
Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-29 16:42:08 +02:00
Bennet Bo Fenner
f6012cd86e
assistant: Improve discoverability of terminal inline assist (#15431)
This adds a button to the terminal tab bar:

<img width="444" alt="image"
src="https://github.com/user-attachments/assets/71baadae-0ecf-493f-853c-34d4d6a48310">


Release Notes:

- N/A
2024-07-29 15:38:25 +02:00
earomc
1a9af10ca2
rust: Add highlight selector for doc comments (#15384)
## Release Notes:

- Added ability to style doc comments in Rust separately with
`comment.doc`
([#15322](https://github.com/zed-industries/zed/issues/15322)).


Just required adding another query to the highlights.scm file. Took
inspiration from the tree-sitter-rust repository
[here](https://github.com/tree-sitter/tree-sitter-rust/blob/master/queries/highlights.scm)

#### Doc comments customized in the theme are working now:

![grafik](https://github.com/user-attachments/assets/549f20d6-534c-4c3b-a317-3be6bc44352e)

#### Snippet from the .json theme file

![grafik](https://github.com/user-attachments/assets/da1d7e3d-b6a5-4ba5-9fef-047d69f9ea03)
2024-07-29 08:53:17 -04:00
Piotr Osiewicz
c97d035eea
chore: Clean up allocs around project panel (#15422)
A drive-by I did when looking at something else.

Release Notes:

- N/A
2024-07-29 14:21:41 +02:00
Ephram
78a2539d59
Selectable diagnostic popover text (#14518)
Release Notes:

- Added the ability to select and copy text from diagnostic popovers

- Fixed #12695




https://github.com/user-attachments/assets/b896bacf-ecbc-48f5-8228-a3821f0b1a4e

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-07-28 23:13:13 -06:00
Conrad Irwin
583b6235fb
SSH remoting: terminal & tasks (#15321)
This also rolls back the `TerminalWorkDir` abstraction I added for the
original remoting, and tidies up the terminal creation code to be clear
about whether we're creating a task *or* a terminal. The previous logic
was a little muddy because it assumed we could be doing both at the same
time (which was not true).

Release Notes:

- remoting alpha: Removed the ability to specify `gh cs ssh` or `gcloud
compute ssh` etc. See https://zed.dev/docs/remote-development for
alternatives.
- remoting alpha: Added support for terminal and tasks to new
experimental ssh remoting
2024-07-28 22:45:00 -06:00
Benjamin Davies
26d0a33e79
Add Vim digraphs (#14887)
Vim digraphs are a way to insert special characters using sequences of
two ASCII characters. I've implemented the feature using a new `Digraph`
operator, following the example of `AddSurrounds`. There are still a few
issues that I'm not sure what the best way to resolve them is.

- To insert `ş`, the user must pause between pressing `ctrl-k` and `s
,`, otherwise it triggers the binding for `ctrl-k s`. Is there a way to
disable `ctrl-k *` bindings while in insert, replace or waiting mode?
- Is there a better way to insert a string at all of the cursors? At the
moment I'm constructing the edits manually.
- The table of default digraphs is a 1.4k line rust expression. Is this
okay as long as it's in its own module?
- I'd like a second opinion on how best to structure the settings.json
entry.
- I have omitted the "meta character" feature as I don't think it makes
sense when editing UTF-8 text.

Release Notes:

- Added support for Vim digraphs.

Resolves #11871
2024-07-28 22:44:32 -06:00
Michael Angerman
b87028956f
Remove the file session.rs in crate/zed which is no longer used (#15394)
There was an empty file *session.rs* in the crate zed which was empty so
I am going ahead and removing it...

Release Notes:

- N/A
2024-07-28 21:32:03 -04:00
Piotr Osiewicz
a875dd153d
lsp: Add server-side tracing support (#15230)
This PR adds another row to the LSP log view: Server traces

![image](https://github.com/user-attachments/assets/e3f77944-45e0-4d04-92fd-aea212859e86)


[Traces](https://docs.rs/lsp-types/latest/lsp_types/notification/enum.LogTrace.html)
are intended for logging execution diagnostics, which is different from
`LogMessage` that we currently support.
When `Server trace` is selected, user can select the level of tracing
(`off`/`messages`/`verbose`) to their liking.

Release Notes:

- Added support for language server tracing to the LSP log view.
2024-07-29 01:53:30 +02:00
Kyle Kelley
bb188f673e
repl: Pass session id to kernel connections (#15389)
Updated runtimelib to 0.14 and passed a kernel session ID through to
identify our client.

Release Notes:

- N/A
2024-07-28 14:37:25 -07:00
Peter Tripp
49f87165ea
Show -v verbose flag in go test task label (#15375) 2024-07-28 11:48:40 -04:00
CharlesChen0823
66ada3e44c
terminal: Add Alt key bindings for terminal (#14556)
- Makes using emacs-style alt/option/meta key shortcuts work in terminal (e.g. `M-%`)
- Fixes: #14543 

Co-authored-by: Peter Tripp <peter@zed.dev>
2024-07-28 09:42:17 -04:00
Antonio Scandurra
d6bdaa8a91
Simplify LLM protocol (#15366)
In this pull request, we change the zed.dev protocol so that we pass the
raw JSON for the specified provider directly to our server. This avoids
the need to define a protobuf message that's a superset of all these
formats.

@bennetbo: We also changed the settings for available_models under
zed.dev to be a flat format, because the nesting seemed too confusing.
Can you help us upgrade the local provider configuration to be
consistent with this? We do whatever we need to do when parsing the
settings to make this simple for users, even if it's a bit more complex
on our end. We want to use versioning to avoid breaking existing users,
but need to keep making progress.

```json
"zed.dev": {
  "available_models": [
    {
      "provider": "anthropic",
        "name": "some-newly-released-model-we-havent-added",
        "max_tokens": 200000
      }
  ]
}
```

Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-28 11:07:10 +02:00
Antonio Scandurra
e0fe7f632c
Restore "Avoid buffering line content to compute indent guides" (#15284)
Fixes https://github.com/zed-industries/zed/issues/15218
Reverts zed-industries/zed#15282

Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-28 10:52:39 +02:00
apricotbucket28
04e25525bf
x11: Fix window menu not showing (#15328)
Fixes
https://github.com/zed-industries/zed/issues/15245#issuecomment-2252790889

Release Notes:

- Linux: Fixed window menu not showing on X11
2024-07-27 12:29:48 -07:00
Marshall Bowers
26aec4ba99
ui: Remove old settings components (#15347)
This PR removes the old settings components, as they've been adapted
into other components for the settings UI.

Release Notes:

- N/A
2024-07-27 14:12:32 -04:00
Marshall Bowers
cb07e02ce9
ui: Apply elevation outside SettingsContainer (#15346)
This PR changes the `SettingsContainer` component such that the
elevation styles are applied by the parent instead of
`SettingsContainer` itself.

This means that components using `SettingsContainer` can be embedded in
different contexts, like the settings UI or a popover containing the
settings.

Release Notes:

- N/A
2024-07-27 14:00:03 -04:00
Harsh Narayan Jha
b05d532991
Add "Copy Path" and "Copy Relative Path" items into tab context menu (#15260)
Release Notes:

- Added "Copy Path" and "Copy Relative Path" items into tab context menu ([#13970](https://github.com/zed-industries/zed/issues/13970))

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2024-07-27 20:29:53 +03:00
张小白
f88278111e
Remove TODO in JsonLspAdapter (#15338)
As the post-install issue is fixed via #15331 , we can remove this
`TODO` now. I have tested on win11, it works fine.

Release Notes:

- N/A
2024-07-27 13:05:48 -04:00
Marshall Bowers
f1d777434b
ui: Give NumericSteppers an ID (#15344)
This PR gives the `NumericStepper` component an ID.

This prevents the UI and buffer font size settings controls from having
their increment/decrement buttons visually change when the other one is
pressed.

Release Notes:

- N/A
2024-07-27 13:02:27 -04:00
Marshall Bowers
b8982ad385
Factor out construction of font-related JSON schemas (#15341)
This PR factors out the construction of the font-related JSON schemas,
as they were used in multiple places.

Release Notes:

- N/A
2024-07-27 12:28:50 -04:00
Marshall Bowers
1ffb34c5fc
Fix more instances of JSON schema getting clobbered when attaching references (#15339)
This PR extends the fix from #15336 to more places that had the same
issue.

An `add_references_to_properties` helper function has been added to
handle these cases uniformly.

Release Notes:

- N/A
2024-07-27 11:44:40 -04:00
Marshall Bowers
8b22f09b6f
Don't clobber other schema fields when attaching references (#15336)
This PR fixes an issue where we would clobber the other JSON Schema
fields for any field that we attached a reference to.

This resulted in these fields (e.g., `buffer_font_family`,
`ui_font_family`) losing things like their descriptions.

The approach has been adjusted that references are now added in an
additive fashion, rather than overriding the entire schema object.

Release Notes:

- Fixed an issue where font-related settings in `settings.json` were
missing their descriptions.
2024-07-27 11:08:13 -04:00
Nick Cernis
e72f33d79e
Fix typo in remote projects sign-in prompt (#15325)
Visible at File → Open Recent → Open Remote Folder…

| Before | After |
| - | - |
| ![Screenshot showing
"featuers"](https://github.com/user-attachments/assets/6e1822c7-74da-4166-a097-ab2315fddd1a)
| ![Corrected
"features"](https://github.com/user-attachments/assets/038380a6-15c1-4c71-ad47-ddd477094d85)
|

Release Notes:

- Fixed typo in remote projects sign-in prompt.
2024-07-27 10:34:48 -04:00
张小白
4976a9e9d8
windows: Fix eslint installation (#15331)
Close #13786. To make `eslint` running on Windows, I made the following
changes:

1. Ensure that `zed` downloads the `.zip` file.
2. Handle the `$shared` symbolic link by copying files to the link
location.
3. In #13891, I mentioned that the `npm` `post-install` script was
always failing. After debugging, I found it was due to missing
environment variables. This has been fixed, and I will submit a new PR
to address the changes in #13891.

With this PR, `eslint` can now successfully run on Windows. Video:



https://github.com/user-attachments/assets/e85451b8-0388-490a-8a75-01c12d744f7c



Release Notes:

- Fixed `eslint` not running on Windows
([#13786](https://github.com/zed-industries/zed/issues/13786)).

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-07-27 10:24:05 -04:00
Marshall Bowers
138c3fcfdd
http_client: Replace build_tarball_url with a more extensible function (#15332)
This PR replaces the `build_tarball_url` with `build_asset_url` that
accepts an `AssetKind` enum to support downloading different kinds of
assets from GitHub.

Right now the only asset kind we support is still `.tar.gz`, but the new
structure is more amenable to adding more asset kinds.

Release Notes:

- N/A
2024-07-27 10:00:45 -04:00
Antonio Scandurra
64add2f222
Add debugging info when a symbol is not found (#15330)
Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-27 15:17:36 +02:00
Antonio Scandurra
70e895a8c7
Fix regression that caused Anthropic custom models to error (#15329)
/cc: @bennetbo 

Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-27 14:45:18 +02:00
Matin Aniss
4bd935b409
gpui: Add support for animated images (#13809)
This PR adds support for animated images. The image requires a id for it
to actually animate across frames.

Currently it only has support for `GIF`, I tried adding decoding a
animated `WebP` into frames but it seems to error. This issue in the
image crate seems to document this
https://github.com/image-rs/image/issues/2263.

Not sure if this is the best way or the desired way for animated images
to work in GPUI but I would really like support for animated images.
Open to feedback.

Example Video:


https://github.com/zed-industries/zed/assets/76515905/011f790f-d070-499b-96c9-bbff141fb002



Closes https://github.com/zed-industries/zed/issues/9993

Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan <nathan@zed.dev>
2024-07-27 14:05:37 +02:00
Marshall Bowers
c0df1e1846
Run clippy for Windows (#15318)
This PR fixes running clippy on Windows, as it broke in #13223.

We can't run shell scripts on Windows, so we need to use something else.

Release Notes:

- N/A
2024-07-26 21:38:34 -04:00
rimuy
e9d0768e3c
Suppress unused parameter warning on remote/ssh_session.rs (#15315)
This was probably an oversight from
https://github.com/zed-industries/zed/pull/15129.


![image](https://github.com/user-attachments/assets/5867e307-f581-4b40-8492-2fb80e87c18c)

Release Notes:

- N/A
2024-07-26 21:11:28 -04:00
Marshall Bowers
380a99038b
live_kit_server: Re-remove protocol submodule (#15317)
This PR re-removes the `protocol` submodule from `live_kit_server`,
since it was incorrectly added back in #15313.

Release Notes:

- N/A
2024-07-26 21:10:56 -04:00
apricotbucket28
88653c4e3e
linux: Respect window_min_size property (#15314)
https://github.com/zed-industries/zed/pull/13126 added the
`window_min_size` property for window creation, but it was only
implemented for macOS. This PR implements the property on Linux as well.

Release Notes:

- N/A
2024-07-26 18:02:31 -07:00
Calin Martinconi
3751f67730
fix: Typos (#15313)
Fixed typos in the code base according with output from `codespell`
tool.

Release Notes:

- N/A
2024-07-26 17:52:37 -07:00
张小白
6af385c09e
windows: Fix some weird IME window panic (#15286)
Previously, we used messages greater than `WM_USER` to pass information
between `WindowsPlatform` and `WindowsWindow`. For example, to close a
window, we handled it as follows:
1. The window sends a message with `WM_USER + 2` to `WindowsPlatform`.
2. `WindowsPlatform`, upon receiving this message, casts the `lparam` to
`HWND` and closes the window.

According to Microsoft's documentation, it is safe to use values between
`WM_USER` and `0xBFFF` as messages. However, certain versions of
Microsoft's IME use `WM_USER + 2` for UNKNOWN purposes. This causes step
2 to be erroneously triggered. The IME window's `lparam` value could be
arbitrary, leading to an attempt to close an arbitrary `HWND` and
resulting in errors.

It is quite surprising that Microsoft indicates using `WM_USER + 2` is
safe, yet Microsoft itself breaks this convention. I mean, well done
Microsoft!

This PR addresses the issue by using the `wparam` with a specific random
value for validation purpose when sending the aforementioned message.
Before `WindowsPlatform` attempts to close the window, it will first
verify the `wparam` value.

Special thanks to @shenjackyuanjie for helping me on this.


Co-authored-by: shenjackyuanjie <3695888@qq.com>


Release Notes:

- Fixed weird panic when IME window is closing(#15185, #12563).

---------

Co-authored-by: shenjack <3695888@qq.com>
2024-07-26 17:40:55 -07:00
张小白
e6cd1cf22b
windows: Remove Send and Sync implementation of DirectWrite (#15263)
This PR uses the `AgileReference` provided by the `windows-rs` crate to
correctly implement `Send` and `Sync` for `DirectWrite`.

Release Notes:

- N/A
2024-07-26 16:46:06 -07:00
Mikayla Maki
a1bd7a1297
Feature/fallback fonts (#15306)
Supersedes https://github.com/zed-industries/zed/pull/12090

fixes #5180
fixes #5055

See original PR for an example of the feature at work.

This PR changes the settings interface to be backwards compatible, and
adds the `ui_font_fallbacks`, `buffer_font_fallbacks`, and
`terminal.font_fallbacks` settings.

Release Notes:

- Added support for font fallbacks via three new settings:
`ui_font_fallbacks`, `buffer_font_fallbacks`, and
`terminal.font_fallbacks`.(#5180, #5055).

---------

Co-authored-by: Junkui Zhang <364772080@qq.com>
2024-07-26 16:42:21 -07:00
Conrad Irwin
3e31955b7f
SSH remote ui (#15129)
Still TODO:
* [x] hide this UI unless you have some ssh projects in settings
* [x] add the "open folder" flow with the new open picker
* [ ] integrate with recent projects / workspace restoration

Release Notes:

- N/A
2024-07-26 16:45:44 -06:00
Conrad Irwin
be86852f95
Allow binding to motions in insert mode (#15308)
Release Notes:

- vim: Allow binding motions in insert mode
2024-07-26 16:33:31 -06:00
Marshall Bowers
bde02a350e
settings_ui: Add line number settings controls (#15310)
This PR adds settings controls for the line numbers and relative line
numbers settings.

Release Notes:

- N/A
2024-07-26 18:31:45 -04:00
Conrad Irwin
c8bc49fa18
vim: Fix count in visual indent (#15296)
Co-Authored-By: tobbe@tlundberg.com

Release Notes:

- vim: Added {count} for `>`/`<` in visual mode
2024-07-26 16:03:41 -06:00
Marshall Bowers
bcd972fbb4
Upgrade dashmap to v6 (#15305)
This PR upgrades `dashmap` to v6.0.1.

Release Notes:

- N/A
2024-07-26 17:58:37 -04:00
Marshall Bowers
e423f03ba6
Upgrade base64 to v0.22 (#15304)
This PR upgrades the `base64` dependency to v0.22.

Supersedes #15300.

Release Notes:

- N/A
2024-07-26 17:40:38 -04:00
Marshall Bowers
03ebbcbef6
live_kit_server: Replace jwt with jsonwebtoken (#15302)
This PR replaces `live_kit_server`'s usage of `jwt` with `jsonwebtoken`.

`jwt` hasn't been updated in 2 years and seems unmaintained.

`jsonwebtoken` has significantly more downloads and appears to be a
healthier crate overall.

Release Notes:

- N/A
2024-07-26 17:20:01 -04:00
Marshall Bowers
27f97ba762
settings_ui: Add font ligature settings controls (#15301)
This PR adds settings controls for changing whether ligatures are
enabled for the UI and buffer fonts.

Release Notes:

- N/A
2024-07-26 17:06:14 -04:00
renovate[bot]
f4bbbe69b4
Update Rust crate waker-fn to v1.2.0 (#15289)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [waker-fn](https://togithub.com/smol-rs/waker-fn) | dependencies |
minor | `1.1.0` -> `1.2.0` |

---

### Release Notes

<details>
<summary>smol-rs/waker-fn (waker-fn)</summary>

###
[`v1.2.0`](https://togithub.com/smol-rs/waker-fn/blob/HEAD/CHANGELOG.md#Version-120)

[Compare
Source](https://togithub.com/smol-rs/waker-fn/compare/v1.1.1...v1.2.0)

-   Add a new `portable-atomic` feature that allows for the usage of the
`portable-atomic` crate to implement `waker-fn`.
([#&#8203;10](https://togithub.com/smol-rs/waker-fn/issues/10))

###
[`v1.1.1`](https://togithub.com/smol-rs/waker-fn/blob/HEAD/CHANGELOG.md#Version-111)

[Compare
Source](https://togithub.com/smol-rs/waker-fn/compare/v1.1.0...v1.1.1)

- Reimplement using 100% safe code.
([#&#8203;7](https://togithub.com/smol-rs/waker-fn/issues/7))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone
America/New_York, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

Release Notes:

- N/A

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzguMCIsInVwZGF0ZWRJblZlciI6IjM3LjQzOC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-07-26 13:05:29 -04:00
Marshall Bowers
c937a2fcdd
ui: Add functions for generating textual representations of key bindings (#15287)
This PR adds some helper functions in the `ui` crate that can be used to
get textural representations of keystrokes or key bindings.

Release Notes:

- N/A
2024-07-26 12:52:59 -04:00
Nate Butler
a5279cc48a
Tool bar: Remove tool grouping for clarity (#15285)
This PR makes the spacing between items in the tool bar (quick action
bar) consistent vs grouped by type. The idea was to add clarity to the
types of tools, but we haven't built this system out enough for these
groupings to be recognizable. So for now, let's make the spacing
consistent.

Before:
![CleanShot 2024-07-26 at 11 58
22@2x](https://github.com/user-attachments/assets/9135fcce-fcf8-4bdf-a71b-6d6c7e5b3f63)


After:

![CleanShot 2024-07-26 at 11 57
02@2x](https://github.com/user-attachments/assets/0aceb981-01b6-466f-8d7e-97b564d014f9)

Release Notes:

- N/A
2024-07-26 12:36:49 -04:00
CharlesChen0823
4d56252bae
linux: Allow skipping "Unsupported GPU" warning (#15271)
I just want using Zed in virtual machine, current implement must read
code and set env `ZED_ALLOW_EMULATED_GPU` then can work.

Release Notes:

- N/A
2024-07-26 10:26:14 -06:00
Thorsten Ball
0360cda543
tasks: Use environment variables from project (#15266)
This fixes #12125 and addresses what's described in here:

-
https://github.com/zed-industries/zed/issues/4977#issuecomment-2162094388

Before the changes in this PR, when running tasks, they inherited the
Zed process environment, but that might not be the process environment
that you'd get if you `cd` into a project directory.

We already ran into that problem with language servers and we fixed it
by loading the shell environment in the context of a projects root
directory and then passing that to the language servers when starting
them (or when looking for their binaries).

What the change here does is to add the behavior for tasks too: we use
the project-environment as the base environment with which to spawn
tasks. Everything else still works the same, except that the base env is
different.

Release Notes:

- Improved the environment-variable detection when running tasks so that
tasks can now access environment variables as if the task had been
spawned in a terminal that `cd`ed into a project directory. That means
environment variables set by `direnv`/`asdf`/`mise` and other tools are
now picked up.
([#12125](https://github.com/zed-industries/zed/issues/12125)).

Demo:


https://github.com/user-attachments/assets/8bfcc98f-0f9b-4439-b0d9-298aef1a3efe
2024-07-26 18:19:53 +02:00
Danilo Leal
5e04753d1c
Add note about used context in the model selector (#15235)
When pressing <kbd>control</kbd> + <kbd>enter</kbd>, the AI-powered
inline transformation input displays an icon button and a token count,
which should show roughly the same numbers you'd see on your assistant
panel. At a first glance, though, the token count not being zero can be
confusing, where you'd wonder where that's coming from. That's because
the inline input uses whatever piece of context and/or information of
the currently selected assistant tab to suggest more accurate edits.

So, this PR introduces an informative piece of text to the
`ModelSelector` menu, on the inline transformation input, which delivers
exactly this bit of info, aimed at clarifying the connection between
these two methods of interacting with LLMs.

I've also took the opportunity to change the icon button's icon to one
that's a bit easier to see, still representing the affordance of "click
to configure something".

Release Notes:

- Add note about how inline edits consume context from the assistant
panel to clarify interaction with LLMs.

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-07-26 12:48:06 -03:00
Nate Butler
05825e9804
Add Markdown Preview Toggle (#15215)
Add a "Preview Markdown" button to the quick action bar when in a
markdown editor.

While it isn't my favorite, I went with the basic eye icon to be a bit
more generic so we can extend this control to allow opening other
previews such as SVGs like @jansol mentioned.

![CleanShot 2024-07-26 at 11 02
16@2x](https://github.com/user-attachments/assets/415963ce-d19e-432d-b8c2-37e7c6e52683)


https://github.com/user-attachments/assets/5980272c-eab9-4f69-86b6-0c593c25b525

---

Release Notes:

- Added a button to preview Markdown files in the toolbar.
`Option|Alt+Click` will open the preview to the side.
2024-07-26 11:08:42 -04:00
Antonio Scandurra
e59e47fe7f
Revert "Avoid buffering line content to compute indent guides" (#15282)
Reverts zed-industries/zed#15167

Release Notes:

- N/A
2024-07-26 11:05:24 -04:00
Marshall Bowers
4abf7f058e
Upgrade env_logger to v0.11 (#15278)
This PR upgrades `env_logger` to v0.11.

There were some breaking changes in the style API. I followed the
[migration
guide](73bb418802/CHANGELOG.md (migration-guide))
to update the usage.

Visually there shouldn't be any changes:

### Before

<img width="1068" alt="Screenshot 2024-07-26 at 10 20 07 AM"
src="https://github.com/user-attachments/assets/9abdbba2-5a34-46df-a62b-3d6c2d9d1137">

### After

<img width="1061" alt="Screenshot 2024-07-26 at 10 37 35 AM"
src="https://github.com/user-attachments/assets/c81bc3cc-1738-43f7-ba19-4c4be058427f">

Release Notes:

- N/A
2024-07-26 10:48:07 -04:00
Kirill Bulatov
243fb3562c
Auto fold directories in the project panel by default (#15273) 2024-07-26 15:26:20 +03:00
Kirill Bulatov
e830865eb1
Return an empty measurement instead of panicking (#15269)
Follow-up of https://github.com/zed-industries/zed/pull/15256

Returns zero size for no items to render.

Incorrect worktree state made the uniform list to have 0 items to
render, so
```Rust
let mut items = (self.render_items)(item_ix..item_ix + 1, cx);
let mut item_to_measure = items.pop().unwrap();
```
panicked as the first line returned an empty array despite a
single-element range provided.


Release Notes:

- N/A
2024-07-26 14:21:09 +03:00
CharlesChen0823
7aa6f4788d
regression: Fix a panic when removing git-containing worktree from the project panel (#15256)
Follow-up of #14989

Opening a project with git metadata and clicking "Remove from Project" will panic:
![image](https://github.com/user-attachments/assets/ba00dc55-d299-4edc-9a1f-01e92f0dd9ca)

Release Notes:

- N/A
2024-07-26 14:20:59 +03:00
Thorsten Ball
18daf17d0e
refactoring: Use helper instead of adjusting selection manually (#15262)
I added `newest_adjusted` recently and now just bumped into the old code
that didn't use it.

Release Notes:

- N/A
2024-07-26 11:12:33 +02:00
Joseph T. Lyons
856d9632e4
Add repl events (#15259)
Release Notes:

- N/A

---------

Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2024-07-26 03:31:41 -04:00
Marshall Bowers
745d2e4d3b
collab: Extract contributor endpoints to their own module (#15251)
This PR extracts the contributor endpoints to their own module for
organizational purposes.

Release Notes:

- N/A
2024-07-25 23:02:32 -04:00
Marshall Bowers
50dbab0747
collab: Add renovate[bot] to the GET /contributor endpoint (#15250)
This PR adds the `renovate[bot]` user to the `GET /contributor` endpoint
so that it passes the CLA check.

I patched this temporarily by adding a case into the `zed.dev` endpoint
the fronts this one, but I think long-term it will be better for collab
to be the source of truth.

Release Notes:

- N/A
2024-07-25 22:52:59 -04:00
Marshall Bowers
05003ed4c5
Hoist strum to workspace level (#15243)
This PR hoists `strum` up to a workspace dependency.

Release Notes:

- N/A
2024-07-25 21:30:48 -04:00
Marshall Bowers
479ffbbd51
ui: Make Label respect the ui_font_weight setting (#15241)
This PR makes the `Label` component respect the `ui_font_weight`
setting, by default.

An explicit font weight can still be set via the `weight` method, which
will override the `ui_font_weight` for that `Label`.

<img width="1566" alt="Screenshot 2024-07-25 at 8 55 16 PM"
src="https://github.com/user-attachments/assets/2751e29c-c76e-4685-8564-604b3b77f603">

Release Notes:

- Updated UI labels to respect the `ui_font_weight` setting
([#15234](https://github.com/zed-industries/zed/issues/15234)).
2024-07-25 21:08:28 -04:00
Marshall Bowers
95d82f88de
ui: Make custom rows in ContextMenus use a normal cursor (#15239)
This PR makes custom rows in `ContextMenu`s use a regular cursor instead
of a pointer.

Even though custom rows were marked as not selectable, we would still
pass a click handler to them, causing the `ListItem` to show a pointer
cursor.

Release Notes:

- N/A
2024-07-25 20:16:53 -04:00
Marshall Bowers
02c43a5bf2
Add missing workspace lints (#15237)
This PR adds the missing workspace lint configuration for the following
crates that were missing it:

- `google_ai`
- `open_ai`
- `tab_switcher`

Release Notes:

- N/A
2024-07-25 19:52:24 -04:00
Piotr Osiewicz
ec5886a078
rust: Add static items to the outline (#15225)
Fixes #15208
Release Notes:

- Outline panel for Rust files now includes static items.
2024-07-26 00:52:42 +02:00
Kirill Bulatov
10c9e337cf
Fix more gutter close button alignment issues (#15233)
Follow-up of https://github.com/zed-industries/zed/pull/15178

* shows proper cursor on hovering a block that's over a git hunk
* show gutter buttons better when git hunks are on the same line
* show deleted hunks' gutter buttons better when git blame info is shown
in the gutter

Release Notes:

- N/A
2024-07-26 01:42:25 +03:00
Marshall Bowers
1da6a12bb4
Upgrade scrypt to v0.11 (#15228)
This PR upgrades `scrypt` to v0.11.

There were some API changes that impacted our usage just in the tests.

Supersedes #15224.

Release Notes:

- N/A
2024-07-25 17:45:24 -04:00
Piotr Osiewicz
0d5de88c4b
chore: Bump Rust version to 1.80 (#15186)
Release Notes:

- N/A
2024-07-25 22:48:42 +02:00
Marshall Bowers
9d736fe80c
Upgrade async-tungstenite to v17 and update usage accordingly (#15219)
This PR upgrades `async-tungstenite` to v17.0.3.

We previously attempted upgrading `async-tungstenite` in #15039, but
broke authentication with collab in the process.

Upon further investigation, I determined that the root cause is due to
this change in `tungstenite` v0.17.0:

> Overhaul of the client's request generation process. Now the users are
able to pass the constructed `http::Request` "as is" to
`tungstenite-rs`, letting the library to check the correctness of the
request and specifying their own headers (including its own key if
necessary). No changes for those ones who used the client in a normal
way by connecting using a URL/URI (most common use-case).

We _were_ relying on passing an `http::Request` directly to
`tungstenite`, meaning we did not benefit from the changes to the common
path (of passing a URL/URI).

This meant that—due to changes in `tungstenite`—we were now missing the
`Sec-WebSocket-Key` header that `tungstenite` would otherwise set for
us.

Since we were only passing a custom `http::Request` to set headers, our
approach has been adjusted to construct the initial WebSocket request
using `tungstenite`'s `IntoClientRequest::into_client_request` and then
modifying the request to set our additional desired headers.

Release Notes:

- N/A
2024-07-25 15:53:22 -04:00
张小白
f3ad754396
linux: Fix wrong names reported by all_font_names (#14865)
The names suggested by `buffer_font_family` are reported by
`all_font_names`. Therefore, `all_font_names` should report family names
rather than postscript names.

close #14854 

Release Notes:

- N/A
2024-07-25 11:53:22 -07:00
Piotr Osiewicz
86456ce379
chore: Fix clippy violations from Cargo.toml (#15216)
/cc @maxdeviant 
Release Notes:

- N/A
2024-07-25 20:22:01 +02:00
Marshall Bowers
d755d29577
extension: Upgrade wasmtime to v21 (#15210)
This PR upgrades the version of `wasmtime` and `wasmtime-wasi` in use to
v21.0.1.

We have to skip v20 because Tree-sitter also skipped it.

Here are the changes that had to be made:

### v19 -> v20

After upgrading the `wasmtime` packages to v20, I also had to run `cargo
update -p mach2` to pull in
[v0.4.2](https://github.com/JohnTitor/mach2/releases/tag/0.4.2) to fix
some compile errors.

There were a few minor API changes in `wasmtime-wasi` from
https://github.com/bytecodealliance/wasmtime/pull/8228 that we needed to
account for.

### v20 -> v21

Since there isn't a Tree-sitter version that depends on `wasmtime@v20`,
we're jumping straight to v21.

The published version of Tree-sitter (v0.22.6) still depends on
`wasmtime@v19`, but there was a commit
(7f4a57817d)
later that month that upgrades the `wasmtime` dependency to v21.

We're patching Tree-sitter to that commit so we can get the new
`wasmtime` version.

The main change in v21 is that imports generated by `bindgen!` are no
longer automatically trapped
(https://github.com/bytecodealliance/wasmtime/pull/8310), so we need to
add `trappable_imports: true` to our `bindgen!` calls.

Release Notes:

- N/A
2024-07-25 13:56:40 -04:00
Nathaniel
ab3c9f0678
windows: Allow horizontal scroll with shift + scroll (#14147)
Release Notes:

- Horizontally scroll when holding down the Shift key and using the
scroll wheel


https://github.com/zed-industries/zed/assets/95680272/e6480f9c-0f6a-4f47-b700-a3657a75716f
2024-07-25 10:44:35 -07:00
张小白
201db23b58
windows: Fix titlebar rendering on Windows 10 (#14656)
As we discussed in #14190, we agreed to open a new PR.

Release Notes:

- N/A
2024-07-25 10:43:25 -07:00
张小白
beb8fbdf7f
windows: Remove unnecessary Send and Sync implementations (#14659)
After a update to `windows-rs 0.57`, these two implementations are no
longer needed.

Release Notes:

- N/A
2024-07-25 10:42:36 -07:00
张小白
d2501e8886
windows: Bump windows-rs version (#14719)
Release Notes:

- N/A
2024-07-25 10:41:59 -07:00
张小白
82d6ad4616
Make CosmicTextSystem Linux-only (#14728)
Since `WindowsDispatcher` requires a minimum Windows version of Windows
10 Fall Creators Update (10.0.16299), and the `alacritty_terminal`
dependency relies on conPTY, an API introduced in the same version,
additionally, `DirectWriteTextSystem` also relies on Windows 10 Fall
Creators Update (10.0.16299), so it seems reasonable to make
`CosmicTextSystem` Linux-only. And we can use `DirectWriteTextSystem` on
the Windows platform exclusively. I hope this approach makes sense.

Release Notes:

- N/A
2024-07-25 10:40:49 -07:00
张小白
a60b3b9389
windows: Stop beeping (#14872)
Close #14857 

Release Notes:

- N/A
2024-07-25 10:26:36 -07:00
Fernando Tagawa
06863144c6
x11: Add keyboard layout hot plugging (#15059)
Now it is possible to change keyboard layouts with `setxkbmap` without
having to restart zed.
 
Release Notes:

- x11: Support for keyboard layout hot plugging.
2024-07-25 10:25:34 -07:00
Harsh Narayan Jha
b7c6f3e98e
linux: Update TryExec value in desktop file (#15149)
Release Notes:

- Fixed ([#15148](https://github.com/zed-industries/zed/issues/15148)).
2024-07-25 10:16:23 -06:00
Thorsten Ball
7146087b44
zed: Mark restored buffers as conflicted if file changed on disk between store & restore (#15207)
Previously, we've only marked restored buffers as dirty. This PR changes
that behavior in case the buffer has been associated with a file and
that file has changed on disk since the last time Zed stored its
contents.

Example timeline:

1. User edits file in Zed, buffer is dirty
2. User quites Zed with `cmd-q`
3. User changes file on disk: `echo foobar >> file.txt` or `git checkout
file.txt`
4. User starts Zed
5. File/buffer are now marked as having a conflict (yellow icon)

Release Notes:

- Unsaved files that are restored when Zed starts are now marked as
having a conflict if they have been changed on disk since the last time
they were stored.

Demo:



https://github.com/user-attachments/assets/6098b485-b325-49b7-b694-fd2fc60cce64
2024-07-25 18:04:47 +02:00
Conrad Irwin
847bd35bd9
vim remap 2 (#15193)
Release Notes:

- N/A
2024-07-25 09:00:53 -06:00
Peter Tripp
6998c03c59
Document git permalinks (GitHub, Gitlab, Bitbucket, SourceHut, Codeberg, etc) (#15113)
- Docs: Added "Copy Permalink to Line" and "Open Permalink to Line"
2024-07-25 09:39:57 -04:00
Antonio Scandurra
8631180e43
Avoid buffering line content to compute indent guides (#15167)
Release Notes:

- Improved performance when computing indent guides for buffers with
extremely long lines.

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Bennet <bennet@zed.dev>
Co-authored-by: Thorsten <thorsten@zed.dev>
2024-07-25 15:21:50 +02:00
Kirill Bulatov
856a8ef5e8
Layout gutter hunk diff close button (X) better (#15178)
Closes https://github.com/zed-industries/zed/issues/15164

* Deleted hunk
Before:

![before_top](https://github.com/user-attachments/assets/27c72ee5-719f-4787-b222-4f597840936a)

After:

![after_top](https://github.com/user-attachments/assets/58095b21-698d-4778-8412-b680d5253e2c)

* Modified hunk
Before:

![before_down](https://github.com/user-attachments/assets/3fffb73b-7101-493c-b63b-15c3ccaf5362)

After:

![after_down](https://github.com/user-attachments/assets/f07a05ed-1260-4e2a-9388-c9cb93020d78)

* Added hunk
Before:

![before_mid](https://github.com/user-attachments/assets/0dd3f0f9-51e8-449a-bdd7-4c3ba5cd7791)

After:

![after_mid](https://github.com/user-attachments/assets/92f749bd-2d95-4650-8334-1d5c38c6aeb6)

Release Notes:

- N/A
2024-07-25 15:50:57 +03:00
Thorsten Ball
e2113e4895
repl: Add ability to evaluate Markdown code blocks (#15100)
This adds the ability to evaluate TypeScript and Python code blocks in
Markdown files.

cc @rgbkrk 

Demo:


https://github.com/user-attachments/assets/55352de5-68f3-4aef-920a-78ca205651ba



Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Antonio <antonio@zed.dev>
2024-07-25 12:11:19 +02:00
Max Brunsfeld
b14bb6bda4
Make git blame for SSH remote projects (#15106)
This also refactors the BufferStore + WorktreeStore interfaces to make
them cleaner, more fully encapsulating the RPC aspects of their
functionality.

Release Notes:

- N/A
2024-07-24 15:50:29 -07:00
Marshall Bowers
8501ae6a19
Make context and dropdown menus scrollable (#15127)
This PR makes context and dropdown menus scrollable, so that they don't
become totally unusable when they overflow the window.

Release Notes:

- N/A
2024-07-24 18:43:01 -04:00
Marshall Bowers
659f34bf21
settings_ui: Add UI and buffer font family controls (#15124)
This PR adds settings controls for changing the UI and buffer font
families.

Release Notes:

- N/A
2024-07-24 18:01:35 -04:00
Fernando Tagawa
001376fd6d
cpp: Improve syntax highlighting (#13922)
* Added some missing operators, delimeters and keywords
* Highlight destructor, and operator overload as `@function`
* Moved `(field_identifier)` to the top, as it was highlighting methods
as `@property`

There are still some problems with something like `n1::n2::foo(...)`,
`foo` is not properly highlighted as a function

Release Notes:

- Improved C++ syntax highlighting
2024-07-25 00:55:21 +03:00
Marshall Bowers
298ca5ff1b
Prefer .map for conditionals with else conditions (#15118)
This PR updates instances where we were using `.when_else` and
`.when_else_some` to use `.map` with a conditional inside.

This allows us to avoid reinventing Rust's syntax for conditionals and
(IMO) makes the code easier to read.

Release Notes:

- N/A
2024-07-24 17:09:07 -04:00
Kirill Bulatov
596ee58be8
Bump tree-sitter and related core language parser libraries (#14986)
Closes https://github.com/zed-industries/zed/issues/4565

To fix issues with code blocks' parsing in Markdown, a
tree-sitter-markdown library update is needed.
But `tree_sitter::language` is used in many places within core Zed,
which forced more library updates.

Release Notes:

- Updated tree-sitter parsers for core languages

---------

Co-authored-by: Max Brunsfeld <max@zed.dev>
Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
2024-07-24 23:38:21 +03:00
Kirill Bulatov
fd4a4127eb
Use proper names for sorting path entries (#15116)
Closes https://github.com/zed-industries/zed/issues/12470

Release Notes:

- Fixed project panel not showing properly file entries for directories
with dots in their names
([#12470](https://github.com/zed-industries/zed/issues/12470))
2024-07-24 23:36:13 +03:00
Marshall Bowers
0297a42735
Use US English spelling of "behavior" and "customize" (#15117)
This PR fixes some instances that weren't using US English spellings of
"behavior" and "customize".

Release Notes:

- N/A
2024-07-24 16:36:01 -04:00
Vitaly Slobodin
9c9a0bd24f
lsp: Check if "Goto Definition" supported before request (#15111)
This is related to #15023 where we have the running Rubocop LSP that
provides diagnostics and formatting capabilities. Rubocop LSP sends its
capabilities
back to Zed without support for "textDocument/definition" request, Zed
actually does not check that and sends a request to Rubocop that results
in the server error "Unsupported method: textDocument/definition".

The fix here is related to
https://github.com/zed-industries/zed/pull/14666

Release Notes:

- N/A
2024-07-24 23:28:23 +03:00
Marshall Bowers
740c444089
settings_ui: Add theme settings controls (#15115)
This PR adds settings controls for the theme settings.

Release Notes:

- N/A
2024-07-24 16:25:52 -04:00
Piotr Osiewicz
325e6b9fef
editor: Improve performance of buffer/project search (#15109)
Fixes #15102
Release Notes:

- Improved performance of project and buffer search when there are many
matches.
2024-07-24 21:04:07 +02:00
Danilo Leal
65c63defcc
Ensure quick action bar icon buttons are a square (#15092)
As the title says! Also decreased a bit the gap between them so that's
consistent with other similar icon button stacks. I wish they could be
bigger buttons but the icons would need to be refined further for that,
as each has been drawn with a different dimension/bounding-box. Maybe in
the near future :)

---

Release Notes:

- N/A
2024-07-24 15:40:55 -03:00
Marshall Bowers
274e56b086
settings_ui: Add UI and buffer font weight controls (#15104)
This PR adds settings controls for the UI and buffer font weight
settings.

It also does some work around grouping the settings into related
sections.

Release Notes:

- N/A
2024-07-24 14:09:13 -04:00
Tom Anderson
7fb906d774
vim: Prevent overflowing integer when pushing count digit (#15079)
Minor bug where the command count overflows when enough digits are
entered. This swaps out simple multiplication/addition for their checked
counter parts, falling back to the previous value in case of overflow.

Release Notes:

- N/A
2024-07-24 11:54:59 -06:00
Joseph T Lyons
77a2f2490e v0.147.x dev 2024-07-24 12:08:26 -04:00
Kyle Kelley
846fc67519
repl: Show executing status at the bottom of the outputs while waiting for execution to finish (#15096)
![image](https://github.com/user-attachments/assets/3b43f9d9-6456-42e2-a76a-43887d63309e)

Release Notes:

- N/A
2024-07-24 09:04:41 -07:00
Kyle Kelley
0843da0f81
repl: Incorporate moving down to next cell in jupytext mode (#15094)
`jupytext_snippets` now returns back both the jupytext snippets and the
`Point` of the next jupytext snippet.

Release Notes:

- N/A
2024-07-24 08:53:10 -07:00
Kyle Kelley
9e528dbb16
repl: Simplify error output formatting (#15088)
Release Notes:

- N/A
2024-07-24 08:38:04 -07:00
Marshall Bowers
9de6d318e9
feature_flags: Add support for flags that aren't auto-enabled for staff (#15093)
This PR adds support for defining feature flags that aren't auto-enabled
for Zed staff.

This will be useful in situations where we want to land a feature behind
a feature flag, but only want to ship it to certain staff members (e.g.,
the members currently working on it) initially.

Release Notes:

- N/A
2024-07-24 11:23:50 -04:00
Marshall Bowers
d540c95c81
settings_ui: Add prototype for settings controls (#15090)
This PR adds a prototype for controlling settings via the settings UI.

Still staff-shipped.

Release Notes:

- N/A
2024-07-24 10:36:27 -04:00
Stanislav Alekseev
06d3dc010c
Fix rendering issue with vtsls (#15087)
Before:
<img width="697" alt="Screenshot_2024-07-20_at_20 47 41"
src="https://github.com/user-attachments/assets/bc6db18e-77b9-400b-a917-2545269b7d1b">
After:
<img width="707" alt="Screenshot_2024-07-23_at_22 09 27"
src="https://github.com/user-attachments/assets/a0f6ebe5-fba0-4cc1-8d8b-b1982e2adf95">

Release Notes:

- Fixed multiline details provided by vtsls breaking rendering in
autocompletions
2024-07-24 17:30:44 +03:00
Kirill Bulatov
64b15d3a0e
Display blocks over the git hunks (#15083)
Before:

![before](https://github.com/user-attachments/assets/614bbafd-f344-4c86-bd62-fff5f1ab143a)

After:

![after](https://github.com/user-attachments/assets/40a72a46-9fc4-4f94-9090-fb389f824a8d)


Release Notes:

- N/A
2024-07-24 07:23:20 -07:00
Piotr Osiewicz
23c5fc1b03
chore: Use explicit if let instead of for .. in option (#15086)
Fixes one clippy violation from 1.80 (that's due for release tomorrow).

Release Notes:

- N/A
2024-07-24 16:19:29 +02:00
Kirill Bulatov
c43eafbf9a
Update the test code to newer realities (#15084)
Follow-up of https://github.com/zed-industries/zed/pull/14886

We do not require the branch to be up-to-date with `main` before
merging, and in 4 days some related test code got reworked so that there
were no conflicts and it slipped.

Release Notes:

- N/A
2024-07-24 16:51:18 +03:00
Danilo Leal
62a890fb7f
Increase size of icon buttons within the inline editor (#15051)
This PR increases the size of the the icon buttons within the inline
editors, both within the buffer and on the terminal. I also added
properties to make sure they always render as a square, as well as
tweaking the stop icon SVG, adding an alternative sparkle icon that fit
the same grid as the close (14x14) icon, and adding a bit more right
padding on the buffer's case so it doesn't collide with the scrollbar.
End result is that they have a bit of an easier target space area and
normalized sizes.

---

Release Notes:

- N/A
2024-07-24 10:39:05 -03:00
Artur Rodrigues
5ad3c6b6dc
inline_assistant: Respect tabs when selection first row is not indented (#14886)
When using the inline assistant with a language such as Go that uses
tabs, if the user selects a block of text that is correctly formatted
and where the first line has no indentation, the `suggested_line_indent`
variable ends up with `IndentSize { len: 0, kind: Space }`. That's
because `suggested_line_indent` current relies on
`BufferSnapshot::suggested_indents` suggestion for the first line on the
selection, but since it is already correctly indented, there are no
suggestions and `MultiBufferSnapshot::indent_size_for_line` is used
instead.


2d96bba61f/crates/assistant/src/inline_assistant.rs (L2124-L2128)

In this patch, we also take a look at the rest of the selection and
detect tabs. If one is encountered, we assume that tabs should always be
used. I suppose this isn't perfect, especially if the original file had
a mix of spaces and tabs, however it seems better than the status quo.

I considered using `BufferSnapshot::language_indent_size_at`, but I
imagine tabs should be preserved even when a specific language isn't
being used.

See screenshot below of the original prompt with this patch.

Tests:

* New unit test
* I've also manually tested with a few other cases: selection where all
lines are indented and file that only use spaces.

Release Notes:

- Fixed 'inline_assistant: tabs are overwritten with space characters
when first line in selection has no indentation'
([#14885](https://github.com/zed-industries/zed/issues/14885)).

<img width="942" alt="image"
src="https://github.com/user-attachments/assets/f2c5d7e9-e8bc-400b-bd6f-09e4a89d22c1">
2024-07-24 16:31:16 +03:00
Kirill Bulatov
babf8923ee
Do not show signature help when editor is not focused (#15080)
Show the help again, if it was not dismissed and the editor regains
focus.

Release Notes:

- N/A
2024-07-24 14:37:35 +03:00
Danilo Leal
912b396e58
Adjust model selector popover design (#15056)
This PR mostly refines the model selector popover design by formatting
the models names' and adjusting spacing/alignment in the list-related
items. The list component changes could've been made in a separate PR
but it was also very practical to do it here as I was already
in-context. Either way, I'm happy to separate if that's better!

One thing I couldn't necessarily figure out, though, is why the order
changed (e.g., Anthropic at last ). I wonder if that was because of the
separator logic somehow? I'd love guidance here—new to Rust!

| Before | After |
|--------|--------|
| <img width="228" alt="Screenshot 2024-07-23 at 21 02 33"
src="https://github.com/user-attachments/assets/3372c6c9-08dc-4d71-9265-26f015e2dbc2">
| <img width="228" alt="Screenshot 2024-07-23 at 21 01 45"
src="https://github.com/user-attachments/assets/624cc7db-a3d9-48e3-99d7-c29829501130">
|

---

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2024-07-24 12:24:54 +02:00
Nathan Sobo
87d93033d1
Support Jupytext-style line comments for REPL evaluation ranges (#15073)
This adds support for detecting line comments in the
[Jupytext](https://jupytext.readthedocs.io/) format. When line comments
such as `# %%` is present, invoking `repl: run` will evaluate the code
between these line comments as a unit.

/cc @rgbkrk 

```py
# %%
# This is my first block
print(1)
print(2)

# %%
# This is my second block
print(3)
```

Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Thorsten <thorsten@zed.dev>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-07-24 11:53:58 +02:00
Bennet Bo Fenner
af4b9805c9
assistant: Fix issues when configuring different providers (#15072)
Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
2024-07-24 11:21:31 +02:00
Thorsten Ball
ba6c36f370
repl: Fix repl-over-selection not being Vim-line-wise aware (#15068)
Release Notes:

- N/A
2024-07-24 10:06:38 +02:00
Conrad Irwin
b4a8f14a76
linux: Detect shift better (#15013)
Release Notes:

- linux: Fixed typing shortcuts like ctrl-/ on some systems
2024-07-23 21:05:11 -06:00
Marshall Bowers
c84da37030
rpc: Add support for OAEP-based encryption format (#15058)
This PR adds support for a new encryption format for exchanging access
tokens during the authentication flow.

The new format uses Optimal Asymmetric Encryption Padding (OAEP) instead
of PKCS#1 v1.5, which is known to be vulnerable to side-channel attacks.

**Note: We are not yet encrypting access tokens using the new format, as
this is a breaking change between the client and the server. This PR
only adds support for it, and makes it so the client and server can
decrypt either format moving forward.**

This required bumping the RSA key size from 1024 bits to 2048 bits. This
is necessary to be able to encode the access token into the ciphertext
when using OAEP.

This also follows OWASP recommendations:

> If ECC is not available and RSA must be used, then ensure that the key
is at least 2048 bits.
>
> —
[source](https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html#algorithms)

Release Notes:

- N/A
2024-07-23 21:25:25 -04:00
Marshall Bowers
edf7f6defe
Upgrade rsa to v0.9.6 (#15055)
This PR upgrades the `rsa` crate to v0.9.6.

The version we were using was rather old, and for something
security-sensitive we should be using a recent version.

No behavioral changes have been made, just updates to account for
changes in the crate's API.

Release Notes:

- N/A
2024-07-23 20:11:48 -04:00
Marshall Bowers
1307a80e07
rpc: Add regression tests for encoding/decoding public keys (#15054)
This PR adds some tests to ensure we don't regress in our public key
encoding/decoding capabilities when making changes in this area.

Release Notes:

- N/A
2024-07-23 19:58:47 -04:00
Kyle Kelley
9d11a6ff78
repl: Detect Conda and Python environments with their own kernel specs (#15047)
Detect kernels in conda and python environments.

Release Notes:

- N/A
2024-07-23 15:23:24 -07:00
Marshall Bowers
6769e55ce0
Revert "chore: Bump async-tungstenite to 0.23 (and tungstenite to 0.20.1) (#15039)" (#15048)
This reverts commit 4d65f7eea3.

Reverting because it causes auth with collab to break.

Release Notes:

- N/A
2024-07-23 18:22:37 -04:00
Mikayla Maki
855048041d
Update http crate name (#15041)
Release Notes:

- N/A
2024-07-23 15:01:05 -07:00
Marshall Bowers
d36ebc8c74
Add global Fs instance (#15044)
This PR adds a global `Fs` instance to the app context.

This will make it easier to access the filesystem in some cases instead
of having to thread it around.

Release Notes:

- N/A
2024-07-23 17:59:55 -04:00
Kyle Kelley
5062bf0b4d
repl: Pad the table rows with a fraction of the line height (#15042)
Compute the final height using the number of rows and the constant
fraction.

Ensures we don't accidentally overlap lines below table output.

<img width="663" alt="image"
src="https://github.com/user-attachments/assets/fe24b08d-2271-4dcc-88c7-8702ba4c68b0">


Release Notes:

- N/A
2024-07-23 14:42:58 -07:00
Piotr Osiewicz
4d65f7eea3
chore: Bump async-tungstenite to 0.23 (and tungstenite to 0.20.1) (#15039)
Release Notes:

- N/A
2024-07-23 23:18:00 +02:00
Conrad Irwin
7ae305ac0d
Make vim::test_remap less flaky on linux (#15040)
Release Notes:

- N/A
2024-07-23 15:16:45 -06:00
Piotr Osiewicz
ba4ff1df59
chore: Remove clap3 dependency by disabling default features of cbindgen (#15037)
cbindgen pulled that in, but we don't really need it (Plus it pulls in a
dep with an advisory)

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-07-23 22:49:49 +02:00
Max Brunsfeld
5f7881fc1e
Improve ssh remote error handling and logging (#15035)
Release Notes:

- N/A
2024-07-23 13:29:56 -07:00
Conrad Irwin
b0c525af5f
inotify alert (#15027)
Release Notes:

- linux: Show an error and troubleshooting steps for inotify limits
(#10310)
2024-07-23 14:21:56 -06:00
Conrad Irwin
41a3e78b1e
Don't try to connect to X11/Wayland when headless (#15028)
Release Notes:

- remote development: Stopped logging every 16ms when connected to a
remote server with a badly configured X server.
2024-07-23 14:11:47 -06:00
Stanislav Alekseev
5021397c01
Fix diagnostic popups flickering when moving cursor in the boundaries of the symbol (#14870)
This PR just uses ranges returned by an LSP to work, the subsequent PR
would focus on trying to fall back onto tree-sitter in case of info
hovers. I'm also unsure if I'm supposed to use `local_diagnostic` or
`primary_diagnostic` when both are available
Release Notes:

- Fix diagnostic popups flickering when moving cursor in the boundaries
of the symbol

Before:


https://github.com/user-attachments/assets/4905a7e5-c333-453b-b204-264b3ef79586

After:


https://github.com/user-attachments/assets/c742c424-fb20-450d-8848-baaf1937dd47
2024-07-23 14:10:19 -06:00
Kirill Bulatov
b2b9d4ccb6
Extend task templates with shell and hide fields to use custom shells and custom close behavior (#15031) 2024-07-23 22:58:36 +03:00
Piotr Osiewicz
fa76d8edcf
chore: Bump dependencies (#15029)
Release Notes:


- N/A
2024-07-23 21:38:47 +02:00
Marshall Bowers
5f8e799d60
repl: Fix a small typo in a variable name (#15030)
This PR fixes a small typo in a variable name.

Release Notes:

- N/A
2024-07-23 15:09:40 -04:00
Max Brunsfeld
38e3182bef
Handle buffer diff base updates and file renames properly for SSH projects (#14989)
Release Notes:

- N/A

---------

Co-authored-by: Conrad <conrad@zed.dev>
2024-07-23 11:32:37 -07:00
Piotr Osiewicz
3d1bf09299
Allow user to use multiple formatters (#14846)
Fixes #4822
- [x] Release note
- [ ] Surface formatting errors via a toast
- [x] Doc updates
- [x] Have "language-server" accept an optional name of the server.

Release Notes:

- `format` and `format_on_save` now accept an array of formatting
actions to run.
- `language_server` formatter option now accepts the name of a language
server to use (e.g. `{"language_server": {"name: "ruff"}}`); when not
specified, a primary language server is used.

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-07-23 20:05:09 +02:00
Kyle Kelley
53b711c2b4
repl: Make the terminal background transparent (#15022)
Keeps the background the same as the output area background by making
the terminal background be `Hsla::transparent_black()`.

Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2024-07-23 11:03:22 -07:00
Bennet Bo Fenner
d0f52e90e6
assistant: Overhaul provider infrastructure (#14929)
<img width="624" alt="image"
src="https://github.com/user-attachments/assets/f492b0bd-14c3-49e2-b2ff-dc78e52b0815">

- [x] Correctly set custom model token count
- [x] How to count tokens for Gemini models?
- [x] Feature flag zed.dev provider
- [x] Figure out how to configure custom models
- [ ] Update docs

Release Notes:

- Added support for quickly switching between multiple language model
providers in the assistant panel

---------

Co-authored-by: Antonio <antonio@zed.dev>
2024-07-23 19:48:41 +02:00
Thorsten Ball
17ef9a367f
zed: Add ability to restore last session w/ multiple windows (#14965)
This adds the ability for Zed to restore multiple windows after
restarting. It's now the default behavior.

Release Notes:

- Added ability to restore all windows that were open when Zed was quit.
Previously only the last used workspace was restored. This is now the
default behavior. To get back the old behavior, add the following to
your settings: `{"restore_on_startup": "last_workspace"}` (Part of
[#4985](https://github.com/zed-industries/zed/issues/4985) and
[#4683](https://github.com/zed-industries/zed/issues/4683))

Demo:



https://github.com/user-attachments/assets/57a375ec-0c6a-4724-97c4-3fea8f18bc2d

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-23 19:44:02 +02:00
Antonio Scandurra
53f828df7d
Avoid inserting extra newlines when evaluating code (#15018)
When the evaluation range ends at the start of a line, back it up to the
end of the previous line. This avoids inserting extra newlines below the
evaluation range when they already exist.

Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-23 19:03:15 +02:00
Marshall Bowers
7d0386eff9
settings_ui: Add placeholder view (#15019)
This PR adds a placeholder view for the settings UI. It does not contain
any functionality, as of yet.

This view is staff-shipped behind a feature flag.

Release Notes:

- N/A
2024-07-23 12:50:11 -04:00
Conrad Irwin
bdf1d4edea
linux: Better GPU debugging (#14706)
Release Notes:

- linux: Added GPU information to `editor: Copy System Specs to
Clipboard`
- linux: Show a prominant warning before running under llvmpipe and
similar.
2024-07-23 09:56:45 -06:00
Marshall Bowers
c262c81e52
repl: Filter commands out of command palette when REPL is disabled (#15016)
This PR makes it so the `repl: ` commands don't appear in the command
palette when the REPL feature is disabled.

Release Notes:

- N/A
2024-07-23 11:49:56 -04:00
Kirill Bulatov
a5cb66f0e1
Allow to regenerate a summary of the assistant context (#14964)
Both manual and LLM-through ways are supported:


https://github.com/user-attachments/assets/afb0d2b3-9a9b-4f78-a909-1e663e686323


Release Notes:

- Improved assistant panel summarization usability
2024-07-23 17:51:49 +03:00
Antonio Scandurra
728650f94a
Fix interaction with Anthropic models when using it via zed.dev (#15009)
Release Notes:

- N/A

---------

Co-authored-by: Bennet <bennet@zed.dev>
2024-07-23 15:47:38 +02:00
Antonio Scandurra
dde9d37cf9
Remove completion dependency from collab (#15006)
This was causing CI to fail when trying to deploy collab.

Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
2024-07-23 11:44:07 +02:00
Benjamin Westphal
1fae99a7c4
vim: Add motion support for toggle comments (#14919)
### Summary

This PR adds support for count and object motions to the toggle comments
action in Vim mode. The relevant issue is
[#14337](https://github.com/zed-industries/zed/issues/14337).

For example, `2 g c j` will toggle comments three lines downward. `g c g
g` will toggle comments from the current cursor position up to the start
of the file.

Notably missing from this PR are `g c b` (toggle comments for the
current block) as well as `g c p` (toggle comments for the current
paragraph). These seem to be non-standard.

The new module `normal/toggle_comments.rs` has been copied almost
verbatim from `normal/indent.rs`. Maybe that ought to be abstracted over
but I feel I lack the overview.

Release Notes:

- vim: Added support for count and object motion to the toggle comments
action ([#14337](https://github.com/zed-industries/zed/issues/14337)).
2024-07-22 21:22:10 -06:00
CharlesChen0823
eb210ca248
linux: Fix crash in Wayland when dragging and dropping a tab not belonging to Zed (#14995)
close #14189 

Release Notes:

- N/A
2024-07-22 21:20:53 -06:00
Nate Butler
4ba430b16c
repl: Design tweaks (#14988)
- Add spinner to "Executing..."
- Update Queued label to match others.

Release Notes:

- N/A
2024-07-22 19:05:36 -04:00
Marshall Bowers
fe1f55cbfd
repl: Iterate on design of REPL sessions view (#14987)
This PR iterates on the design of the REPL sessions view.

We now use the same component for both available kernels and running
ones to provide some consistency between the two modes:

<img width="1208" alt="Screenshot 2024-07-22 at 6 49 08 PM"
src="https://github.com/user-attachments/assets/8b5c3600-e438-49fa-8484-cefabf4b44f1">

<img width="1208" alt="Screenshot 2024-07-22 at 6 49 14 PM"
src="https://github.com/user-attachments/assets/5125e9b3-6465-4d1e-9036-e6ca270dedcb">

Release Notes:

- N/A
2024-07-22 19:02:11 -04:00
Kyle Kelley
01392c1329
repl: Enable jupyter by default, allow disabling (#14985)
Enables the jupyter feature by default, which is shown only when we have
a kernelspec or know that we (can) support it well (Python,
Deno/TypeScript).

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-07-22 17:30:21 -04:00
Marshall Bowers
a9397834eb
quick_action_bar: Add menu entry to view REPL sessions (#14984)
This PR adds a new menu entry in the REPL item in the quick action bar
to open up the REPL sessions view:

<img width="232" alt="Screenshot 2024-07-22 at 4 54 36 PM"
src="https://github.com/user-attachments/assets/acc60a25-7722-4331-9b80-fab9cca65842">

This makes this more discoverable than having to know that the command
exists.

Release Notes:

- N/A
2024-07-22 17:05:05 -04:00
Marshall Bowers
4227a3d3e0
repl: Remove unused repl_panel::ToggleFocus action (#14983)
This PR removes the `repl_panel::ToggleFocus` action, as we don't need
it anymore.

Release Notes:

- N/A
2024-07-22 16:45:04 -04:00
Marshall Bowers
2a69420c42
repl: Do some cleanup (#14982)
This PR cleans up the REPL implementation a bit.

Release Notes:

- N/A
2024-07-22 16:39:32 -04:00
Marshall Bowers
d8a42bbf63
repl: Replace REPL panel with sessions view (#14981)
This PR removes the REPL panel and replaces it with a new sessions view
that gets displayed in its own pane.

The sessions view can be opened with the `repl: sessions` command (we
can adjust the name, as needed).

There was a rather in-depth refactoring needed to extricate the various
REPL functionality on the editor from the `RuntimePanel`.

<img width="1136" alt="Screenshot 2024-07-22 at 4 12 12 PM"
src="https://github.com/user-attachments/assets/ac0da351-778e-4200-b08c-39f9e77d78bf">

<img width="1136" alt="Screenshot 2024-07-22 at 4 12 17 PM"
src="https://github.com/user-attachments/assets/6ca53476-6ac4-4f8b-afc8-f7863f7065c7">

Release Notes:

- N/A
2024-07-22 16:22:50 -04:00
Kevin Wang
a20e92a8c1
Truncate line when accepting inline suggestions for Supermaven (#13884)
Configures inline completions to delete the remaining text on the given
line. This doesn't affect the github copilot inline completion provider
since it seems to only generate suggestions if the cursor is at the end
of the line but fixes the usability issues related to Supermaven.




https://github.com/user-attachments/assets/1b8bc9a3-4666-4665-a436-96e4beee01bb





Release Notes:

- Fixed https://github.com/zed-industries/zed/issues/13039

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-07-22 11:59:38 -07:00
Conrad Irwin
a955968de3
Don't panic on GPU hang (#14974)
Fixes: #12766
Fixes: #14022

Release Notes:

- linux: Fix panic when GPU is temporarily unavailable.
2024-07-22 12:21:28 -06:00
Kirill Bulatov
f597c29432
Position X for deleted hunks better (#14973)
Release Notes:

- N/A
2024-07-22 20:24:24 +03:00
Marshall Bowers
28baa56e3d
repl: Factor out ReplStore (#14970)
This PR factors a `ReplStore` out of the `RuntimePanel`.

Since we're planning to remove the `RuntimePanel` and replace it with an
ephemeral tab that can be opened, we need the kernel specifications and
sessions to have somewhere long-lived that they can reside in.

Release Notes:

- N/A
2024-07-22 12:46:33 -04:00
Conrad Irwin
2e23527e09
Refactor key dispatch (#14942)
Simplify key dispatch code.

Previously we would maintain a cache of key matchers for each context
that
would store the pending input. For the last while we've also stored the
typed prefix on the window. This is redundant, we only need one copy, so
now
it's just stored on the window, which lets us avoid the boilerplate of
keeping
all the matchers in sync.

This stops us from losing multikey bindings when the context on a node
changes
(#11009) (though we still interrupt multikey bindings if the focus
changes).

While in the code, I fixed up a few other things with multi-key bindings
that
were causing problems:

Previously we assumed that all multi-key bindings took precedence over
any
single-key binding, now this is done such that if a user binds a
single-key
binding, it will take precedence over all system-defined multi-key
bindings
(irrespective of the depth in the context tree). This was a common cause
of
confusion for new users trying to bind to `cmd-k` or `ctrl-w` in vim
mode
(#13543).

Previously after a pending multi-key keystroke failed to match, we would
drop
the prefix if it was an input event. Now we correctly replay it
(#14725).

Release Notes:

- Fixed multi-key shortcuts not working across completion menu changes
([#11009](https://github.com/zed-industries/zed/issues/11009))
- Fixed multi-key shortcuts discarding earlier input
([#14445](https://github.com/zed-industries/zed/pull/14445))
- vim: Fixed `jk` binding preventing you from repeating `j`
([#14725](https://github.com/zed-industries/zed/issues/14725))
- vim: Fixed `escape` in normal mode to also clear the selected
register.
- Fixed key maps so user-defined mappings take precedence over builtin
multi-key mappings
([#13543](https://github.com/zed-industries/zed/issues/13543))
- Fixed a bug where overridden shortcuts would still show in the Command
Palette
2024-07-22 10:46:16 -06:00
Piotr Osiewicz
865904a0c9
lsp: Pass back diagnostic .data when querying code actions for it (#14962)
Per the LSP spec, we should pass .data field of diagnostics into code
action request:
```
	/**
	 * A data entry field that is preserved between a
	 * `textDocument/publishDiagnostics` notification and
	 * `textDocument/codeAction` request. *
	 * @since 3.16.0 */ data?: LSPAny;
```


Release Notes:

- Fixed rare cases where a code action triggered by diagnostic may not
be available for use.
2024-07-22 17:49:11 +02:00
Floyd Wang
1ea363b020
Fix typo in font-weight setting story (#14958)
Release Notes:

- N/A
2024-07-22 07:49:27 -04:00
Antonio Scandurra
0155435142
Allow using a custom model when using zed.dev (#14933)
Release Notes:

- N/A
2024-07-22 12:25:53 +02:00
Kirill Bulatov
31d283932c
Allow to input spaces in the outline panel filter input (#14951)
Release Notes:

- Fixed outline panel's filter not accepting spaces
2024-07-22 12:02:25 +03:00
Luke Naylor
0ef19dedd2
Correct escaping in snippets (#14912)
## Release Notes:

- Fixed issue with backslashes not appearing in snippets
([#14721](https://github.com/zed-industries/zed/issues/14721)),
motivated by a snippet provided by the latex LSP
([texlab](https://github.com/latex-lsp/texlab)) not working as intended
in Zed ([extension
issue](https://github.com/rzukic/zed-latex/issues/5)).

[Screencast from 2024-07-21
14-57-19.webm](https://github.com/user-attachments/assets/3c95a987-16e5-4132-8c96-15553966d4ac)

## Fix details:

Only $, }, \ can be escaped by a backslash as per [LSP spec (under
grammar
section)](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/\#snippet_syntax).
Technically, commas and pipes can also be escaped only in "choice"
tabstops but it does not look like they are implemented in Zed yet.

## Additional tests added for cases currently not covered:
- backslash not being used to escape anything (so just a normal
backslash)
- backslash escaping a backslash (so that the second does not escape
what follows it)

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-07-22 00:57:34 +02:00
Marshall Bowers
83f6a7f228
assistant: Use square buttons for the inline assist model selector (#14928)
This PR updates the model selector buttons in the inline assistant to
use `IconButtonShape::Square`.

Release Notes:

- N/A
2024-07-21 13:59:21 -04:00