Commit Graph

16832 Commits

Author SHA1 Message Date
Congyu
99d45ba694
Add socks proxy for client websocket connection (#16051)
Release Notes:

- Added socks proxy for client websocket connection
2024-08-22 14:52:18 -06:00
Vitor Ramos
f45af17fd4
Add option to pipe from stdin on cli (#16084)
Closes #5044

Release Notes:

- Linux: Added CLI pipe support.
2024-08-22 13:31:58 -06:00
Heewon Cho
e1b05bf7a3
Fix opening uncanonicalized hyperlink file from terminal (#16087)
Closes #11284

Release Notes:

- Fixed bug in opening uncanonicalized hyperlink file from terminal


https://github.com/user-attachments/assets/558725e0-6bf3-43cb-b833-161209360a4d
2024-08-22 13:23:44 -06:00
张小白
c0ea806afe
windows: Treat pwsh as PowerShell (#16409)
`pwsh` is the newer version of `PowerShell`, while the one that comes
pre-installed on Windows is called `Windows PowerShell` and is an older
version. I have no idea why Microsoft dose this and not updated the
`Windows Powershell` on Windows.

Release Notes:

- N/A
2024-08-22 13:05:00 -06:00
Cherry
e1c42a5c85
fs: Fix atomic_write failing on windows if destination is in different drive than the temp dir (#16648)
I have my system temp dir on a different drive than the default, so this
error was spammed in the logs. This also broke Zed in many ways, one of
which was the AI system failing to work since it couldn't save settings.
```
2024-08-20T22:39:54.0660708-07:00 [ERROR] Failed to write settings to file "\\\\?\\C:\\Users\\myuser\\AppData\\Roaming\\Zed\\settings.json"
Caused by:

0: failed to persist temporary file: The system cannot move the file to a different disk drive. (os error 17)

1: The system cannot move the file to a different disk drive. (os error 17)
```

Note: This problem is probably present on MacOS due to the requirement
of the underlying api being used. I do not have Mac, so I cannot test
this. This PR only solves this issue on Windows.

Closes #16571

Release Notes:

- fix atomic_write failing on windows if destination is on a different
drive than the OS's temp dir.
2024-08-22 12:59:00 -06:00
bestgopher
e17a5c1412
Fix log timestamps not using local timezone (#16400)
Get time offset by time crate will fail if there are mutli threads. So
call `config_builder.set_time_offset_to_local()` is useless.

Closes #16397

after:
<img width="664" alt="image"
src="https://github.com/user-attachments/assets/2b15fa06-c411-44f9-9ea1-871d25eb577f">

Release Notes:

- Fixed Local Timezone not showing Zed.log
2024-08-22 12:56:49 -06:00
0x2CA
abb5800d20
Add bounded soft wrap (#16586)
Closes #14700 #8164

Release Notes:

- Added `soft_wrap` value `bounded`,EditorWidth and PreferredLineLength
min value

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-08-22 12:51:32 -06:00
Conrad Irwin
c697eaba82
Use split direction preferences more (#16679)
Use new split direction preferences in more places (#16345)

Release Notes:

- N/A
2024-08-22 11:13:33 -06:00
Marshall Bowers
93642c9c51
Pass through Anthropic cache configuration when using Zed provider (#16685)
This PR makes it so the model's cache configuration gets passed through
from the base model when using the Zed provider.

Release Notes:

- Fixed caching for Anthropic models when using the Zed provider.
2024-08-22 12:48:47 -04:00
Piotr Osiewicz
182b7af299
ui: Use popover menus for tab bar in panes (#16497)
Closes #ISSUE

Release Notes:

- N/A
2024-08-22 18:05:23 +02:00
Kirill Bulatov
72b5cda356
Deduplicate /tab all buffers inserted (#16681)
Closes https://github.com/zed-industries/zed/issues/16678

Release Notes:

- Fixed `/tab all` inserting duplicate buffers
([!16678](https://github.com/zed-industries/zed/issues/16678))
2024-08-22 19:04:03 +03:00
Jeroen van Baarsen
3a593fe803
Add option to set split direction (#16345)
This adds an option to set the split direction for both the horizontal
splits, and the vertical splits.

A couple of things to look for when reviewing:

* The `derive` keywords on the Enums were copy pasted, no clue what they
should be
* Tried adding tests for this, but got stuck.

Co-authored with @Tobbe

Fixes: https://github.com/zed-industries/zed/issues/11342
2024-08-22 08:53:43 -06:00
Jonathan Dickinson
278864e19f
lsp_log: Show messages before init and add filtering (#15893)
Allows language server logs to be published prior to the completion of
the initialize request. OmniSharp is one example of an LSP that
publishes (many) messages prior to the initialization response, and this
completely floods the Zed logs.

Also adds level filtering as demonstrated below. Again, this is due to
my experience with the massive amount of log messages that OmniSharp
publishes.

Release Notes:

- Added level filtering to language server logs

![Log Level
Filtering](https://github.com/user-attachments/assets/e3fcb7af-28cb-4787-9068-8e5e7eb3cf7d)

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-08-22 16:47:34 +02:00
Tau Gärtli
9245015d1a
terminal: Retain relative order of responses (#16456)
Partially addresses #8497 (namely, the occurring with `delta`)

As I mentioned in
https://github.com/zed-industries/zed/issues/8497#issuecomment-2226896371,
zed currently replies to OSC color requests (`OSC 10`, `OSC 11`, ...)
out of order when immediately followed by another request (for example
`CSI c`). All other terminals that [I have
tested](https://github.com/bash/terminal-colorsaurus/blob/main/doc/terminal-survey.md)
maintain relative order when replying to requests.

## Solution
Respond to the `ColorRequest` in `process_event` (in the same place
where other PTY writes happen) instead of queuing it up in the internal
event queue.

## Alternative
I initially thought that I could handle the color request similarly to
the `TextAreaSizeRequest` where the size is stored in `last_content` and
updated on `sync`. However this causes the terminal to report
out-of-date values when a "set color" sequence is followed by a color
request.

## Tests

1. `OSC 11; ?` (request bg color) + `CSI c` (request device attributes):
   ```shell
   printf '\e]11;?\e\\ \e[c' && cat -v
   # Expected result: ^[]11;rgb:dcdc/dcdc/dddd^[\^[[?6c
# Current result: ^[[?6c^[]11;rgb:dcdc/dcdc/dddd^[\ ()
# Result with this PR: ^[]11;rgb:dcdc/dcdc/dddd^[\^[[?6c ()
# Result with alternative: ^[]11;rgb:dcdc/dcdc/dddd^[\^[[?6c ()
   ```
2. `OSC 11; rgb:f0f0/f0f0/f0f0` (set bg color) + `OSC 11; ?` (request bg
color)
   ```shell
   printf '\e]11;rgb:f0f0/f0f0/f0f0\e\\ \e]11;?\e\\' && cat -v
   # Expected result: ^[]11;rgb:f0f0/f0f0/f0f0^[\
# Current result: ^[]11;rgb:f0f0/f0f0/f0f0^[\ ()
# Result with this PR: ^[]11;rgb:f0f0/f0f0/f0f0^[\ ()
# Result with alternative: ^[]11;rgb:OUT_OF_DATE_COLOR_HERE^[\ ()
   ```

Release Notes:

- N/A
2024-08-22 16:19:24 +02:00
Kajus
b7a66e4491
project_panel: Allow copying the paths of multiple selected files at once (#16558)
Closes #16555 

Release Notes:

- Improved the "Copy Path" and "Copy Relative Path" actions in the
project panel's context menu when selecting multiple files. All selected
files' paths will now be copied, separated by newlines.
2024-08-22 16:05:01 +02:00
Kirill Bulatov
6b9fa68dc5
Force Vue and Svelte language servers to be the first in the list for their languages (#16654)
Follow-up of https://github.com/zed-industries/zed/pull/15624

Fixes https://github.com/zed-industries/zed/issues/13769
Fixes https://github.com/zed-industries/zed/issues/16469

This way, those are considered "primary" and serve all LSP requests like
go to definition. Before, Tailwind language server was first and
returned nothing for all LSP requests.

- Fixed Vue and Svelte languages integrations not handling LSP requests
properly ([#13769](https://github.com/zed-industries/zed/issues/13769))
([#16469](https://github.com/zed-industries/zed/issues/16469))
2024-08-22 15:36:31 +03:00
Thorsten Ball
db0c1fd592
vim: Add 'gf' command, make files cmd-clickable (#16534)
Release Notes:

- vim: Added `gf` command to open files under the cursor.
- Filenames can now be `cmd`/`ctrl`-clicked, which opens them.

TODOs:

- [x] `main_test.go` <-- works
- [x] `./my-pkg/my_pkg.go` <-- works
- [x] `../go.mod` <-- works
- [x] `my-pkg/my_pkg.go` <-- works
- [x] `my-pkg/subpkg/subpkg_test.go` <-- works
- [x] `file\ with\ space\ in\ it.txt` <-- works
- [x] `"file\ with\ space\ in\ it.txt"` <-- works
- [x] `"main_test.go"` <-- works
- [x] `/Users/thorstenball/.vimrc` <-- works, but only locally
- [x] `~/.vimrc` <--works, but only locally
- [x] Get it working over collab
- [x] Get hover links working

Demo:



https://github.com/user-attachments/assets/26af7f3b-c392-4aaf-849a-95d6c3b00067

Collab demo:




https://github.com/user-attachments/assets/272598bd-0e82-4556-8f9c-ba53d3a95682
2024-08-22 14:27:11 +02:00
Conrad Irwin
eb9eae09b1
Fix manual copilot with show_inline_completions: false (#16621)
For @mre and friends!

Release Notes:

- Fixed manually trigging completions when `show_inline_completions:
false`
2024-08-21 20:27:19 -06:00
Peter Tripp
136f75ee9a
docs: Update telemetry documentation (#16628)
- Add references to locations in code for Metrics and Panic telemetry
- Remove outdated documentation (ClickhouseEvent,
ClickhouseEventWrapper, ClickhouseEventRequestBody)
- Migrate struct documentation from web docs to inline doc comments on
struct members.
2024-08-21 20:24:35 -04:00
Marshall Bowers
1d986b0c77
collab: Report active user counts separately, as well (#16629)
This PR adds additional reporting of the active user counts as separate
logs.

We were already reporting these on individual rate limit events/logs,
but it seems like something that would be good to report on independent
of user activity.

Release Notes:

- N/A
2024-08-21 18:15:15 -04:00
Cherry
feab1261c8
Fix some typos (#16623)
This PR fixes some typos I found in the source code.

Release Notes:

- N/A
2024-08-21 17:33:19 -04:00
Michael Angerman
406d3b413d
gpui: Remove extra "which" in comment (#16620)
Fix a typo in the comment...

Release Notes:

- N/A
2024-08-21 17:24:38 -04:00
Marshall Bowers
0229d3ccac
collab: Track active user counts independently for each model (#16624)
This PR fixes an issue where the active user count spanned individual
models.

We now track the active user counts on a per-model basis.

Release Notes:

- N/A
2024-08-21 17:19:47 -04:00
Thorben Kröger
f85ca387a7
clangd: Implement switch source/header extension (#14646)
Release Notes:

- Added switch source/header action for clangd language server (fixes
[#12801](https://github.com/zed-industries/zed/issues/12801)).

Note: I'm new to both rust and this codebase. I started my
implementation by copying how rust analyzer's "expand macro" LSP
extension is implemented. I don't yet understand some of the code I
copied (mostly the way to get the `server_to_query` in `clangd_ext.rs`
and the whole proto implementation).

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2024-08-21 22:15:08 +03:00
Marshall Bowers
96bcceed40
collab: Add traces for user LLM rate limits (#16610)
This PR adds traces for when users hit LLM rate limits.

We were already emitting telemetry events for these to Clickhouse, but
it will be handy to have them available in Axiom as well.

Release Notes:

- N/A
2024-08-21 15:13:55 -04:00
Kyle Kelley
2ad9a742dd
repl: Add restart kernel action and improve shutdown (#16609)
- Implement restart kernel functionality
- Clean up shutdown process to properly drop messaging and exit status
tasks
- Refactor kernel state handling for better consistency

Closes #16037

Release Notes:

- repl: Added restart kernel action
- repl: Fixed issue with shutting down kernels that are in a failure
state
2024-08-21 11:51:58 -07:00
Ikko Eltociear Ashimine
9f0438b540
gpui: Remove extra "the" in comment (#16608)
Release Notes:

- N/A
2024-08-21 14:07:51 -04:00
Marshall Bowers
d274be67d6 Mark the user-backfiller secret as optional 2024-08-21 13:25:05 -04:00
Marshall Bowers
19f0c4af6d
collab: Update user backfiller to be mindful of GitHub rate limits (#16602)
This PR updates the user backfiller to be mindful of GitHub rate limits
and back off when rate-limited.

Release Notes:

- N/A
2024-08-21 13:23:24 -04:00
Conrad Irwin
09c698d8d7
Fix a panic when diagnostics contain multiple links (#16601)
Follow up from #14518

Release Notes:

- Fixed a panic when diagnostics contain multiple links
2024-08-21 11:18:43 -06:00
Marshall Bowers
8a5fcc2c22
collab: Backfill github_user_created_at on users (#16600)
This PR adds a backfiller to backfill the `github_user_created_at`
column on users.

Release Notes:

- N/A
2024-08-21 12:38:51 -04:00
Thorsten Ball
28568429aa
collab panel: Unfocus filter editor on escape (#16579)
This has been bugging me for a while, because it meant I was stuck in
the collab panel when I accidentally navigated there via keyboard
shortcuts.

Now I can press esc and get out of that state.

Release Notes:

- Fixed `esc` not removing focus from the filter editor in the
collaboration panel.

### Before


https://github.com/user-attachments/assets/3bebac03-0e6a-49b0-9823-d9f3190aa5d2


### After


https://github.com/user-attachments/assets/d04c309d-9d1c-44b6-abd3-d48f55207e31
2024-08-21 09:38:12 +02:00
邻二氮杂菲
f1778dd9de
Add max_output_tokens to OpenAI models and integrate into requests (#16381)
### Pull Request Title
Introduce `max_output_tokens` Field for OpenAI Models


https://platform.deepseek.com/api-docs/news/news0725/#4-8k-max_tokens-betarelease-longer-possibilities

### Description
This commit introduces a new field `max_output_tokens` to the OpenAI
models, which allows specifying the maximum number of tokens that can be
generated in the output. This field is now integrated into the request
handling across multiple crates, ensuring that the output token limit is
respected during language model completions.

Changes include:
- Adding `max_output_tokens` to the `Custom` variant of the
`open_ai::Model` enum.
- Updating the `into_open_ai` method in `LanguageModelRequest` to accept
and use `max_output_tokens`.
- Modifying the `OpenAiLanguageModel` and `CloudLanguageModel`
implementations to pass `max_output_tokens` when converting requests.
- Ensuring that the `max_output_tokens` field is correctly serialized
and deserialized in relevant structures.

This enhancement provides more control over the output length of OpenAI
model responses, improving the flexibility and accuracy of language
model interactions.

### Changes
- Added `max_output_tokens` to the `Custom` variant of the
`open_ai::Model` enum.
- Updated the `into_open_ai` method in `LanguageModelRequest` to accept
and use `max_output_tokens`.
- Modified the `OpenAiLanguageModel` and `CloudLanguageModel`
implementations to pass `max_output_tokens` when converting requests.
- Ensured that the `max_output_tokens` field is correctly serialized and
deserialized in relevant structures.

### Related Issue
https://github.com/zed-industries/zed/pull/16358

### Screenshots / Media
N/A

### Checklist
- [x] Code compiles correctly.
- [x] All tests pass.
- [ ] Documentation has been updated accordingly.
- [ ] Additional tests have been added to cover new functionality.
- [ ] Relevant documentation has been updated or added.

### Release Notes

- Added `max_output_tokens` field to OpenAI models for controlling
output token length.
2024-08-21 00:39:10 -04:00
Conrad Irwin
36d51fe4a5
vim: Improve lifecycle (#16477)
Closes #13579

A major painpoint in the Vim crate has been life-cycle management. We
used to have one global Vim instance that tried to track per-editor
state; this led to a number of subtle issues (e.g. #13579, the mode
indicator being global, and quick toggling between windows letting vim
mode's notion of the active editor get out of sync).

This PR changes the internal structure of the code so that there is now
one `Vim` instance per `Editor` (stored as an `Addon`); and the global
stuff is separated out. This fixes the above problems, and tidies up a
bunch of the mess in the codebase.

Release Notes:

* vim: Fixed accidental visual mode in project search and go to
references
([#13579](https://github.com/zed-industries/zed/issues/13579)).
2024-08-20 20:48:50 -06:00
Eli Perkins
a1438a49df
project_panel: Set scrollbar track background from theme (#16546)
This was previously using the value for the scrollbar border, instead of
the background.

I noticed this while trying out a new Zed theme.

Release Notes:

- Updated project panel scrollbar to respect the
`scrollbar.track.background` from the theme.

| Before | After |
| --- | ---- |
| <img width="281" alt="Screenshot 2024-08-20 at 2 46 23 PM"
src="https://github.com/user-attachments/assets/46d48e75-f472-4060-bcd7-9c2f7d97963d">
| <img width="280" alt="Screenshot 2024-08-20 at 2 46 37 PM"
src="https://github.com/user-attachments/assets/081038a4-4337-4c9f-9a95-93497003fb56">
|
2024-08-20 17:11:07 -04:00
Sinan Gençoğlu
ff7017c308
Replace lazy_static with std::sync::LazyLock (#16066)
Closes #15860 

Since rust std now supports LazyLock replacing lazy_static with it
reduce the external dependency.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-20 14:27:33 -04:00
Marshall Bowers
8381b06d2d
gpui: Fix "cursor" typos (#16536)
This PR fixes some typos of the word "cursor" in `gpui`.

Release Notes:

- N/A
2024-08-20 13:49:15 -04:00
Matthew D. Scholefield
5c0d800b21
Make unnecessary code fade configurable (#14442)
This PR allows configuring the intensity of code fade applied to unused
code (relates to #4785).

_Note: Right now I included it as a top level config which might be a
little out of place (but is easiest to instrument). Open for suggestions
on where else it would be better suited for._

_Note 2: I am unfamiliar with the codebase. Feel free to either close
this PR and re-implement in a better way or suggest high level changes
if I'm approaching anything wrong :)._

Release Notes:

- Added `unnecesary_code_fade` setting to control how strongly to fade
unused code.

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-20 13:13:27 -04:00
Suhun Han
b67404323c
workspace: Improve error handling when dropping a file that cannot be opened into the workspace pane (#15613)
This PR can improve the UX when dropping a file that cannot be opened
into the workspace pane. Previously, nothing happened without any
messages when such error occurred, which could be awkward for users.
Additionally the pane was being split even though the file failed to
open.

Here's a screen recording demonstrating the previous/updated behavior:


https://github.com/user-attachments/assets/cfdf3488-9464-4568-b16a-9b87718bd729

Changes:

- It now displays an error message if a file cannot be opened.
- Updated the logic to first try to open the file. The pane splits only
if the file opening process is successful.

Release Notes:

- Improved error handling when opening files in the workspace pane. An
error message will now be displayed if the file cannot be opened.
- Fixed an issue where unnecessary pane splitting occurred when a file
fails to open.
2024-08-20 15:05:59 +02:00
Kirill Bulatov
e482fcde5b
Fall back to FindAllReferences if GoToDefinition have not navigated (#16512)
Follow-up of https://github.com/zed-industries/zed/pull/9243 

Release Notes:

- N/A

---------

Co-authored-by: Alex Kladov <aleksey.kladov@gmail.com>
2024-08-20 14:56:19 +03:00
Marshall Bowers
395a68133d
Add Postgrest to Docker Compose (#16498)
This PR adds two Postgrest containers—one for the app database and one
for the LLM database—to the Docker Compose cluster.

Also fixed an issue where `postgres_app.conf` and `postgres_llm.conf`
had been switched.

Release Notes:

- N/A
2024-08-19 20:50:45 -04:00
Marshall Bowers
f7f7cd5bb9
repl: Don't prefix free variables with _ (#16494)
This PR is a small refactor to remove the leading `_` for some free
variables, as this unintentionally marks them as unused to the compiler.

While the fields on the struct _are_ unused, the free variables should
participate in usage tracking, as we want to make sure they get stored
on the struct.

Release Notes:

- N/A
2024-08-19 19:15:27 -04:00
Bennet Bo Fenner
6f5674691c
assistant: Set default provider to zed.dev (#16454)
Do NOT merge until tomorrow

Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-19 19:00:38 -04:00
Joseph T Lyons
9f66f12f7b v0.151.x dev 2024-08-19 18:40:19 -04:00
Max Brunsfeld
30bfa56a24
Avoid double message header in new contexts, don't expand default prompt (#16490)
Follow-up to https://github.com/zed-industries/zed/pull/16471

* Don't expand the default prompt by default, since it looks strange in
the expanded state
* Don't create two `You` headers by default. Just insert a blank line
after the default prompt.

Release Notes:

- N/A
2024-08-19 12:54:03 -07:00
Roy Williams
0042c24d3c
Simplify logic & add UI affordances to show model cache status (#16395)
Release Notes:

- Adds UI affordances to the assistant panel to show which messages have
been cached
- Migrate cache invalidation to be based on `has_edits_since_in_range`
to be smarter and more selective about when to invalidate the cache and
when to fetch.

<img width="310" alt="Screenshot 2024-08-16 at 11 19 23 PM"
src="https://github.com/user-attachments/assets/4ee2d111-2f55-4b0e-b944-50c4f78afc42">

<img width="580" alt="Screenshot 2024-08-18 at 10 05 16 PM"
src="https://github.com/user-attachments/assets/17630a60-7b78-421c-ae39-425246638a12">


I had originally added the lightening bolt on every message and only
added the tooltip warning about editing prior messages on the first
anchor, but thought it looked too busy, so I settled on just annotating
the last anchor.
2024-08-19 12:06:14 -07:00
Max Brunsfeld
b5bd8a5c5d
Add logic for closed beta LLM models (#16482)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-19 11:09:52 -07:00
Nate Butler
41fc6d0885
Make providers more clear in model selector (#16480)
Make providers more clear in model selector

Before:

![CleanShot 2024-08-19 at 13 20
36@2x](https://github.com/user-attachments/assets/5b43fa27-4aca-446a-a035-bc8bcb0d9b0e)

After:

![CleanShot 2024-08-19 at 13 20
05@2x](https://github.com/user-attachments/assets/cb961405-b573-42fe-80e1-f3c2ce828ea4)


Release Notes:

- N/A
2024-08-19 13:38:19 -04:00
Bennet Bo Fenner
90897707c3
assistant: Add imports in a single area when using workflows (#16355)
Co-Authored-by: Kirill <kirill@zed.dev>

Release Notes:

- N/A

---------

Co-authored-by: Kirill <kirill@zed.dev>
Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-19 19:01:45 +02:00
Piotr Osiewicz
7fbea39566
ui: Dismiss popovers when clicking on trigger button (#16476)
Release Notes:

- Clicking on an already-deployed popover menu trigger now hides the
popover menu.
2024-08-19 18:48:57 +02:00