Commit graph

22656 commits

Author SHA1 Message Date
Marshall Bowers
d316577fd5
collab: Add billing preferences for maximum LLM monthly spend (#18948)
This PR adds a new `billing_preferences` table.

Right now there is a single preference: the maximum monthly spend for
LLM usage.

Release Notes:

- N/A

---------

Co-authored-by: Richard <richard@zed.dev>
2024-10-09 16:29:07 -04:00
Kirill Bulatov
711180981b
Tone down model summarization logs (#18943)
Release Notes:

- N/A
2024-10-09 22:39:54 +03:00
Kirill Bulatov
49c75eb062
Rework remote task synchronization (#18746)
Reworks the way tasks are stored, accessed and synchronized in the
`project`.
Now both collab and ssh remote projects use the same TaskStorage kind to
get the task context from the remote host, and worktree task templates
are synchronized along with other worktree settings.

Release Notes:

- Adds ssh support to tasks, improves collab-remote projects' tasks sync
2024-10-09 22:28:42 +03:00
Marshall Bowers
f1053ff525
collab: Clarify naming around free tier spending limits (#18936)
This PR renames the `MONTHLY_SPENDING_LIMIT` constant to
`FREE_TIER_MONTHLY_SPENDING_LIMIT` to clarify it.

This will help distinguish it from the user's specified limit on their
paid monthly spending.

Release Notes:

- N/A
2024-10-09 15:05:53 -04:00
Marshall Bowers
817a41c4dc
collab: Add a Cents type (#18935)
This PR adds a new `Cents` type that can be used to represent a monetary
value in cents.

This cuts down on the primitive obsession we were using when dealing
with money in the billing code.

Release Notes:

- N/A
2024-10-09 14:22:32 -04:00
Peter Tripp
bc23d1e666
docs: Add gopls install instructions (#18919) 2024-10-09 14:05:35 -04:00
Thorsten Ball
bc4abd2b29
ssh session: Fix hang when doing state update in reconnect (#18934)
This snuck in last-minute.

Release Notes:

- Fixed a potential hang and panic when an SSH project goes through a
slow reconnect.
2024-10-09 19:40:09 +02:00
Ömer Sinan Ağacan
71f4ca67c2
Use WHOLE_WORD search option in vim mode's whole-word search (#18725)
Instead of wrapping the search term with `\<...\>`, enable the
`WHOLE_WORD` search option.

The advantage of the search option is that it can be toggled with one
click/key press (alt+w by default), and it doesn't require regex mode.

Release Notes:

- Vim mode's whole word search now uses the search bar's "Match whole
words" option, instead of wrapping the search term with `\<...\>`. This
allows easier toggling of whole-word search, and it also works without
enabling the regex mode.
2024-10-09 19:26:28 +02:00
狐狸
f05b440572
Improve syntax highlights (#18728)
Closes #18722

- Replace the `@escape` capture name with `@string.escape` for escape
sequences in Go, Python, Regex, Racket, Ruby, and Scheme.
- Rust
  - Add syntax highlighting for escape sequences. Close #18722
- Fix the issue where `@punctuation.delimiter` is being overwritten by
`@operator`.
  - Add the period (".") to `@punctuation.delimiter`.

Release Notes:

- N/A
2024-10-09 19:25:46 +02:00
Joseph T. Lyons
1cbaca667f
Remove historical_event column in editor events (#18932)
We have a lot of data in Clickhouse. This column was used when migrating
the events dataset between analytics databases and has no purpose today.

Naive maths: 257,170,993 editor event rows * 1 byte per boolean =
257,170,993 bytes, or ~0.24 GB

I'll drop the column after deploying a new collab.

Going forward, I'd like to remove more data that we never touch, to try
to keep things more focused. We should discuss some TTL at some point.

Release Notes:

- N/A
2024-10-09 13:19:13 -04:00
Kirill Bulatov
8911fd46e1
Do not log errors when no worktree is found for certain assistant panel editors (#18923)
Nothing in the assistant panel needs LSP so far, so the errors are not
useful.

Release Notes:

- N/A
2024-10-09 18:45:22 +03:00
Joseph T Lyons
926e54bd4a v0.158.x dev 2024-10-09 11:32:34 -04:00
Kirill Bulatov
b6ba4fcc51 Silence the logs 2024-10-09 18:16:22 +03:00
Thorsten Ball
b703514d0e
project: Observe SshRemoteClient to get notified about state changes (#18918)
Release Notes:

- N/A
2024-10-09 17:13:43 +02:00
Thorsten Ball
c674d73734
remote server: Do not spawn server when proxy reconnects (#18864)
This ensures that we only ever reconnect to a running server and not
spawn a new server with no state.

This avoids the problem of the server process crashing, `proxy`
reconnecting, starting a new server, and the user getting errors like
"unknown buffer id: ...".

Release Notes:

- N/A

---------

Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
2024-10-09 16:51:12 +02:00
Adam Wolff
dbf986d37a
telemetry: Refactor telemetry request into separate method (#18890)
Refactor telemetry request into separate method to make it easier to
override in a fork.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-10-09 10:47:59 -04:00
Kirill Bulatov
a62a2fa8f7
Always wait for completion resolve before applying the completion edits (#18907)
After https://github.com/rust-lang/rust-analyzer/pull/18167 and certain
people who type and complete rapidly, it turned out that we have not
waited for `completionItem/resolve` to finish before applying the
completion results.

Release Notes:

- Fixed completion items applied improperly on fast typing
2024-10-09 17:18:20 +03:00
Piotr Osiewicz
f50bca7630
ssh: Improve dismissal behaviour (#18900)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
Do not always close current window in SshConnectionModal; only do so
when the window was spawned from ssh modal. Assign unique IDs to "Open
folder" buttons

Closes #ISSUE

Release Notes:

- N/A
2024-10-09 12:22:53 +02:00
Thorsten Ball
9c54bd1bd4
macOS: Drop input handler to avoid editor/project not being dropped (#18898)
This fixes the problem of a `Project` sometimes not being dropped when
closing the single, last window of Zed.

Turns out, it wasn't get dropped for the following reason:

1. `editor::Editor` held a reference to project
2. The macOS `input_handler` on the `Window` held a reference to that
`Editor`
3. The AppKit window (and its input handler) get dropped asynchronously
(in the code in this diff), after the window is closed.
4. After the window is closed and no `cx.update()` calls are made
anymore, `flush_effects` is not called anymore.
5. But `flush_effects` is where we dropped entities that don't have any
more references.

In short: we dropped `Editor`, which held a reference to `Project`, out
of band, `flush_effects` wasn't called anymore, and thus the `Project`
wasn't dropped.

cc @ConradIrwin @bennetbo since we talked about this.

Release Notes:

- N/A

Co-authored-by: Antonio <antonio@zed.dev>
2024-10-09 10:45:35 +02:00
Mikayla Maki
5d5c4b6677
Revert http client changes (#18892)
These proved to be too unstable. Will restore these changes once the issues have been fixed.

Release Notes:

- N/A
2024-10-09 01:07:18 -07:00
Max Brunsfeld
e351148152
Fix bugs in expanding diff hunk (#18885)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
Release Notes:

- Fixed an issue where diff hunks at the boundaries of multi buffer
excerpts could not be expanded
2024-10-08 17:30:42 -07:00
Marshall Bowers
b0a9005163
client: Send telemetry events with Content-Type: application/json (#18886)
This PR updates the telemetry events sent to collab to use
`Content-Type: application/json` instead of `Content-Type: text/plain`.

The POST bodies are JSON, so `application/json` is the correct MIME
type.

I suspect the `text/plain` is a remnant from when the events were still
going through Vercel.

Release Notes:

- N/A
2024-10-08 20:25:07 -04:00
Marshall Bowers
801210cd50
collab: Make github_user_login required in LlmTokenClaims (#18882)
This PR makes the `github_user_login` field required in the
`LlmTokenClaims`.

We previously added this in
https://github.com/zed-industries/zed/pull/16316 and made it optional
for backwards-compatibility.

It's been more than long enough for all of the previous LLM tokens to
have expired, so we can now make the field required.

Release Notes:

- N/A
2024-10-08 20:03:33 -04:00
Marshall Bowers
f861479890
collab: Update billing code for LLM usage billing (#18879)
This PR reworks our existing billing code in preparation for charging
based on LLM usage.

We aren't yet exercising the new billing-related code outside of
development.

There are some noteworthy changes for our existing LLM usage tracking:

- A new `monthly_usages` table has been added for tracking usage
per-user, per-model, per-month
- The per-month usage measures have been removed, in favor of the
`monthly_usages` table
- All of the per-month metrics in the Clickhouse rows have been changed
from a rolling 30-day window to a calendar month

Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Richard <richard@zed.dev>
Co-authored-by: Max <max@zed.dev>
2024-10-08 18:29:38 -04:00
Danilo Leal
a95fb8f1f9
ssh: Fix text wrapping in loading text (#18876)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
This PR adds `flex_wrap` to the loading text container to prevent the
loading modal layout to break.

Release Notes:

- N/A
2024-10-08 18:37:04 -03:00
Joseph T. Lyons
744891f15f
Provide a default value for is_via_ssh when it isn't sent via older clients (#18874)
Release Notes:

- N/A
2024-10-08 16:16:38 -04:00
Peter Tripp
f33019c885
Document extension bump process (#18872)
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-10-08 16:13:56 -04:00
Peter Tripp
7960468d8a
dart: Bump to v0.1.1 (#18859)
- Includes https://github.com/zed-industries/zed/pull/18845
2024-10-08 14:25:29 -04:00
Marshall Bowers
5377674fc0
csharp: Add support for triple-slash doc comments (#18869)
This PR adds support for triple-slash (`///`) doc comments in C#.

As requested by https://github.com/zed-industries/zed/issues/18766.

Release Notes:

- N/A
2024-10-08 13:54:11 -04:00
Danilo Leal
af9a595770
ssh: Add tweaks to the UI (#18817)
Follow up to https://github.com/zed-industries/zed/pull/18727

---

Release Notes:

- N/A
2024-10-08 14:32:52 -03:00
Marshall Bowers
3f2de172ae
collab: Set cached token values when initially creating lifetime usage records (#18865)
This PR fixes an issue where we weren't setting the cached token fields
when initially creating a lifetime usage record.

Release Notes:

- N/A
2024-10-08 13:16:17 -04:00
Joseph T. Lyons
77bf2ad0f1
Add is_via_ssh field to edit events (#18867)
Release Notes:

- N/A
2024-10-08 13:13:40 -04:00
Marshall Bowers
3da1902e24
worktree: Depend on rpc with test-support feature in tests (#18866)
This PR updates the `worktree` crate to depend on `rpc` with the
`test-support` feature flag when running tests.

This fixes an issue I was seeing locally when trying to run tests in the
`worktree` crate:

```
λ cargo test -p worktree -- test_repository_subfolder_git_status
   Compiling worktree v0.1.0 (/Users/maxdeviant/projects/zed/crates/worktree)
error[E0432]: unresolved import `rpc::AnyProtoClient`
  --> crates/worktree/src/worktree.rs:39:18
   |
39 | use rpc::{proto, AnyProtoClient};
   |                  ^^^^^^^^^^^^^^ no `AnyProtoClient` in the root

For more information about this error, try `rustc --explain E0432`.
error: could not compile `worktree` (lib test) due to 1 previous error
```

Release Notes:

- N/A
2024-10-08 13:07:34 -04:00
Max Brunsfeld
4139e2de23
In proposed change editors, apply diff hunks in batches (#18841)
Release Notes:

- N/A
2024-10-08 08:58:28 -07:00
Thorsten Ball
ff7aa024ee
remote server on macOS: Sign with entitlements (#18863)
This does two things:

- Prevent feature unification
- Sign the remote-server binary with the same entitlements we use for
Zed because we saw this in crash report:

Crashed Thread: 4 Dispatch queue: com.apple.root.user-initiated-qos

Exception Type: EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))
      Exception Codes:       UNKNOWN_0x32 at 0x0000000103636644
      Exception Codes:       0x0000000000000032, 0x0000000103636644

      Termination Reason:    Namespace CODESIGNING, Code 2 Invalid Page

VM Region Info: 0x103636644 is in 0x103634000-0x103638000; bytes after
start: 9796 bytes before end: 6587
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
VM_ALLOCATE 103630000-103634000 [ 16K] r--/rwx SM=ZER
---> VM_ALLOCATE 103634000-103638000 [ 16K] r-x/rwx SM=COW
VM_ALLOCATE 103638000-103640000 [ 32K] r--/rwx SM=ZER

  Which sounds a lot like codesigning/jit/entitlements stuff.


Release Notes:

- N/A

Co-authored-by: Piotr <piotr@zed.dev>
Co-authored-by: Bennet <bennet@zed.dev>
2024-10-08 17:47:24 +02:00
Joseph T. Lyons
d295c46433
Remove deprecated copilot event (#18862)
`CopilotEvent` was succeeded by `InlineCompletionEvent` 5 months ago.

Release Notes:

- N/A
2024-10-08 11:10:20 -04:00
Joseph T. Lyons
4c7a6f5e7f
Add is_via_ssh field to editor events (#18837)
Release Notes:

- N/A
2024-10-08 10:30:04 -04:00
Peter Tripp
dd44168cad
dart: Improve indentation (#18845)
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-10-08 10:20:20 -04:00
Joseph T. Lyons
5bb18adbe8
Inform users they can ask us to reopen issues closed by the stale issue action (#18857)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
Release Notes:

- N/A
2024-10-08 08:13:29 -04:00
Thorsten Ball
b2eb439f32
remote server: Add more debug logging (#18855)
Closes #ISSUE

Release Notes:

- N/A
2024-10-08 13:57:26 +02:00
Bennet Bo Fenner
f0566d54eb
ssh: Log error when remote server panics (#18853)
Release Notes:

- N/A
2024-10-08 12:57:47 +02:00
Thorsten Ball
be531653a4
Direnv warn (#18850)
Follow-up fixes to #18567

Release Notes:

- N/A
2024-10-08 11:54:28 +02:00
Bennet Bo Fenner
fa85238c69
ssh: Limit amount of reconnect attempts (#18819)
Co-Authored-by: Thorsten <thorsten@zed.dev>

Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-10-08 11:37:54 +02:00
Stanislav Alekseev
910a773b89
Display environment loading failures in the activity indicator (#18567)
As @maan2003 noted in #18473, we should warn the user if direnv call
fails

Release Notes:

- Show a notice in the activity indicator if an error occurs while
loading the shell environment
2024-10-08 11:36:18 +02:00
Peter Tripp
87cc208f9f
docs: Fix ollama available_models example (#18842)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
2024-10-07 21:04:36 -04:00
Max Brunsfeld
b0a16a7601
Fix bugs with applying hunks from branch buffers (#18721)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-10-07 16:28:33 -07:00
Marshall Bowers
3c91184726
collab: Drop mistakenly-added columns from the usages table (#18835)
This PR drops the `cache_creation_input_tokens_this_month ` and
`cache_read_input_tokens_this_month ` columns from the `usages` table in
the LLM database.

We mistakenly added these in #18834, but these aren't necessary due to
the structure of the `usages` table. We weren't actually using these
columns anywhere.

Release Notes:

- N/A
2024-10-07 18:21:48 -04:00
Marshall Bowers
d55f025906
collab: Track cache writes/reads in LLM usage (#18834)
This PR extends the LLM usage tracking to support tracking usage for
cache writes and reads for Anthropic models.

Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Antonio <antonio@zed.dev>
2024-10-07 17:32:49 -04:00
Marshall Bowers
c5d252b837
collab: Add missing cmake dependency to Dockerfile (#18832)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
This PR adds the missing `cmake` dependency to the Docker image that is
now needed in order to build collab.

Release Notes:

- N/A
2024-10-07 16:25:17 -04:00
Joseph T. Lyons
a15b10986a
Add ssh initialization events (#18831)
Release Notes:

- N/A
2024-10-07 16:17:43 -04:00