Commit Graph

16874 Commits

Author SHA1 Message Date
Marshall Bowers
82529499df
Fix min and max versions for v0.1.0 of the extension API (#16163)
Missed this in #16158.

Release Notes:

- N/A
2024-08-13 10:40:29 -04:00
Marshall Bowers
4450ebff6b
Allow extensions to control the redirect policy for the HTTP client (#16162)
This PR extends the extension API with support for controlling the
redirect policy used by the HTTP client.

Release Notes:

- N/A
2024-08-13 10:40:21 -04:00
Marshall Bowers
98a2ab0686
zed_extension_api: Bump to v0.1.0 (#16158)
This PR changes v0.0.7 of the extension API to v0.1.0.

We had a false-start in releasing v0.0.7, which has since been yanked,
so we need a new version number. We'll publish v0.1.0 to crates.io once
the Preview build is out tomorrow.

We're incrementing the minor version so that we have some leeway in
putting out patch releases of the crate within a given extension API
release.

Release Notes:

- N/A
2024-08-13 10:04:34 -04:00
Rudolf Kastl
47eed12f77
Update zed.desktop.in to include the MimeType for empty files by default (#15623)
Update zed.desktop.in to include the MimeType for empty files.
Seems to be the default for all "text editors" .desktop files.

Release Notes:

- Improved MimeType list in XDG .desktop file
2024-08-13 16:56:44 +03:00
Marshall Bowers
cade9fbd3d
assistant: Show a better error when /docs is used without a package name (#16157)
This PR makes it so that running `/docs` without providing a package
name gives a better error message:

<img width="248" alt="Screenshot 2024-08-13 at 9 24 58 AM"
src="https://github.com/user-attachments/assets/c1cc794e-0fa0-490a-871a-a56702b03d42">

<img width="228" alt="Screenshot 2024-08-13 at 9 25 05 AM"
src="https://github.com/user-attachments/assets/45dca2d7-171f-48f0-a03c-254b552cb50d">

Release Notes:

- N/A
2024-08-13 09:39:26 -04:00
CharlesChen0823
fe190359d5
editor: Add revert file action to command palette (#16012)
Release Notes:

- Added an `editor::RevertFile` action
2024-08-13 14:44:41 +03:00
张小白
ac6bff12b9
windows: Remove unused dependencies (#15857)
I have removed some unused dependencies, reducing the total number of
packages during the build from 1141 to 1112. This should slightly
decrease the build time.

![Screenshot 2024-08-06
230726](https://github.com/user-attachments/assets/58a49fd4-4a0a-4026-b6b7-79b95529ec74)


Release Notes:

- N/A
2024-08-13 13:31:02 +03:00
Kirill Bulatov
081cbcebd9
Merge /active command into /tabs one (#16154)
Now, tabs have arguments, `active` (default, applied also for no
arguments case) and `all` to insert the active tab only or all tabs.

Release Notes:

- N/A
2024-08-13 13:15:57 +03:00
Stanislav Alekseev
c2b254a67a
Fallback to using tree-sitter when determining ranges for info popovers (#16062)
Closes #15382

Release Notes:

- Added fallback to a smallest tree sitter node when hovering over a
symbol
2024-08-13 12:01:14 +02:00
Thorsten Ball
af36d4934c
assistant panel: Animate assistant label if message is pending (#16152)
This adds a pulsating effect to the assistant header in case the message
is pending.

The pulsating effect is capped between 0.2 and 1.0 and I tried (with the
help of Claude) to give it a "breathing" effect, since I found the
normal bounce a bit too much.

Also opted for setting the `alpha` on the `LabelLike` things, vs.
overwriting the color, since I think that's cleaner instead of exposing
the color and mutating that.


https://github.com/user-attachments/assets/4a94a1c5-8dc7-4c40-b30f-d92d112db7b5


Release Notes:

- N/A
2024-08-13 11:41:44 +02:00
Kirill Bulatov
b36d1386a9
Fix editor::Cancel action not inline assistant inputs created for empty selections (#16150)
Release Notes:

- N/A
2024-08-13 12:11:57 +03:00
Uladzislau Kaminski
ee6a40137f
Remove extra empty space for files when file icons are turned off (#16142)
Closes #16073

<img width="269" alt="image" src="https://github.com/user-attachments/assets/88b7ff9f-17ec-4764-b37a-c218d7ad14ec">

Release Notes:

- Removed extra empty space for files when file icons are turned off ([#16073](https://github.com/zed-industries/zed/issues/16073))
2024-08-13 12:09:13 +03:00
Nathan Sobo
1c189e82a0
Improve tooltip text (#16147)
![image](https://github.com/user-attachments/assets/90faf9ce-0515-4a99-92ca-c69b17b5149e)

Release Notes:

- Include a count of the context tokens when hovering token counts in
the inline assist.
2024-08-12 23:24:27 -06:00
Nathan Sobo
a515442a36
Rely on model to determine indentation level and always rewrite the full line (#16145)
This PR simplifies our approach to indentation in the inline assistant
in hopes of improving our experience for Python. We tell the model to
generate the correct indentation in the prompt, and always start
generating at the start of the line. This may fall down for less capable
models, but I want to get a solid experience on the best models and then
figure the rest out later.

Also: We now prefer `./assets/prompts` as an overrides directory when
stdout is a PTY, so you can do `cargo run` and then iterate prompts for
the current run inside the current working copy.

cc @trishume @dsp-ant 

Release Notes:

- Zed now allows the model to control indentation when performing inline
transformation. We're hoping this improves the indentation experience in
Python and other indentation-sensitive languages, but it does require
more from the model.

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-08-12 22:41:24 -06:00
Marshall Bowers
b4c22cc861
collab: Add ability to revoke LLM service access tokens (#16143)
This PR adds the ability to revoke access tokens for the LLM service.

There is a new `revoked_access_tokens` table that contains the
identifiers (`jti`) of revoked access tokens.

To revoke an access token, insert a record into this table:

```sql
insert into revoked_access_tokens (jti) values ('1e887b9e-37f5-49e8-8feb-3274e5a86b67');
```

We now attach the `jti` as `authn.jti` to the tracing spans so that we
can associate an access token with a given request to the LLM service.

Release Notes:

- N/A
2024-08-12 21:47:05 -04:00
Piotr Osiewicz
0bc9fc9487
assistant: Slash command tweaks (#16140)
Release Notes:

- N/A
2024-08-13 02:34:03 +02:00
Max Brunsfeld
dbcd06642c
Track lifetime spending for each user and model (#16137)
Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-12 20:15:26 -04:00
Piotr Osiewicz
68ae347077
chore: Remove a bunch of unused structs (#16139)
Found by beta clippy.

Release Notes:

- N/A
2024-08-13 01:43:19 +02:00
Marshall Bowers
8a148f3a13
Add feature-flagged access to LLM service (#16136)
This PR adds feature-flagged access to the LLM service.

We've repurposed the `language-models` feature flag to be used for
providing access to Claude 3.5 Sonnet through the Zed provider.

The remaining RPC endpoints that were previously behind the
`language-models` feature flag are now behind a staff check.

We also put some Zed Pro related messaging behind a feature flag.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
2024-08-12 18:13:40 -04:00
Kirill Bulatov
3bebb8b401
Allow to cycle through center/top/bot scroll positions (#16134)
On top of `editor::ScrollCursorCenter`, `editor::ScrollCursorTop`,
`editor::ScrollCursorBottom` actions, adds an
`editor::ScrollCursorCenterTopBottom` one, that allows using a single
keybinding to scroll between positions on the screen.

The implementation matches a corresponding Emacs feature: there's a
timeout (1s) that is kept after every switch, to allow continuously
changing the positions, center (initial) -> top -> bottom
Scrolling behavior is the same as the existing actions (e.g. editor will
ignore scroll to bottom, if there's not enough space above).

After 1s, next position is reset to the initial, center, one.


Release Notes:

- Added an `editor::ScrollCursorCenterTopBottom` action for toggling
scroll position with a single keybinding

---------

Co-authored-by: Alex Kladov <aleksey.kladov@gmail.com>
2024-08-13 00:32:30 +03:00
Marshall Bowers
98516b5527
collab: Restrict usage of the LLM service to accounts older than 30 days (#16133)
This PR restricts usage of the LLM service to accounts older than 30
days.

We now store the GitHub user's `created_at` timestamp to check the
GitHub account age. If this is not set—which it won't be for existing
users—then we use the `created_at` timestamp in the Zed database.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
2024-08-12 17:27:21 -04:00
Kirill Bulatov
f398ecc3fb
Allow inserting text into the editor via the action (#16131)
Improves workflows, based on the keymaps that group actions behind a
certain symbol.
E.g.

```json5
", o k": "zed::OpenKeymap",
", o K": "zed::OpenDefaultKeymap",
// other `,`-based keymaps
```

Now, it's possible to do 
```json
", ,": ["editor::HandleInput", ","]
```

and type `,` without waiting for the timeout due to `,`-based bindings.

Release Notes:

- Add an `editor::HandleInput` action to ease typing symbols that are
part of keymaps. E.g. if `, o k` keybinding is bound, `", ,":
["editor::HandleInput", ","]` would allow to type `,` without timeouts.

---------

Co-authored-by: Alex Kladov <aleksey.kladov@gmail.com>
2024-08-13 00:02:52 +03:00
Max Brunsfeld
a3c79218c4
Report telemetry events for rate limit errors (#16130)
clickhouse telemetry schema:

```
CREATE TABLE default.llm_rate_limit_events
(
    `time` DateTime64(3),
    `user_id` Int32,
    `is_staff` Bool,
    `plan` LowCardinality(String),
    `model` String,
    `provider` LowCardinality(String),
    `usage_measure` LowCardinality(String),
    `requests_this_minute` UInt64,
    `tokens_this_minute` UInt64,
    `tokens_this_day` UInt64,
    `max_requests_per_minute` UInt64,
    `max_tokens_per_minute` UInt64,
    `max_tokens_per_day` UInt64,
    `users_in_recent_minutes` UInt64,
    `users_in_recent_days` UInt64
)
ORDER BY tuple()
```

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-12 16:31:11 -04:00
Max Brunsfeld
1674e12ccb
Expose anthropic API errors to the client (#16129)
Now, when an anthropic request is invalid or anthropic's API is down,
we'll expose that to the user instead of just returning a generic 500.

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-12 13:11:48 -07:00
Marshall Bowers
f3ec8d425f
collab: Use a separate Anthropic API key for Zed staff (#16128)
This PR makes it so Zed staff can use a separate Anthropic API key for
the LLM service.

We also added an `is_staff` column to the `usages` table so that we can
exclude staff usage from the "active users" metrics that influence the
rate limits.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
2024-08-12 15:20:34 -04:00
Marshall Bowers
ebdde5994d
collab: Don't issue LLM API tokens if the user has not accepted the ToS (#16123)
This PR adds a check to the LLM API token issuance to ensure that we
only issue tokens to users that have accepted the terms of service.

Release Notes:

- N/A
2024-08-12 14:10:08 -04:00
Michael Angerman
63aef7f798
command_palette: Remove project as a dependency in Cargo.toml (#16082)
The *project crate* is only needed as a dev dependency in the command
palette..
So I am doing some code / dependency cleanup...

Release Notes:

- N/A
2024-08-12 13:01:32 -04:00
Marshall Bowers
ebdb755fef
Surface upstream rate limits from Anthropic (#16118)
This PR makes it so hitting upstream rate limits from Anthropic result
in an HTTP 429 response instead of an HTTP 500.

To do this we need to surface structured errors out of the `anthropic`
crate.

Release Notes:

- N/A
2024-08-12 11:59:24 -04:00
Thorsten Ball
fbb533b3e0
assistant: Require user to accept TOS for cloud provider (#16111)
This adds the requirement for users to accept the terms of service the
first time they send a message with the Cloud provider.

Once this is out and in a nightly, we need to add the check to the
server side too, to authenticate access to the models.

Demo:


https://github.com/user-attachments/assets/0edebf74-8120-4fa2-b801-bb76f04e8a17



Release Notes:

- N/A
2024-08-12 17:43:35 +02:00
Piotr Osiewicz
98f314ba21
assistant: Add debug inspector (#16105)
I went with inline approach directly within the panel.
First, enable workflow debugging in the hamburger menu (this works
retroactively as well):


![image](https://github.com/user-attachments/assets/d2ab8edf-bb7b-49a4-8f70-9a6fe94dc7dd)

This enables debug buttons in the header of each step:

![image](https://github.com/user-attachments/assets/3b5d479f-7473-4c41-a2e7-8c10bb71f0ff)
Enabling one pretty-prints the workflow step internals:

![image](https://github.com/user-attachments/assets/e651e826-1270-49ff-8bb6-046c07c006bf)


Release Notes:

- N/A
2024-08-12 17:05:54 +02:00
Piotr Osiewicz
b6b081596a
assistant: Show tooltips on workflow step buttons only when cursor is in step (#16108)
Release Notes:

- N/A
2024-08-12 16:53:11 +02:00
Nathan Sobo
fc64843dd5
Enhance HTTP API for extensions (#16067)
# HTTP Client Improvements for Extension API

This PR enhances the HTTP client functionality in the Zed extension API,
providing more control over requests and allowing for streaming
responses.

## Key Changes

1. Extended `HttpRequest` struct:
   - Added `method` field to specify HTTP method
   - Added `headers` field for custom headers
   - Added optional `body` field for request payload

2. Introduced `HttpMethod` enum for supported HTTP methods

3. Updated `HttpResponse` struct:
   - Added `headers` field to access response headers
- Changed `body` type from `String` to `Vec<u8>` for binary data support

4. Added streaming support:
   - New `fetch_stream` function to get a response stream
   - Introduced `HttpResponseStream` resource for chunked reading

5. Updated internal implementations to support these new features

6. Modified the Gleam extension to use the new API structure

## Motivation

These changes provide extension developers with more flexibility and
control over HTTP requests. The streaming support is particularly useful
for handling large responses efficiently or ideally streaming into the
UI.

## Testing

- [x] Updated existing tests
- [ ] Added new tests for streaming functionality

## Next Steps

- Consider adding more comprehensive examples in the documentation
- Evaluate performance impact of streaming for large responses

Please review and let me know if any adjustments are needed.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-12 10:36:49 -04:00
Marshall Bowers
f952126319
collab: Remove LLM completions over RPC (#16114)
This PR removes the LLM completion messages from the RPC protocol, as
these now go through the LLM service as of #16113.

Release Notes:

- N/A
2024-08-12 10:08:56 -04:00
Nate Butler
f992cfdc7f
Update provider logos (#16115)
- Updates provider logos for Anthropic, Google and Ollama
- Increases the size of icons in the model selector

Release Notes:

- N/A
2024-08-12 09:55:00 -04:00
Marshall Bowers
6389c613a2
Always stream completions through the LLM service (#16113)
This PR removes the `llm-service` feature flag and makes it so all
completions are done via the LLM service when using the Zed provider.

Release Notes:

- N/A
2024-08-12 09:33:24 -04:00
Son
bab4da78b7
Fix corner radius when doing rounded_full (#15663)
Release Notes:

- Fixed issue when doing `rounded_full`, it should render a pill-shape
rect instead of current eye-shape.

For example with this code
`div().h_4().w_16().bg(rgb(0xffffff)).rounded_full()`

Current:

<img width="144" alt="image"
src="https://github.com/user-attachments/assets/f8b20c7c-d91f-4c20-9f38-d435f59e72b7">

Fixed:

<img width="172" alt="image"
src="https://github.com/user-attachments/assets/ff8bbe26-2b31-4ef1-a2fb-25b458386ffb">
2024-08-12 15:24:32 +02:00
Antonio Scandurra
a15a9565ab
Accept finished inline transformations only if the user saves manually (#16112)
Closes https://github.com/zed-industries/zed/issues/16042

This commit modifies the behavior of inline transformations to only
accept finished transformations when the user manually saves the file.
Previously, transformations were automatically accepted on any save
event, including autosaves.

This was achieved by updating the `Pane` and `Workspace` structs to emit
a new `UserSavedItem` event when a manual save occurs, and modifying the
`InlineAssistant` to register and handle this new event (instead of
`editor::Saved`).

Release Notes:

- N/A
2024-08-12 15:16:55 +02:00
Antonio Scandurra
48f6193628
Improve workflow step pruning and symbol similarity matching (#16036)
This PR improves workflow step management and symbol matching. We've
optimized step pruning to remove any step that intersects an edit and
switched to normalized Levenshtein distance for more accurate symbol
matching.

Release Notes:

- N/A
2024-08-12 11:09:07 +02:00
Nathan Sobo
355aebd0e4
Introduce prompt override script and adjust names (#16094)
This PR introduces a new script for iterative development of prompt
overrides in Zed.

Just `script/prompts link` and your running Zed should start using
prompts from `zed/assets/prompts`. Use `script/prompts unlink` to undo.
You can also link with `script/prompts link --worktree` to store the
prompts to a `../zed_prompts` worktree that's a sibling of your repo, in
case you don't want to mess with your working copy. Just don't forget
about it!

Key changes:
- Add new `script/prompts` for managing prompt overrides
- Rename `prompt_templates_dir` to `prompt_overrides_dir` for clarity
- Update paths to use `~/.config/zed/prompt_overrides` instead of
`~/.config/zed/prompts/templates`
- Adjust `PromptBuilder` to use the new `prompt_overrides_dir` function

These changes simplify the process of customizing prompts and provide a
more intuitive naming convention for override-related functionality.

Release Notes:

- N/A
2024-08-11 17:21:17 -06:00
Marshall Bowers
3140d6ce8c
collab: Temporarily bypass LLM rate limiting for staff (#16089)
This PR makes it so staff members will be exempt from rate limiting by
the LLM service.

This is just a temporary measure until we can tweak the rate-limiting
heuristics.

Staff members are still subject to upstream LLM provider rate limits.

Release Notes:

- N/A
2024-08-11 14:41:49 -04:00
Nathan Sobo
6f104fecad
Copy extension_api Rust files to OUT_DIR when building extension to work around rust-analyzer limitation (#16064)
Copies rust files from extension_api/wit to the OUT_DIR to allow
including them from within the crate, which is supported by
rust-analyzer. This allows rust-analyzer to deal with the included
files. It doesn't currently support files outside the crate.

Release Notes:

- N/A
2024-08-10 18:19:11 -06:00
Kyle Kelley
550e139b61
repl: Set the default lines ✖️ columns for the REPL to 32x128 (#16061)
![image](https://github.com/user-attachments/assets/dce938ef-bdfd-4412-a074-90c883286263)

Release Notes:

- Improved visuals of repl stdout/stderr by reducing default line count
to 32
2024-08-10 10:28:56 -07:00
Max Brunsfeld
33e120d964
Capture telemetry data on per-user monthly LLM spending (#16050)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-09 16:38:37 -07:00
Max Brunsfeld
8688b2ad19
Add telemetry for LLM usage (#16049)
Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-09 18:15:57 -04:00
Max Brunsfeld
423c7b999a
Larger rate limit integers (#16047)
Tokens per day may exceed the range of Postgres's 32-bit `integer` data
type.

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-09 14:07:49 -07:00
Marshall Bowers
0932818829
zed_extension_api: Release v0.0.7 (#16048)
This PR releases v0.0.7 of the Zed extension API.

Support for this version of the extension API will land in Zed v0.149.0.

Release Notes:

- N/A
2024-08-09 16:52:16 -04:00
Max Brunsfeld
fbebb73d7b
Use LLM service for tool call requests (#16046)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-09 16:22:58 -04:00
Max Brunsfeld
d96afde5bf
Avoid insert ... on conflict on startup (#16045)
These queries advance the id sequence even when there's nothing to
insert

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-09 15:32:11 -04:00
Max Brunsfeld
b1c69c2178
Fix usage recording in llm service (#16044)
Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-09 11:48:18 -07:00
Peter Tripp
eb3c4b0e46
Docs Party 2024 (#15876)
Co-authored-by: Raunak Raj <nkray21111983@gmail.com>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
Co-authored-by: Bennet <bennet@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Joseph T Lyons <JosephTLyons@gmail.com>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Jason <jason@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Jason Mancuso <7891333+jvmncs@users.noreply.github.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-08-09 13:37:54 -04:00
Bennet Bo Fenner
c633fa5a10
assistant: Improve quote selection (#16038)
https://github.com/user-attachments/assets/fe283eec-169f-4dfd-bae2-cc72c1c3f223



Release Notes:

- Include more context when using `assistant: Quote selection` to insert
text into the assistant panel

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-09 18:29:27 +02:00
Marshall Bowers
49f760eeda
collab: Set LLM_DATABASE_MAX_CONNECTIONS (#16035)
This PR updates the collab template to set the
`LLM_DATABASE_MAX_CONNECTIONS` environment variable for the LLM service.

Release Notes:

- N/A
2024-08-09 11:16:02 -04:00
Max Brunsfeld
225726ba4a
Remove code paths that skip LLM db in prod (#16008)
Release Notes:

- N/A
2024-08-09 10:41:50 -04:00
Thorsten Ball
c1872e9cb0
vim: Fix ctrl-u/ctrl-d with high vertical_scroll_margin (#16031)
This makes sure that the `vertical_scroll_margin` doesn't leave the
cursor out of screen or somewhere it shouldn't go when it's higher than
the visible lines on screen.

So we cap it to `visible_line_count / 2`, similar to nvim:


5aa1a9532c/src/nvim/window.c (L6560)

Fixes #15101

Release Notes:

- Fixed `ctrl-u`/`ctrl-d` in Vim mode not working correctly when
`vertical_scroll_margin` is set to a really high value.

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-09 16:00:05 +02:00
Thorsten Ball
09c9ed4765
vim: Fix panic due to overflow when scrolling (#16029)
When setting `"vertical_scroll_margin": 99` or other high values this
can lead to a panic that crashes Zed.

Release Notes:

- vim: Fixed a possible panic that could happen when using a very high
value for `vertical_scroll_margin` that exceeded the number of visible
lines on the screen.

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-09 15:15:27 +02:00
Thorsten Ball
19d8422933
stories: Get OverflowScrollStory to scroll again (#15982)
This makes it at least scroll again, but it doesn't scroll down to the
last element yet. We haven't figured out why yet.


Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
Co-authored-by: Antonio <antonio@zed.dev>
2024-08-09 12:32:26 +02:00
Thorsten Ball
173f6e7c8f
assistant panel: Make configuration view scrollable (#16022)
We had to resort to this "hack" to get it to work, since nothing else we
tried (changing the `Pane`, changing the `ConfigurationView`, changing
the `AssistantPanel`, ...) worked.

Release Notes:

- N/A

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Bennet <bennet@zed.dev>
2024-08-09 12:21:22 +02:00
Massimo Mund
e783142528
Fix vertical_scroll_margin not being capped for large vertical_scroll_margin values (#15473)
When switching to function definitions in a new buffer the
`AutoscrollStrategy::Focused` being emitted to scroll to the found
location.
If a large value `vertical_scroll_margin` (e.g.: 99) is set, this leads
to an incorrectly calculated position and the new buffer opens in the
wrong place.

In `autoscroll_vertically()` there is a margin calculated to cap the
value of `vertical_scroll_margin` for certain AutoscrollStrategies. This
margin is being used in `AutoscrollStrategy::Fit` and
`AutoscrollStrategy::Newest` but was probably forgotten for
`AutoscrollStrategy::Focused`.

- Might fix [#15101](https://github.com/zed-industries/zed/issues/15101)

Release Notes:

- N/A
2024-08-09 09:35:57 +02:00
Santeri Salmijärvi
06833d7360
Support MSbuild row-column format in PathWithPosition (#15589)
This implements #15412. Row-column parsing is changed into a regex to
support more complex patterns like the MSBuild diagnostics. Terminal
`word_regex` is also relaxed to match those suffixes.

Release Notes:

- N/A
2024-08-09 09:21:56 +02:00
Robin Malfait
7a600411cf
Add injections for tagged template literals (#15984)
This PR adds syntax highlighting support for `css`, `html`, `js`,
`json`, `sql`, `ts`, `yaml` and `yml` in `javascript`, `typescript` and
`tsx` languages where the contents of tagged template literals are now
highlighted.

This does not actually enable language features (like LSP support), it
only does syntax highlighting.

Before this change:
<img width="561" alt="image"
src="https://github.com/user-attachments/assets/74bace1b-5ce1-4b17-8a97-035bba152d9c">


After this change:
<img width="607" alt="image"
src="https://github.com/user-attachments/assets/f227145b-3f4a-4c27-b14f-7143bb19b4cf">

/cc @mrnugget 

Release Notes:

- Added syntax highlighting for tagged template literals in
`javascript`, `typescript` and `tsx` languages for `css`, `html`, `js`,
`json`, `sql`, `ts`, `yaml` and `yml`.
([#15984](https://github.com/zed-industries/zed/issues/15984))
2024-08-09 09:16:48 +02:00
Max Brunsfeld
240b7c641c
Fix llm queries (#16006)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-08 17:21:38 -07:00
Max Brunsfeld
06625bfe94
Apply rate limits in LLM service (#15997)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-08 15:46:33 -07:00
Marshall Bowers
2bc503771b
assistant: Show an error when /fetch returns no content (#16001)
This PR makes it so the `/fetch` slash command will display an error
when the URL does not have any textual content:

<img width="308" alt="Screenshot 2024-08-08 at 4 51 55 PM"
src="https://github.com/user-attachments/assets/bf4cbc18-c65b-48a2-aedd-26b50f47f018">

Release Notes:

- N/A
2024-08-08 17:07:42 -04:00
Marshall Bowers
abb6d40fbf
Put /docs behind a feature flag (#16000)
This PR puts the `/docs` slash command behind a feature flag.

Release Notes:

- N/A
2024-08-08 16:51:35 -04:00
Conrad Irwin
bd59af1df5
vim: Support ranges in command (#15985)
The most requested feature here is "search and replace in visual mode",
but as a happy side effect we can now support things like :2,12j to join
those lines, and much much more.



Release Notes:

- vim: Added support for range syntax in command
([#9428](https://github.com/zed-industries/zed/issues/9428)).
- vim: Prefill command with `:'<,'>` from visual mode
([#13535](https://github.com/zed-industries/zed/issues/13535)).
2024-08-08 21:47:27 +01:00
Marshall Bowers
a39f1f5133
Fix Windows build in CI (#15990)
This PR fixes the Windows build in CI, which was failing due to Clippy
warnings.

Release Notes:

- N/A
2024-08-08 12:55:26 -04:00
Marshall Bowers
fbc629df7d
assistant: Put /search behind a feature flag (#15987)
This PR puts the `/search` slash command behind a feature flag.

Release Notes:

- N/A
2024-08-08 12:33:59 -04:00
CharlesChen0823
a71bfd41cc
recent_project: Fix overflow sub (#15965)
close: #15783 

Release Notes:

- Fixed a potential panic that can occur when deleting entries from the
recent-projects menu
([#15783](https://github.com/zed-industries/zed/issues/15783))
2024-08-08 15:58:59 +02:00
Piotr Osiewicz
73fb8277fc
assistant: Polish /workflow and steps UI (#15936)
Fixes #15923
Release Notes:

- Assistant workflow steps can now be applied and reverted directly from
within the assistant panel.

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Antonio <antonio@zed.dev>
2024-08-08 15:46:33 +02:00
Bennet Bo Fenner
514b79e461
collab: Always use newest anthropic model version (#15978)
When Anthropic releases a new version of their models, Zed AI users
should always get access to the new version even when using an old
version of zed.

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

Release Notes:

- N/A

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-08 15:24:08 +02:00
Bennet Bo Fenner
793cd88792
keymap: Show error notification when keymap is invalid (#15977)
This adds an error notification that pops up when the user has an
invalid keymap, similar to what we added for settings in #15905.

Release Notes:

- Added a popup that is displayed when the keymap is invalid
2024-08-08 14:11:46 +02:00
Piotr Osiewicz
f3abb7e724 assistant: Grab focus when clicking on history icon 2024-08-08 13:18:31 +02:00
Bennet Bo Fenner
389cb86e43
assistant: Dismiss model selector after changing model (#15974)
Co-Authored-By: Thorsten <thorsten@zed.dev>

Release Notes:

- N/A

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-08 13:09:03 +02:00
Bennet Bo Fenner
fea8f16df0
assistant: Show regenerate button only on hover (#15972)
https://github.com/user-attachments/assets/92006a45-5b4e-4ec4-a056-9ef7dd76394d



Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-08 13:08:57 +02:00
Danilo Leal
76d58ac295
Add design tweaks to the AI configuration panel (#15894)
This PR polishes elements around setting up LLM providers on the
Assistant panel, including:

- [x] Adding banners for promoting Zed AI and to deal with the "No
provider set up" scenario
- [x] Tweaking the error popover whenever there's no API key added
- [ ] Making configuration panel scrollable

--- 

Release Notes:

- N/A

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2024-08-08 12:12:36 +02:00
Bennet Bo Fenner
e69b0833aa
markdown preview: Detect language of buffer correctly (#15961)
Fixes #15958

Release Notes:

- Fixed an issue where the markdown preview button would not show up for
some markdown files
([#15958](https://github.com/zed-industries/zed/issues/15958)).
2024-08-08 11:53:37 +02:00
Nathan Sobo
da8d1306af
Open workflow step editors as preview tabs (#15928)
This PR opens workflow step editors as preview tabs and closes them upon
exiting the step if they are still in preview mode and they weren't
already open before entering the step.

Making this work was tricky, because we often edit the buffer as part of
displaying the workflow step suggestions to create empty lines where we
can generate. We undo these edits if the transformation is not applied,
but they were causing the preview to be dismissed.

After trying a few approaches, I decided to give workspace `Item`s a
`preserve_preview` method that defaults to false. When the workspace
sees an edit event for the item, it checks if the item wants to preserve
its preview. For buffers, after editing, you can call `refresh_preview`,
which sets a preview version to the current version of the buffer. Any
edits after this version will cause preview to not be preserved.

One final issue is with async auto-indent. To ensure these async edits
don't dismiss the preview, I automatically refresh the preview version
if preview was preserved prior to performing the auto-indent. The
assumption is that these are edits created by other edits, and if we
didn't want to dismiss the preview with the originating edits, then the
auto-indent edits shouldn't dismiss it either.

Release Notes:

- N/A

---------

Co-authored-by: Jason <jason@zed.dev>
2024-08-07 19:33:58 -06:00
Marshall Bowers
6f6eeb6595
collab: Update how mode is displayed in root endpoint (#15911)
This PR adjusts how we display the "mode" collab is running in on the
root endpoint.

It's minor, but it does make things a bit cleaner.

Release Notes:

- N/A
2024-08-07 12:09:43 -04:00
Joseph T Lyons
22162e884b v0.149.x dev 2024-08-07 10:59:51 -04:00
Bennet Bo Fenner
3a52d6cc52
assistant: Limit model access for Zed AI users to Claude-3.5-sonnet (#15904)
This prevents users from accessing other models, such as OpenAI's GPT-4
or Google's Gemini-Pro.
Staff members can still access all models.

Co-authored-by: Thorsten <thorsten@zed.dev>

Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-07 16:26:56 +02:00
Bennet Bo Fenner
efbf7ada28
settings: Show error notification when settings are invalid (#15905)
https://github.com/user-attachments/assets/07627142-e730-4446-a50b-7ef46f8e661c

We want to improve the design in the future, but it fixes a long
standing paper cut for now.

Release Notes:

- Added a popup that is displayed when the settings are invalid

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-07 15:54:44 +02:00
Thorsten Ball
94028290cc
assistant panel: Use feature flag for Zed Pro mentions (#15903)
This removes Zed Pro mentions.

Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-07 14:44:00 +02:00
Son
f24f601e05
Adjust erf estimation function (#15423)
Release Notes:

- Fixed a (potential) small error in erf estimation. Technically, the
error is negligible.

I am not sure where the current calculation for erf come from and if it
is intended or a simple mistake. However it looks slightly different
from the official calculation, notably
[this](https://en.wikipedia.org/wiki/Error_function#Approximation_with_elementary_functions)
from Wikipedia.

I will add a comment if it is intended.
2024-08-07 14:12:26 +02:00
Piotr Osiewicz
2db2b636f2
assistant: Add annotations to more languages (#15866)
Release Notes:

- N/A
2024-08-07 13:47:21 +02:00
Piotr Osiewicz
8aa1ba8cbc
assistant: Tweak tab bar layout (#15901)
- Add "New Context" button next to the hamburger
- Add "History"
- Allow Pane tab rendering callback to return items for both left and
right side of the tab bar.


![image](https://github.com/user-attachments/assets/d5aa599d-c9e4-4f26-ad66-ffc290c53c29)


Release Notes:

- N/A
2024-08-07 13:46:59 +02:00
Piotr Osiewicz
bf403ca788
chore: Remove assistant labels for users without feature flag enabled (#15899)
Release Notes:

- N/A
2024-08-07 12:46:49 +02:00
Nathan Sobo
990774247e
Allow /workflow and step resolution prompts to be overridden (#15892)
This will help us as we hit issues with the /workflow and step
resolution. We can override the baked-in prompts and make tweaks, then
import our refinements back into the source tree when we're ready.

Release Notes:

- N/A
2024-08-06 21:47:42 -06:00
Nathan Sobo
c8f1358629
Allow prompt templates to be overridden in the zed configuration directory (#15887)
I need this to refine our prompts on the fly as I work.

Release Notes:

- Templates for prompts driving inline transformation in editors and the
terminal can now be overridden in the `~/.config/zed/prompts/templates`
directory. This is an advanced feature, and prevents you from getting
upstream changes. It's intended for use by Zed developers.
2024-08-06 19:30:48 -06:00
Kyle Kelley
6065db174a
repl: Improve kernelspec discoverability (#15886)
<img width="862" alt="image"
src="https://github.com/user-attachments/assets/ae8c479d-d9f9-4c46-bb1a-be411ab07876">

Release Notes:

- Added additional context about available to kernel sessions
- Fixed bug in kernelspec launch choosing first available kernel
matching the language rather than selected name

---------

Co-authored-by: Jason <jason@zed.dev>
2024-08-06 16:58:56 -07:00
Marshall Bowers
a54e16b7ea
collab: Add usages table to LLM database (#15884)
This PR adds a `usages` table to the LLM database.

We'll use this to track usage for rate-limiting purposes.

Release Notes:

- N/A
2024-08-06 18:40:10 -04:00
Marshall Bowers
b19f85f9b5
collab: Remove unused parameter to run_database_migrations (#15883)
This PR removes the unused `ignore_checksum_mismatch` parameter to
`run_database_migrations`.

We were always passing `false`, which meant the behavior didn't need to
be parameterized.

Release Notes:

- N/A
2024-08-06 17:31:52 -04:00
Marshall Bowers
7f6d0919c9
collab: Setup database for LLM service (#15882)
This PR puts the initial infrastructure for the LLM service's database
in place.

The LLM service will be using a separate Postgres database, with its own
set of migrations.

Currently we only connect to the database in development, as we don't
yet have the database setup for the staging/production environments.

Release Notes:

- N/A
2024-08-06 17:18:08 -04:00
Joseph T. Lyons
a64906779b
Use vanity Discord link (#15880)
Release Notes:

- N/A
2024-08-06 16:55:51 -04:00
Joseph T. Lyons
11c6ada08f
Add tooltip for toggling filters (#15879)
Release Notes:

- N/A
2024-08-06 15:51:53 -04:00
Antonio Scandurra
104d7adc49
Don't insert unnecessary space below the end of an inline transformation (#15865)
We achieved this by allowing block decorations to have a height of `0`
and superimposing the border on top of the line, as opposed to carving
out space below it.

Release Notes:

- N/A

---------

Co-authored-by: Jason <jason@zed.dev>
2024-08-06 19:00:23 +02:00
Bennet Bo Fenner
2e27448d5f
assistant: Fix inline assistant not working for non-terminal panel views (#15864)
Fixes #15729

Release Notes:

- Fixed an issue where the terminal inline assistant would not appear
when opening a terminal in the center pane
([#15729](https://github.com/zed-industries/zed/issues/15729)).
2024-08-06 18:41:54 +02:00
Max Brunsfeld
33afbe9a94
Add LLM service to kubernetes deployment action (#15863)
Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-06 12:35:00 -04:00
Marshall Bowers
cf5f4dddf5
Authorize access to language model providers based on country (#15859)
This PR updates the LLM service to authorize access to language model
providers based on the requester's country.

We detect the country using Cloudflare's
[`CF-IPCountry`](https://developers.cloudflare.com/fundamentals/reference/http-request-headers/#cf-ipcountry)
header.

The country code is then checked against the list of supported countries
for the given LLM provider. Countries that are not supported will
receive an `HTTP 451: Unavailable For Legal Reasons` response.

Release Notes:

- N/A
2024-08-06 11:49:04 -04:00
Antonio Scandurra
9c6ccaffe3
Allow user to restart transformation after stopping without a diff (#15858)
Release Notes:

- N/A

Co-authored-by: Jason <jason@zed.dev>
2024-08-06 17:25:13 +02:00
Antonio Scandurra
411934bb61
Introduce a new /workflow command (#15854)
This subsumes the previous built-in prompt.

Release Notes:

- N/A
2024-08-06 16:18:07 +02:00
Piotr Osiewicz
874f0c0712
assistant: Use tools in other providers (#15803)
- [x] OpenAI
- [ ] ~Google~ Moved into a separate branch at:
https://github.com/zed-industries/zed/tree/tool-calls-in-google-ai I've
ran into issues with having the API digest our schema without tripping
over itself - the function call parameters are malformed and whatnot. We
can resume from that branch if needed.
- [x] Ollama
- [x] Cloud
- [ ] ~Copilot Chat (?)~

Release Notes:

- Added tool calling capabilities to OpenAI and Ollama models.
2024-08-06 15:45:47 +02:00
Kirill Bulatov
be514f23e1
Improve streaming git diffs to be less jumpy during inline assistant generation (#15853)
Release Notes:

- Improved streaming git diffs to be less jumpy during inline assistant
generation

---------

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2024-08-06 16:13:29 +03:00
Marshall Bowers
82310092a2
inline_completion_button: Do some cleanup (#15849)
This PR does some cleanup in the `inline_completion_button` after
#15443.

Release Notes:

- N/A
2024-08-06 08:55:27 -04:00
Kevin Wang
7cef5b2956
Add menu item to switch Supermaven and Copilot (#15443)
Adds a "Use Supermaven" and "Use Copilot" menu item to the signed out
menus for each of the autocomplete providers to make it easier to switch
between them without having to update your local settings json.

<img width="222" alt="image"
src="https://github.com/user-attachments/assets/6f760f4e-5527-4971-bdaf-383bc99649bd">

Release Notes:

- Added menu items to quickly switch between Supermaven and Copilot
inline completions when the provider is not configured
2024-08-06 13:54:30 +02:00
Konstantin Matsiushonak
f4a58e5411
typescript: Make it possible to use local vtsls (#15775)
Related things:
https://github.com/zed-industries/zed/issues/7902
https://github.com/zed-industries/zed/issues/4978

Release Notes:
- Added: positibily to use locally installed vtsls
2024-08-06 12:37:13 +02:00
Bennet Bo Fenner
d6e5265e84
assistant: Limit model access (#15820)
Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-06 12:19:19 +02:00
Bennet Bo Fenner
56abd68d0e
assistant: Cleanup model selector (#15843)
We changed the following for the model selector:
- Fixed displaying checkmarks for selected models when using models with
the same name from different providers
- We now show the icon for the active model instead of displaying the
provider name in the trigger of the model selector
- Only display the footer when the language models feature flag is zed,
so that we don't release the hint for Zed Pro to preview tomorrow

<img width="253" alt="image"
src="https://github.com/user-attachments/assets/f95ccfb6-c0cf-43d4-9637-e2823100a427">


Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-06 11:59:54 +02:00
Jaakko Sirén
fb1cd7cae2
blade: Update to pick up Intel memory coherency fix & fix calling blade params (#15829)
Builds on @kvark's PR https://github.com/zed-industries/zed/pull/15781
by fixing call to Blades `create_texture_view` the arguments of which
had changed.


Picks up https://github.com/kvark/blade/pull/153

Release Notes:

- Fixed Zed flickering on Linux when using Intel graphics.
([#14101](https://github.com/zed-industries/zed/issues/14101)).

---------

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-08-06 11:33:18 +02:00
Antonio Scandurra
44ae9efb27
Cancel workflow step automatically when moving outside <step> tag (#15842)
Also, open edit suggestions automatically as soon as the edit step is
resolved.

Release Notes:

- N/A
2024-08-06 11:30:09 +02:00
Luis Cossío
7b5fdcee7f
lsp: Support Goto Declaration (#15785)
Adds support for [Goto
Declaration](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_declaration)
LSP command.

I am particularly interested in [this for Rust
projects](https://rust-analyzer.github.io/manual.html#go-to-declaration),
to be able to navigate to the place where a trait method is declared,
coming from a trait method implementation.

I noticed this was something I could do in VSCode before, but was
somehow missing is Zed. Thanks to the already existing infrastructure
for Goto Definition, I just followed and copy-paste-adapted it for Goto
Declaration.

As a bonus, I added `ctrl-F12` and `alt-ctrl-F12` as default macOS
keybindings for `GoToDeclaration` and `GoToDeclarationSplit`,
respectively. They are not keybindings from another editor, but I
figured they made sense to be grouped along with the other *F12
commands.

### Release Notes:

- Added "Go to declaration" editor action.
- vim: Breaking change to keybindings after introduction of the `Go to
declaration` editor action. The new keybindings are the following (and
can be found [here](https://zed.dev/docs/vim), alongside the other key
bindings):
  - `g d` - Go to definition
  - `g D` - Go to declaration
  - `g y` - Go to type definition
  - `g I` - Go to implementation




https://github.com/user-attachments/assets/ee5c10a8-94f0-4e50-afbb-6f71db540c1b

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-08-06 11:20:51 +02:00
apricotbucket28
82db5dedfb
terminal: Fix context menu keybindings flicker (#15771)
Fixes https://github.com/zed-industries/zed/issues/15156


[Screencast_20240804_112659.webm](https://github.com/user-attachments/assets/d6d15e65-ece2-4342-b2ca-55e3737a4736)

Release Notes:

- N/A
2024-08-06 10:13:26 +02:00
Marshall Bowers
ca9511393b
collab: Add support for more providers to the LLM service (#15832)
This PR adds support for additional providers to the LLM service:

- OpenAI
- Google
- Custom Zed models (through Hugging Face)

Release Notes:

- N/A
2024-08-05 21:16:18 -04:00
Max Brunsfeld
8e9c2b1125
Introduce a separate backend service for LLM calls (#15831)
This PR introduces a separate backend service for making LLM calls.

It exposes an HTTP interface that can be called by Zed clients. To call
these endpoints, the client must provide a `Bearer` token. These tokens
are issued/refreshed by the collab service over RPC.

We're adding this in a backwards-compatible way. Right now the access
tokens can only be minted for Zed staff, and calling this separate LLM
service is behind the `llm-service` feature flag (which is not
automatically enabled for Zed staff).

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-05 20:26:21 -04:00
Marshall Bowers
4ed43e6e6f
collab: Ignore Stripe events that are older than an hour (#15830)
This PR makes it so any Stripe events we receive that occurred over an
hour ago are marked as processed.

We don't want to process an old event long after it occurred and
potentially overwrite more recent updates.

This also makes running collab locally a bit nicer, as we won't be
getting errors for a bunch of older events that will never get processed
successfully.

The period after time after which we consider an event "stale" can be
modified, as needed.

Release Notes:

- N/A
2024-08-05 17:15:38 -04:00
Kyle Kelley
f6a0fef5cf
repl: Address simple fixes (#15828)
Release Notes:

- Added logging in debug mode of raw kernel output from REPL.
- Fixed REPL kernels not being shut down completely on close of Editor
2024-08-05 13:48:15 -07:00
apricotbucket28
ab1fabef68
gpui: Align SVG sprites to whole pixels (#15822)
Related to https://github.com/zed-industries/zed/issues/12352 (and old
issue https://github.com/zed-industries/zed/issues/643)

This fixes visual glitches that could happen when rendering icons on
Linux and Windows (and in the Blade backend)


![image](https://github.com/user-attachments/assets/02646d1d-d35b-48be-89c9-189416510cf2)

![image](https://github.com/user-attachments/assets/ccf99867-25d2-40fb-8735-c540f8cf793a)

![image](https://github.com/user-attachments/assets/8d1124a3-669e-4be5-8b46-5dc2df14a28a)


Release Notes:

- Linux: Fixed visual glitches when rendering icons.
2024-08-05 12:43:23 -07:00
Max Brunsfeld
27779e33fb
Refactor: Restructure collab main function to prepare for new subcommand: serve llm (#15824)
This is just a refactor that we're landing ahead of any functional
changes to make sure we haven't broken anything.

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Jason <jason@zed.dev>
2024-08-05 12:07:38 -07:00
Marshall Bowers
705f7e7a03
collab: Include geoip_country_code in initial span (#15819)
This PR changes how we report the `geoip_country_code` in the tracing
spans.

I wasn't seeing it come through in the logs, and I think it was because
we didn't declare the field on the initial span.

Release Notes:

- N/A
2024-08-05 12:24:47 -04:00
Marshall Bowers
04ad088eb8
assistant: Remove old model selector code (#15817)
This PR removes the old model selector code, as it was no longer used
after #15693.

Release Notes:

- N/A
2024-08-05 12:19:16 -04:00
Nate Butler
03cc18dd20
assistant-panel: Update model selector to a combo-box (#15693)
This updates the model selector to be a combobox (filterable list)

This PR causes the following regression: There is no longer a message in
the inline assistant explaining context is included from the assistant
panel. Will follow up with some sort of solution soon.

Before:
![CleanShot 2024-08-02 at 13 11
12@2x](https://github.com/user-attachments/assets/648ec4e3-48bc-4720-aaad-7659d848a4fa)

After:
![CleanShot 2024-08-02 at 13 10
37@2x](https://github.com/user-attachments/assets/09de098b-1a4a-44be-a6ae-6879f233d9a4)
![CleanShot 2024-08-02 at 13 10
48@2x](https://github.com/user-attachments/assets/701ce01c-3d6c-4c63-a6fc-53deff5d56c7)

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2024-08-05 11:52:07 -04:00
Marshall Bowers
f11f3f2599
collab: Attach GeoIP country code to RPC sessions (#15814)
This PR updates collab to attach the user's GeoIP country code to their
RPC session.

We source the country code from the
[`CF-IPCountry`](https://developers.cloudflare.com/fundamentals/reference/http-request-headers/#cf-ipcountry)
header.

Release Notes:

- N/A
2024-08-05 11:11:49 -04:00
Bennet Bo Fenner
be0ccf47ee
assistant: Show error messages in popover notification (#15808)
<img width="644" alt="image"
src="https://github.com/user-attachments/assets/ee6f2e60-e50a-481e-98b4-6c4b72a9b882">


Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-05 17:11:42 +02:00
Thorsten Ball
294892c470
assist panel: Update Zed AI notice if provider changes (#15805)
Release Notes:

- N/A

---------

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-05 15:36:08 +02:00
Thorsten Ball
49d0672cdd
assistant panel: Fix wrong state for Zed.dev provider being shown (#15800)
Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-05 15:35:58 +02:00
Thorsten Ball
0d97b236e7
assistant panel: Make "Configure" button in menu open Configuration view (#15799)
Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-05 13:31:03 +02:00
Thorsten Ball
0fba36469b
assistant panel: Show Zed AI notice & configuration hint (#15798)
This adds two possible notices to the assistant panel:

- Shows notice if currently selected provider is not configured
- Shows notice if user is signed-out and (does not have provider OR
provider is zed.dev) and tells user to sign in

Design needs to be tweaked. cc @iamnbutler 

![screenshot-2024-08-05-13 11
21@2x](https://github.com/user-attachments/assets/ada2d881-2f81-49ed-bebf-2efbf06e7d82)


Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-05 13:21:16 +02:00
Bennet Bo Fenner
d9977718d2
assistant: Fix prompts not being editable (#15796)
Fixes a bug introduced in #15615, where prompts could not be edited in
the prompt library.
This PR fixes the behavior by only preventing users to edit built-in
prompts.

Release Notes:

- N/A
2024-08-05 12:52:58 +02:00
apricotbucket28
559ce87b4e
linux: Save opened workspace when closing last window (#15754)
Fixes https://github.com/zed-industries/zed/issues/15642
(also fixes a bug where replacing a workspace in the same window would
reopen the old project after closing with `CTRL + Q`)

Release Notes:

- Linux: Fixed last workspace not being restored on startup
([#15642](https://github.com/zed-industries/zed/issues/15642)).
- Fixed a bug where a closed workspace could be reopened on startup.
2024-08-05 09:54:02 +02:00
Antonio Scandurra
0ec29d6866
Restructure workflow step resolution and fix inserting newlines (#15720)
Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-08-05 09:18:06 +02:00
Kyle Kelley
f8234aec6a
repl: Add ctrl-alt-enter binding to run in place (#15743)
Release Notes:

- Added `ctrl-alt-enter` keybinding for `repl::RunInPlace`
(`ctrl-option-enter` on MacOS). Keeps your screen position and cursor in
place when running any block.
2024-08-03 10:27:05 -07:00
Kyle Kelley
b7eae7fbd9
repl: Render markdown output from kernels (#15742)
<img width="1268" alt="image"
src="https://github.com/user-attachments/assets/73e03a28-f5e3-4395-a58c-cabd07f57889">

Release Notes:

- Added markdown rendering for Jupyter/REPL outputs. Push Markdown from
Deno/Typescript with `Deno.jupyter.md` and in IPython use
`IPython.display.Markdown`.
2024-08-03 09:41:12 -07:00
Kyle Kelley
36b61a8b87
repl: Process display IDs for updatable displays (#15738)
Release Notes:

- Added `update_display_data` support for REPL.


https://github.com/user-attachments/assets/d618e457-e314-482e-954a-6384f185629a
2024-08-03 08:15:36 -07:00
Kyle Kelley
4528e9d582
repl: Create better terminal output for REPL stdio (#15715)
Rely on our implementation of a GPUI powered alacritty terminal to
render stdout & stderr from the repl.

Release Notes:

- Fixed ANSI escape code and carriage return handling in repl outputs
(https://github.com/zed-industries/zed/issues/15640,
https://github.com/zed-industries/zed/issues/14855)


https://github.com/user-attachments/assets/bd3f1584-863a-4afa-b60b-9d222a830ff8

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-08-03 05:48:16 -07:00
Kyle Kelley
b6a3556a32
repl: Rely on block decorations to size according to content (#15713)
We no longer have to use line height calculations now that
https://github.com/zed-industries/zed/pull/15536 is in. Blocks resize
according to their content. This fixes up some of the rendering issues
on plaintext outputs as well.

Release Notes:

- Fix repl plain text output wrapping around and covering editor text
(https://github.com/zed-industries/zed/issues/15491,
https://github.com/zed-industries/zed/issues/14855)
2024-08-02 19:15:15 -07:00
Marshall Bowers
5c54596027
theme: Use a non-transparent color for the fallback title_bar.inactive_background (#15709)
This PR changes the fallback color for the
`title_bar.inactive_background` theme property so that the title bar
doesn't just disappear when a theme doesn't have a value set.

You're welcome, @naomieow.

Release Notes:

- linux: Changed the fallback color of `title_bar.inactive_background`
to a non-transparent value.
2024-08-02 18:44:22 -04:00
Marshall Bowers
91bbf0efc4
assistant: Normalize line endings for prompts loaded from the prompt library (#15708)
This PR makes it so we normalize the line endings for prompts to LFs
(`\n`) when we load a prompt from the library.

In some cases, prompts could end up with CRLF (`\r\n`) line endings.
When these prompts were used with the `/prompt` slash command and
summarily run, the prompt text would be converted into a rope, causing
the line endings to be normalized to LFs.

However, this would happen _after_ the ranges for the
`SlashCommandOutputSection`s were computed based on the text that still
contained the CRLFs. This would then cause these ranges to be invalid
for the text with the normalized endings, resulting in a panic when
converting them to anchors.

Fixes https://github.com/zed-industries/zed/issues/15652.

Release Notes:

- N/A

Co-authored-by: Max <max@zed.dev>
2024-08-02 18:13:17 -04:00
Marshall Bowers
c6580da889
assistant: Don't unwrap built-in step resolution prompt (#15704)
This PR removes some `unwrap`s while loading the built-in step
resolution prompt.

While these `unwrap`s are safe today, they are relying on some implicit
contracts that might change in the future. We're using this in a context
where it's easy to propagate an error upwards, so we may as well avoid
the `unwrap`s entirely and use a `Result`.

Release Notes:

- N/A
2024-08-02 16:07:43 -04:00
Danilo Leal
24afe7c3f9
Change the terminal assistant settings icon (#15702)
Change the terminal assistant settings icon so its consistent with the one we're using on the inline assistant.

--- 

Release Notes:

- N/A
2024-08-02 16:52:00 -03:00
Marshall Bowers
d6e558e3c9
copilot: Colocate copilot_chat_config_path with the rest of the Copilot code (#15703)
This PR moves the `copilot_chat_config_path` out of `paths` and into
`copilot` with the rest of the Copilot code.

Since this doesn't actually return a Zed path, it doesn't belong in
`paths`.

Release Notes:

- N/A
2024-08-02 15:46:06 -04:00
Piotr Osiewicz
e2eb68abca
chore: Remove leftover code from #15646 (#15697)
Release Notes:

- N/A
2024-08-02 20:08:57 +02:00
Piotr Osiewicz
ad11d83724
Skip over folded regions when iterating over multibuffer chunks (#15646)
This commit weaves through new APIs for language::BufferChunks, multi_buffer::MultiBufferChunks and inlay_map::InlayChunks that allow seeking with an upper-bound. This allows us to omit doing syntax highligting and looking up diagnostics for folded ranges. This in turn directly improves performance of assistant panel with large contexts.

Release Notes:

- Fixed poor performance when editing in the assistant panel after
inserting large files using slash commands

---------

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2024-08-02 19:51:26 +02:00
Thorsten Ball
390815dd76
assistant panel: Tab-less configuration view (#15682)
TODOs for follow-up:
- [ ] When opening panel: nudge user to sign in if they're not signed-in
and have no provider configured (or if they're not signed-in and have
Zed AI configured)
- [ ] Configuration page is not scrollable
- [ ] Design tweaks

Current status:



https://github.com/user-attachments/assets/d26d65ea-43e8-481b-81a3-b3cba01704a8


Release Notes:

- N/A
2024-08-02 17:16:18 +02:00
Mayank Jikadara
61365e034f
Relax "test" runnable check (#15647)
This commit updates the Tree-sitter query to match Rust attributes
containing the word "test". The previous query only matched attributes
with the exact string "test", which was too restrictive for custom test
macros like https://docs.rs/test-log/0.2.10/test_log/#

Discussion - https://github.com/zed-industries/zed/discussions/15580
2024-08-02 15:22:01 +02:00
Antonio Scandurra
b88b9dcdd1
Extend symbol ranges by their annotation range when suggesting edits (#15677)
Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-08-02 11:40:29 +02:00
Thorsten Ball
e4608e7f12
assistant panel: Intermediate fix for focus problems (#15674)
This is an intermediate fix for the focus problems in the assistant
panel. Intermediate because I'm going to shred the whole
ConfigurationView now and replace the tabs inside with a list.


Release Notes:

- N/A
2024-08-02 11:05:30 +02:00
Nate Butler
b4dcd6d394
Update model selector (#15665)
Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-01 21:57:51 -04:00
Marshall Bowers
5e011ab029
language_model: Denote the availability of language models (#15660)
This PR updates the `LanguageModel` trait with a new method for denoting
the availability of a model.

Right now we have two variants:

- `Public` for models that have no additional restrictions (other than
their respective setup/authentication requirements)
- `RequiresPlan` for models that require a specific Zed plan

Release Notes:

- N/A
2024-08-01 18:26:27 -04:00
Marshall Bowers
771424e4f9
extension: Make worktree argument to run_slash_command optional (#15658)
This PR updates the extension API to make the `worktree` argument to
`run_slash_command` optional.

We may not always have a worktree, and not all slash commands need them,
so by making it optional we can allow individual slash commands to
decide what to do when there is no worktree.

Release Notes:

- N/A
2024-08-01 17:34:44 -04:00
Marshall Bowers
88f29c8355
assistant: Don't require a worktree to run slash commands (#15655)
This PR fixes an issue where slash commands were not able to run when
Zed did not have any worktrees opened.

This requirement was only necessary for slash commands originating from
extensions, and we can enforce the presence of a worktree just for
those:

<img width="378" alt="Screenshot 2024-08-01 at 5 01 58 PM"
src="https://github.com/user-attachments/assets/38bea947-e33b-4c64-853c-c1f36c63d779">

Release Notes:

- N/A
2024-08-01 17:14:13 -04:00
Antonio Scandurra
1fa4cc3c7a Use the right max_token_count for Qwen
Co-Authored-By: Nathan <nathan@zed.dev>
2024-08-01 22:42:10 +02:00
Nathan Sobo
1b85793ebc
Fix inline assist deletion blocks (#15651)
After the changes in #15536, block decorations need to be given an
explicit height if their content doesn't consume height on its own. We
missed that inline transformation deletion decorations didn't do this,
creating weird results. This fixes the issue and prevents block
decorations from ever having a zero height. That helps avoid major
weirdness, but this still a bit of a gotcha.

We need to back port this to Preview Channel (0.147.x)

Release Notes:

- N/A

---------

Co-authored-by: Antonio <antonio@zed.dev>
2024-08-01 22:41:25 +02:00
Marshall Bowers
0799dfb2b8
assistant: Only insert the host's default prompt when creating a new context (#15650)
This PR fixes an issue where creating a new context as a guest would
insert multiple default prompts: one for the host and one for the guest.

When creating a new context as a guest while collaborating, we should
only use the host's default prompt.

Release Notes:

- N/A
2024-08-01 16:28:45 -04:00
Antonio Scandurra
21816d1ff5
Add Qwen2-7B to the list of zed.dev models (#15649)
Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-08-01 22:26:07 +02:00
Marshall Bowers
60127f2a8d
Fix .env.toml paths (#15645)
This PR fixes the `.env.toml` paths, since we inadvertently broke them
in https://github.com/zed-industries/zed/pull/15557.

There's likely a better way we can do this, but I wanted to restore the
previous behavior, for now.

Release Notes:

- N/A
2024-08-01 15:43:29 -04:00
Marshall Bowers
4bfb8fda8d
Rename zed.dev/settings to zed.dev/account (#15636)
This PR renames the links to the `zed.dev/settings` page to the
`zed.dev/account`.

Some of these spots will likely link out to a marketing page later.

Release Notes:

- N/A
2024-08-01 13:59:21 -04:00
Marshall Bowers
7652045903
Remove primary/secondary distinction for CachedLspAdapter (#15634)
This PR removes the primary/secondary distinction for
`CachedLspAdapter`s.

After #15624 we weren't relying on the `is_primary` field anywhere, so
we can remove it.

Release Notes:

- N/A
2024-08-01 13:51:34 -04:00
Thorsten Ball
5afa799f37
assistant panel: Add button to open new context to configuration page (#15628)
This adds a button to the `Configuration` page for providers so it's
easy to start a new context _with the given provider_ selected.

![screenshot-2024-08-01-17 53
07@2x](https://github.com/user-attachments/assets/f25ecbe0-0b96-4a32-ac98-a5113b08ec2a)

Obviously not the most beautiful form this button can have, but works!

cc @iamnbutler 

Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-01 19:33:00 +02:00
Nate Butler
70b2da78f8
Update assistant config UI (#15630)
![CleanShot 2024-08-01 at 12 55
01@2x](https://github.com/user-attachments/assets/f9ed44ba-6bff-4805-ad71-2e3538315e57)

- Remove assisstant_description for now.
- Updates assistant config UI
- Updates Ollama and zed.dev provider UIs
- Updates download icon

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-01 13:30:35 -04:00
Marshall Bowers
3bd9a3f478
Respect the language_servers setting's order when determining the primary language server (#15624)
This PR updates how we determine the "primary" language server for a
buffer to make it respect the order specified by the `language_servers`
setting.

Previously we were relying on the language servers to be registered in
the right order in order to select the primary one effectively.

However, in my testing I observed some cases where a native language
server (e.g., `tailwindcss-language-server`) could end up first in the
list of language servers despite not being first in the
`language_servers` setting.

While this wasn't a problem for the Tailwind or ESLint language servers
on account of them being defined natively with the designation of
"secondary" language servers, this could cause problems with
extension-based language servers.

To remedy this, every time we start up language servers we reorder the
list of language servers for a given language to reflect the order in
the `language_servers` setting. This ordering then allows us to treat
the first language server in the list as the "primary" one.

Related issues:

- https://github.com/zed-industries/zed/issues/15023
- https://github.com/zed-industries/zed/issues/15279

Release Notes:

- The ordering of language servers will now respect the order in the
`language_servers` setting.
- The first language server in this list will be used as the primary
language server.
2024-08-01 11:58:23 -04:00
Antonio Scandurra
0b175ac66e
Give edit steps multibuffer a title (#15625)
Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
2024-08-01 17:48:56 +02:00
Thorsten Ball
ed7952f5ef
assistant panel: Update active tab in config panel when provider changes (#15621)
Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-01 17:24:55 +02:00
Thorsten Ball
6c83c7906a
assistant panel: Ensure always active tab is shown (#15618)
Small bug that snuck in with #15490. When closing the configuration tab
explicitly and then activating the assistant tab again, it wouldn't show
the configuration page.

Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-01 16:14:31 +02:00
Piotr Osiewicz
ac1a15f5d7
assistant: Report all worktree entries in /file completions (#15617)
We were reporting file count as worktree entry count, which led to us
missing some of the entries in /file command completion.

/cc @bennetbo

The other components that used `PathMatchCandidateSet` are
`/diagnostics` and file finder. File finder is unaffected, as it used
`Candidates::Files` - thus previously reported count was correct for it;
`/diagnostics` were using `::Entries` as well, so it could miss entries
just like `/files`.

Release Notes:

- Fixed /file and /diagnostics slash commands omitting entries in it's
completions menu.
2024-08-01 16:09:53 +02:00
Nathan Sobo
a9c6e435f7
Bundle editing workflow prompt as a read-only built-in prompt (#15615)
Built-in prompts can still be removed from the default prompt, but they
can't be edited and are automatically updated with new Zed releases.

Release Notes:

- N/A

---------

Co-authored-by: Antonio <antonio@zed.dev>
2024-08-01 15:56:17 +02:00
Bennet Bo Fenner
be3a8584ff
assistant: Add a Configuration page (#15490)
- [x] bug: setting a key doesn't update anything
- [x] show high-level text on configuration page to explain what it is
- [x] show "everything okay!" status when credentials are set
- [x] maybe: add "verify" button to check credentials
- [x] open configuration page when opening panel for first time and
nothing is configured
- [x] BUG: need to fix empty assistant panel if provider is `zed.dev`
but not logged in


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

Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
Co-authored-by: Nate Butler <iamnbutler@gmail.com>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-08-01 15:54:47 +02:00
Piotr Osiewicz
79213637e2
assistant: Display hamburger menu even when the panel is not focused (#15612)
This commit gives tab button renderers control over the condition in
which they should be displayed. Previously we displayed tab buttons only
when the pane was focused. Now tab renderers can return an Option of
AnyElement, which in turn makes it possible for them to control when and
how they're rendered. Pane and Terminal handlers still check for self
focus condition and Assistant Panel does not.



Release Notes:

- N/A
2024-08-01 15:08:48 +02:00
Antonio Scandurra
dc0f7436e0
Add support for backwards compatibility in PromptStore (#15602)
Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-08-01 15:07:14 +02:00
Ramkumar
04065d9a6a
Fix GitHub Copilot chat authentication on Windows (#15587)
This PR fixes Copilot chat authentication on Windows. GitHub Copilot
chat in assistant panel uses auth token file generated by [copilot
language server](https://github.com/zed-industries/copilot). The path to
authentication token file is platform dependent. On Windows, it happens
to be `~\AppData\Local\github-copilot\hosts.json`.

Release Notes:

- Fixed Copilot chat sign in issue on Windows ([#4673](https://github.com/zed-industries/zed/issues/4673))
2024-08-01 14:06:13 +03:00
Antonio Scandurra
1246010e44
Fix padding for end_hover_slot on ListItems (#15598)
Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
2024-08-01 12:10:45 +02:00
Kirill Bulatov
c98918aed8
Properly calculate y offsets for multi buffer context menus (#15594)
Follow-up of https://github.com/zed-industries/zed/pull/14727

Release Notes:

- Fixed multi buffer context menus not showing properly

Co-authored-by: Max Brunsfeld <max@zed.dev>
2024-08-01 12:35:46 +03:00
Marshall Bowers
218776a119
collab: Increase the frequency at which we poll for Stripe events (#15577)
This PR increases the frequency at which we poll for Stripe events.

This decreases the amount of time we have to wait in order for changes
in Stripe to be reflected in our system.

We now poll for events every 5 seconds, down from every 5 minutes.

In order to avoid needlessly over-fetching data from Stripe, we put a
cap on the number of pages consisting entirely of already-processed
events that we can see before stopping. This is set to 4, so once we've
seen 4 pages of processed events (400 events in total), we'll stop
fetching subsequent pages.

Release Notes:

- N/A
2024-07-31 19:33:41 -04:00
Danilo Leal
a6f73c10d1
Fix symlink icon in the project panel (#15537)
Closes https://github.com/zed-industries/zed/issues/15481

---

Release Notes:

- N/A
2024-07-31 18:58:07 -03:00
Danilo Leal
236e72df38
Fix editor & assistant panel toolbar height mismatch (#15552)
This PR ensures that the toolbar within the editor and the assistant
panel have the same height. I also pushed in some other tiny design
(spacing, really) tweaks. There's still a mismatch between the editor
toolbar and the assistant panel's history tab, but I'll try to tackle
this separately.

---

Release Notes:

- N/A
2024-07-31 18:57:55 -03:00
Marshall Bowers
0d9a6d246a
collab: Fix spelling of "cancellation" (#15569)
English is hard.

In US English the forms of "cancel" are as follows:

- `cancel`
- `cancels`
- `canceling`
- `canceled`
- `cancellation`

Note that `cancellation` _does_ use the double `l`, which all the rest
of the forms do not.

Release Notes:

- N/A
2024-07-31 17:36:26 -04:00
Marshall Bowers
2bc0a58f32
collab: Use the right zed.dev URL for the environment (#15566)
This PR updates collab to pick the `zed.dev` URL based on the current
environment rather than always using `https://zed.dev`.

This means that when developing locally we'll use
`http://localhost:3000` to be taken to the locally-running version of
`zed.dev`.

Release Notes:

- N/A
2024-07-31 17:08:29 -04:00
Max Brunsfeld
1b2d4ee132
Allow users to stop a previously scheduled cancelation of their Zed Pro plan (#15562)
Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-07-31 16:36:46 -04:00
Max Brunsfeld
3f1c091b87
Add the ability to store secret dev-only env vars in .env.secret.toml (#15557)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-07-31 12:41:09 -07:00
Max Brunsfeld
9751e61101
Show rate limit notices (#15515)
This UI change is behind a `ZedPro` feature flag so that it won't be
visible until we're ready to launch that service.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Marshall <marshall@zed.dev>
2024-07-31 12:05:19 -07:00
Marshall Bowers
8c54a46202
collab: Adapt rate limits based on plan (#15548)
This PR updates the rate limits to adapt based on the user's current
plan.

For the free plan rate limits I just took one-tenth of the existing rate
limits (which are now the Pro limits). We can adjust, as needed.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
2024-07-31 14:27:28 -04:00
Piotr Osiewicz
7a0149f17c
multi_buffer: Reuse buffer chunks iterator when seeking across folds within an excerpt (#15532)
Release Notes:

- N/A

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2024-07-31 10:29:15 -07:00
Joseph T Lyons
7259d092a7 v0.148.x dev 2024-07-31 12:17:58 -04:00
Antonio Scandurra
fef95110bb
If paths from edit steps omit worktree root, search worktrees for relative path (#15543)
Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-31 17:55:11 +02:00
Remco Smits
3c404dec92
Send pane removeItem event before removing the item (#15541)
This PR renames and added a new pane event to indicate the difference
between `removing` and `removed` event. This change is needed for the
debugger implementation, if you close a pane we have to send a
`terminateThread` request to the adapter because it's not supported to
reopen a pane. So when the pane is removing we have to know what thread
it is what is stored on the panel itself, so we have to be able to get
this information before the pane is actually removed.

So my idea how to fix this was by adding a new event called
`RemovedItem` which is a rename of `RemoveItem` which also makes a bit
more sense because the item is removed at that point. And seeing the
name `RemoveItem` does not really say that it's removed, more like we
are removing the item.

/cc @mikayla-maki

Release Notes:

- N/A
2024-07-31 08:48:19 -07:00
Antonio Scandurra
5b1ea7eda0
Clean up inline assist editor rendering (#15536)
Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Max <max@zed.dev>
2024-07-31 17:43:08 +02:00
Thorsten Ball
874fedd717
assistant panel: Fix panic when opening panel with zed.dev provider (#15538)
There was/is some race condition that gets triggered only with the
zed.dev provider when opening the provider that would cause a
double-borrow on workspace.

This PR fixes the issue by cloning the workspace weakly. Turns out we
can go very far with just the weak reference.

We're still a bit unsure why exactly the race condition happened, since
it's hard to reproduce, but we're working on configuration
view/management in #15490 anyway.

Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
2024-07-31 16:57:24 +02:00
Peter Tripp
64bfec533e
Revert terminal: Add Alt key bindings for terminal (#15535)
- reverts commit 66ada3e44c.
- change default `option_as_meta` to true
2024-07-31 10:54:58 -04:00
Kirill Bulatov
9384f665bb
Properly extract errors from the Anthropic API (#15534)
Before, we missed "successful" responses with the API errors, now they
are properly shown in the assistant panel.


![image](https://github.com/user-attachments/assets/0c0936af-86c2-4def-9a58-25d5e0912b97)


Release Notes:

- N/A
2024-07-31 16:31:11 +03:00
Bennet Bo Fenner
821ce2fc7c
assistant panel: Fix panel not reloading after entering credentials (#15531)
This is the revised version of #15527.

We also added new events to notify subscribers when new providers are
added or removed.

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

Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-07-31 14:12:17 +02:00
Kirill Bulatov
a31dba9fc1
Reflect token limit errors and warnings in the assistant panel Send button style (#15529)
When used token count is below 80%, the Send button is displayed as
usual: no tooltip, regular style:


![image](https://github.com/user-attachments/assets/06198869-c49e-4231-b0cb-53b8f678c547)

When it exceeds 80% but below the `max_tokens` threshold, the button
starts to show as a warning, with the corresponding tooltip:

![warning](https://github.com/user-attachments/assets/83b02059-9610-4af7-97c6-9bca14364511)

When it is over the `max_token` threshold, the button starts to show as
an error, with another tooltip:

![error](https://github.com/user-attachments/assets/380d426a-cda9-4479-83e0-e018771291b6)

The buttons are not blocked in any case, in case the token calculation
is wrong, to allow using the assistant panel nonetheless.


Release Notes:

- N/A
2024-07-31 14:37:39 +03:00
Bennet Bo Fenner
380a19fcf2
Revert "assistant panel: Fix entering credentials not updating view" (#15528)
Reverts zed-industries/zed#15527

We broke the assistant panel in the process...

Release Notes:

- N/A
2024-07-31 13:26:27 +02:00
Thorsten Ball
b571bc800d
assistant panel: Fix entering credentials not updating view (#15527)
Co-authored-by: Bennet <bennet@zed.dev>

Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
2024-07-31 12:51:41 +02:00
Thorsten Ball
c78ea0df7e
assistant panel: Ensure we prompt for creds when panel is activated (#15524)
Something seems to have broke on `main` in last few days.

Bug was reproducible like this:

- Open assistant panel
- Choose provider that wasn't authenticated
- See auth prompt
- Close the tab (!) in the assistant panel
- Reactivate the assistant panel
- Bug: panel is blank!

This fixes the bug by consolidating the behavior of checking credentials
and showing auth prompt.

Release Notes:

- N/A
2024-07-31 11:48:31 +02:00
Thorsten Ball
d8f7322725
assistant panel: Show provider name in model selector (#15523)
With zed.dev provider becoming more popular, it helps alleviate
confusion when showing not only the model name but also the provider
name.

Release Notes:

- N/A
2024-07-31 11:05:16 +02:00
apricotbucket28
8e6af73784
x11: Do not check hover state on properties change (#15518)
This fixes an issue where the window's hovered state would be incorrect,
causing the cursor not to update because it would think the window
wasn't hovered ([relevant
check](a03beeeb5b/crates/gpui/src/window.rs (L3016-L3017))).

The code here doesn't really seem to make sense, since there's already
the `XinputEnter` and `XinputLeave` events that indicate mouse focus
state on the window. The properties change event wouldn't necessarily
indicate when mouse focus changes.

Thanks @Emc2356 for reporting this on the Discord and helping figure out
the issue!
 
Release Notes:

- Linux: Fixed the cursor sometimes not changing on X11
2024-07-30 19:02:48 -07:00
Marshall Bowers
2b019ff9e2
collab: Add GET /billing/subscriptions endpoint (#15516)
This PR adds a new `GET /billing/subscriptions` endpoint to collab for
retrieving the subscriptions to display on the account settings page.

Release Notes:

- N/A
2024-07-30 21:17:35 -04:00
Marshall Bowers
a08e020e32
extension: Always use a real HTTP client in the ExtensionBuilder (#15514)
This PR makes it so we always construct a real HTTP client in the
`ExtensionBuilder`.

This used to be the case, but was inadvertently changed in
https://github.com/zed-industries/zed/pull/15470.

Release Notes:

- N/A
2024-07-30 18:04:53 -04:00
Marshall Bowers
a7ffc2b6f3
Show current plan in user menu (#15513)
This PR updates the user menu to show the user's current plan.

Also adds a new RPC message to send this information down to the client
when Zed starts.

This is behind a feature flag.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
2024-07-30 17:38:16 -04:00
Marshall Bowers
7c5f4b72fb
collab: Rework Stripe event processing (#15510)
This PR reworks how we process Stripe events for reconciliation
purposes.

The previous approach in #15480 turns out to not be workable, on account
of the Stripe event IDs not being strictly in order. This meant that we
couldn't reliably compare two arbitrary event IDs and determine which
one was more recent.

This new approach leans on the guidance that Stripe provides for
webhooks events:

> Webhook endpoints might occasionally receive the same event more than
once. You can guard against duplicated event receipts by logging the
[event IDs](https://docs.stripe.com/api/events/object#event_object-id)
you’ve processed, and then not processing already-logged events.
>
> https://docs.stripe.com/webhooks#handle-duplicate-events

We now record processed Stripe events in the `processed_stripe_events`
table and use this to filter out events that have already been
processed, so we do not process them again.

When retrieving events from the Stripe events API we now buffer the
unprocessed events so that we can sort them by their `created` timestamp
and process them in (roughly) the order they occurred.

Release Notes:

- N/A
2024-07-30 16:35:11 -04:00
Bennet Bo Fenner
dca9400edf
assistant: Ensure that zed provider is listed as first option (#15496)
Release Notes:

- N/A
2024-07-30 19:38:52 +02:00
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