Commit Graph

532 Commits

Author SHA1 Message Date
Thorsten Ball
c2428f9f5d
git blame: Parse permalinks client side (#10714)
Release Notes:

- N/A
2024-04-18 12:36:22 +02:00
Kyle Kelley
49371b44cb
Semantic Index (#10329)
This introduces semantic indexing in Zed based on chunking text from
files in the developer's workspace and creating vector embeddings using
an embedding model. As part of this, we've created an embeddings
provider trait that allows us to work with OpenAI, a local Ollama model,
or a Zed hosted embedding.

The semantic index is built by breaking down text for known
(programming) languages into manageable chunks that are smaller than the
max token size. Each chunk is then fed to a language model to create a
high dimensional vector which is then normalized to a unit vector to
allow fast comparison with other vectors with a simple dot product.
Alongside the vector, we store the path of the file and the range within
the document where the vector was sourced from.

Zed will soon grok contextual similarity across different text snippets,
allowing for natural language search beyond keyword matching. This is
being put together both for human-based search as well as providing
results to Large Language Models to allow them to refine how they help
developers.

Remaining todo:

* [x] Change `provider` to `model` within the zed hosted embeddings
database (as its currently a combo of the provider and the model in one
name)


Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Conrad Irwin <conrad@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Antonio <antonio@zed.dev>
2024-04-12 11:40:59 -06:00
Conrad Irwin
dffddaec4c
Revert "Revert "language: Remove buffer fingerprinting (#9007)"" (#9671)
This reverts commit caed275fbf.

NOTE: this should not be merged until #9668 is on stable and the
`ZedVersion#can_collaborate` is updated to exclude all clients without
that change.

Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-04-12 18:40:35 +02:00
Conrad Irwin
f6c85b28d5
WIP: remoting (#10085)
Release Notes:

- Added private alpha support for remote development. Please reach out to hi@zed.dev if you'd like to be part of shaping this feature.
2024-04-11 15:36:35 -06:00
Kirill Bulatov
9aad30a559
Query code actions and hovers from all related local language servers (from remote clients) (#10111)
Supersedes https://github.com/zed-industries/zed/pull/8634
Fixes https://github.com/zed-industries/zed/issues/7947 by continuing
https://github.com/zed-industries/zed/pull/9943 with the remote part.

Now, clients are able to issue collab requests, that query all related
language servers, not only the primary one.
Such mode is enabled for GetHover and GetCodeActions LSP requests only.

Release Notes:

- Added Tailwind CSS hover popovers for Zed in multi player mode
([7947](https://github.com/zed-industries/zed/issues/7947))
2024-04-03 13:34:56 +03:00
Remco Smits
754547f349
Fix mention notifications are not updated after message change and not removed after a message is deleted (#9847)
@ConradIrwin This is a followup for #9035 as agreed.

Release Notes:

- Fixed mention notifications are updated when channel message is
updated. And mention notifications are removed when message is removed.

---------

Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
2024-04-02 20:40:00 -06:00
Thorsten Ball
7f54935324
Add git blame (#8889)
This adds a new action to the editor: `editor: toggle git blame`. When
used it turns on a sidebar containing `git blame` information for the
currently open buffer.

The git blame information is updated when the buffer changes. It handles
additions, deletions, modifications, changes to the underlying git data
(new commits, changed commits, ...), file saves. It also handles folding
and wrapping lines correctly.

When the user hovers over a commit, a tooltip displays information for
the commit that introduced the line. If the repository has a remote with
the name `origin` configured, then clicking on a blame entry opens the
permalink to the commit on the code host.

Users can right-click on a blame entry to get a context menu which
allows them to copy the SHA of the commit.

The feature also works on shared projects, e.g. when collaborating a
peer can request `git blame` data.

As of this PR, Zed now comes bundled with a `git` binary so that users
don't have to have `git` installed locally to use this feature.

### Screenshots

![screenshot-2024-03-28-13 57
43@2x](https://github.com/zed-industries/zed/assets/1185253/ee8ec55d-3b5e-4d63-a85a-852da914f5ba)

![screenshot-2024-03-28-14 01
23@2x](https://github.com/zed-industries/zed/assets/1185253/2ba8efd7-e887-4076-a87a-587a732b9e9a)
![screenshot-2024-03-28-14 01
32@2x](https://github.com/zed-industries/zed/assets/1185253/496f4a06-b189-4881-b427-2289ae6e6075)

### TODOs

- [x] Bundling `git` binary

### Release Notes

Release Notes:

- Added `editor: toggle git blame` command that toggles a sidebar with
git blame information for the current buffer.

---------

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Piotr <piotr@zed.dev>
Co-authored-by: Bennet <bennetbo@gmx.de>
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-03-28 18:32:11 +01:00
Max Brunsfeld
b0409ddd68
Consolidate more extension API structs that were duplicated btwn client and server (#9797)
Release Notes:

- N/A
2024-03-25 21:28:18 -07:00
Max Brunsfeld
5adc51f113
Add telemetry events for loading extensions (#9793)
* Store extensions versions' wasm API version in the database
* Share a common struct for extension API responses between collab and
client
* Add wasm API version and schema version to extension API responses

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-25 17:30:48 -04:00
Conrad Irwin
caed275fbf Revert "language: Remove buffer fingerprinting (#9007)"
This reverts commit 6f2f61c9b1.
2024-03-21 14:10:18 -06:00
Piotr Osiewicz
6f2f61c9b1
language: Remove buffer fingerprinting (#9007)
Followup to #9005 that actually removes buffer fingerprinting.

Release Notes:

- N/A
2024-03-21 17:03:26 +01:00
Max Brunsfeld
585e8671e3
Add a schema to extensions, to prevent installing extensions on too old of a Zed version (#9599)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-20 17:33:26 -04:00
Remco Smits
3dadfe4787
Channel chat: Add edit message (#9035)
**Summary**:
- Removed reply message from message_menu
- Made render_popover_buttons a bit more reusable
- Fixed issue that you can't close the reply/edit preview when you are
not focusing the message editor
- Notify only the new people that were mentioned inside the edited
message

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

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

Release Notes:

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

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

---------

Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-03-19 19:49:04 -06:00
Max Brunsfeld
fd11bd68f2
Perform extension packaging in extension-cli (#9549)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-19 17:26:06 -04:00
Nathan Sobo
8ae5a3b61a
Allow AI interactions to be proxied through Zed's server so you don't need an API key (#7367)
Co-authored-by: Antonio <antonio@zed.dev>

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

Release Notes:

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

---------

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Thorsten <thorsten@zed.dev>
Co-authored-by: Max <max@zed.dev>
2024-03-19 19:22:26 +01:00
Tobias Decking
1e1fb21c81
Merge prost dependecies (#9522)
This patch puts the prost, prost-build, and prost-types dependencies
together and unifies their version. This improves organization a bit in
addition to improving build time slightly, since a redundant version of
prost is now removed.

The dependencies are _not_ updated to the newest versions, because the
newest versions add a dependency on the `protoc` application, which is
not provided by cargo and thus breaks the building process.
2024-03-18 20:33:20 -06:00
Thorsten Ball
a69eddc081
Limit project search to avoid unresponsive app (#9404)
This fixes #[#9135](https://github.com/zed-industries/zed/issues/9135)
by introducing file/results limit to project search.

It does this by changing how project search works in multiple ways.

User-facing changes:

- Number files that are being searched is now limited to 5000
- Number of search results in all files is now limited to 10000
- If a limit is reached, search is stopped and a message is displayed
  to the user

Under the hood, we also reworked `Project::search_local`:

- Code has been refactored so that the concurrency-logic is easier to
  distinguish from the search logic.
- We now limit the number of concurrent `open_buffer` operations, since
  that is being done on the main thread and can lead to beachballs when
  finding a lot of results.

Note for reviewer:

@SomeoneToIgnore since you know this code, can you take a look at this?
The changes might look bigger than they are in certain places because I
only extracted code into functions, but the middle part — the sorting of
file paths — has changed in order to avoid too many tasks opening
buffers at the same time and making app unresponsive.

What's also curious is that I think there was a bug in that we searched
ignored entries _twice_: once in `search_snapshots` and then later in
the dedicated `search_ignored_entry` function. I changed the `entries()`
call in `search_snapshots` so that it's always `false`, but that caused
tests to fail (see `test_search_in_gitignored_dirs`). @bennetbo and I
think that there's some state in the Project that made the tests pass
before, because the last of the 3 assertions in that test only passes
when the other two queries run. So we changed the test to be more
stateless and included the possible fix in `search_snapshots`.

Release Notes:

- Fixed project-wide search leading to unresponsive application when
searching in ignored files, by limiting the number of files that are
searched (to 5000) and the number of overall search results to 10000.
Additional performance improvements have also been made in order to
offload more work onto a background thread.
([#9135](https://github.com/zed-industries/zed/issues/9135)).

---------

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
Co-authored-by: Bennet <bennetbo@gmx.de>
2024-03-18 10:49:27 +01:00
Marshall Bowers
a92dcccf48
Enable clippy::non_canonical_clone_impl (#9373)
This PR enables the
[`clippy::non_canonical_clone_impl`](https://rust-lang.github.io/rust-clippy/master/index.html#/non_canonical_clone_impl)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-14 18:49:51 -04:00
Conrad Irwin
866d791760
Fix joining hosted projects (#9038)
Release Notes:

- N/A
2024-03-07 19:56:41 -07:00
Conrad Irwin
75a42c27db
Migrate from scrypt to sha256. (#8969)
This reduces the server time to compute the hash from 40ms to 5µs,
which should remove this as a noticable chunk of CPU time in production.

(An attacker who has access to our database will now need only 10^54
years of CPU time instead of 10^58 to brute force a token).

Release Notes:

- Improved sign in latency by 40ms.
2024-03-06 20:51:43 -07:00
Max Brunsfeld
35c516fda9
Log the time incoming RPC messages were queued (#8909)
Release Notes:

- N/A

Co-authored-by: Conrad <conrad@zed.dev>
2024-03-05 14:40:09 -08:00
Marshall Bowers
22fe03913c
Move Clippy configuration to the workspace level (#8891)
This PR moves the Clippy configuration up to the workspace level.

We're using the [`lints`
table](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table)
to configure the Clippy ruleset in the workspace's `Cargo.toml`.

Each crate in the workspace now has the following in their own
`Cargo.toml` to inherit the lints from the workspace:

```toml
[lints]
workspace = true
```

This allows for configuring rust-analyzer to show Clippy lints in the
editor by using the following configuration in your Zed `settings.json`:

```json
{
  "lsp": {
    "rust-analyzer": {
      "initialization_options": {
        "check": {
          "command": "clippy"
        }
      }
    }
  }
```

Release Notes:

- N/A
2024-03-05 12:01:17 -05:00
Conrad Irwin
27c5343707
hosted projects (#8627)
- **Allow joining a hosted project**

You can't yet do anything in a hosted project, but you can join it and
look how empty it is.

Release Notes:

- N/A
2024-03-04 19:17:40 -07:00
Marshall Bowers
d19957b705
Enable clippy::redundant_locals (#8750)
This PR enables the
[`clippy::redundant_locals`](https://rust-lang.github.io/rust-clippy/master/index.html#/redundant_locals)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 21:57:40 -05:00
Marshall Bowers
ca2cda8d2a
Remove unneeded 'static lifetimes on &strs in constants (#8698)
This PR removes unneeded `'static` lifetimes on `&str`s stored in
`const` declarations.

This addresses some Clippy lints about
[`redundant_static_lifetimes`](https://rust-lang.github.io/rust-clippy/master/index.html#/redundant_static_lifetimes).

In item-level `const` declarations we can rely on lifetime elision and
use the default `'static` lifetime.

Note that associated constants still require an explicit `'static`
lifetime, as explained in
https://github.com/rust-lang/rust/issues/115010.

Release Notes:

- N/A
2024-03-02 00:40:49 -05:00
Conrad Irwin
5523a510c5
Allow reconnect before disconnect (#8684)
Co-Authored-By: Max <max@zed.dev>



Release Notes:

- Improved handling of reconnections during calls

---------

Co-authored-by: Max <max@zed.dev>
2024-03-01 15:41:32 -07:00
Max Brunsfeld
9e4b3ce94c
Avoid an unwrap when loading languages (#8562)
We couldn't reproduce the panic, but I believe it was possible when
uninstalling an extension while one if its grammars was still loading.

Release Notes:
- Fixed a crash that could happen when uninstalling a language extension
while its grammar was loading.

---------

Co-authored-by: Conrad <conrad@zed.dev>
2024-02-28 14:08:45 -08:00
Conrad Irwin
c31626717f
channel projects (#8456)
Add plumbing for hosted projects. This will currently show them if they
exist
but provides no UX to create/rename/delete them.

Also changed the `ChannelId` type to not auto-cast to u64; this avoids
type
confusion if you have multiple id types.


Release Notes:

- N/A
2024-02-26 22:15:11 -07:00
Dzmitry Malyshau
a44fc24445
Clean up many small dependencies (part 3) (#8425)
Follow-up to #8353

Release Notes:
- N/A
2024-02-26 11:08:57 +02:00
Dzmitry Malyshau
83f493b387
Clean up deps for file_finder, language_selector, task, rpc, storybook (#8353)
Following-up on #8330

Invocation
```bash
cargo-machete --with-metadata --skip-target-dir --fix
````

There is more stuff to fix, but it chokes on `async-lock`:
```
cargo-machete found the following unused dependencies in /x/Code/zed:
rpc -- /x/Code/zed/crates/rpc/Cargo.toml:
        async_lock
        prost_build
        serde_derive
Error: Dependency async_lock not found
```

Release Notes:
- N/A
2024-02-25 10:10:07 +02:00
Conrad Irwin
c6826a61a0
talkers (#8158)
Release Notes:

- Added an "Unmute" action for guests in calls. This lets them use the
mic, but not edit projects.
2024-02-22 10:07:36 -07:00
Leon Huston
b716035d02
Editor: support go to implementation (#7890)
Release Notes:

- Added "Go to implementation" support in editor.
2024-02-22 14:22:04 +01:00
Conrad Irwin
b14d576349
Follower simplification (#8026)
Release Notes:

- Improved reliability of following
2024-02-20 09:41:37 -07:00
Conrad Irwin
a2144faf9c
Remove environment guards (#7741)
Release Notes:

- N/A
2024-02-13 13:20:14 -07:00
Conrad Irwin
2294d99046
revert single channel click (#7738)
- Revert "collab tweaks (#7706)"
- Revert "2112 (#7640)"
- Revert "single click channel (#7596)"
- Reserve protobufs
- Don't revert migrations

Release Notes:

- N/A

**or**

- N/A
2024-02-13 12:53:49 -07:00
Conrad Irwin
efe23ebfcd
single click channel (#7596)
- Open channel notes and chat on channel click
- WIP
- Fix compile error
- Don't join live kit until requested
- Track in_call state separately from in_room



Release Notes:

- Improved channels: you can now be in a channel without joining the
audio call automatically

**or**

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2024-02-09 14:18:27 -07:00
Max Brunsfeld
1264e36429
Remove Default impl for ConnectionId (#7452)
We noticed the following message in my logs when trying to debug some
lag when collaborating:

```
2024-02-06T09:42:09-08:00 [ERROR] error handling message. client_id:3, sender_id:Some(PeerId { owner_id: 327, id: 1123430 }), type:GetCompletions, error:no such connection: 0/0
```

That `0/0` looks like a bogus connection id, constructed via a derived
`Default`. We didn't ever find a code path that would *use* a default
`ConnectionId` and lead to this error, but it did seem like an
improvement to not have a `Default` for that type.

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-02-06 15:45:15 -05:00
Remco Smits
6c4b96ec76
Add the ability to reply to a message (#7170)
Feature
- [x] Allow to click on reply to go to the real message
    - [x] In chat
- [x] Show only a part of the message that you reply to
    - [x] In chat
    - [x] In reply preview

TODO’s
- [x] Fix migration
    - [x] timestamp(in filename)
    - [x] remove the reference to the reply_message_id
- [x] Fix markdown cache for reply message
- [x] Fix spacing when first message is a reply to you and you want to
reply to that message.
- [x] Fetch message that you replied to
    - [x] allow fetching messages that are not inside the current view 
- [x] When message is deleted, we should show a text like `message
deleted` or something
    - [x] Show correct GitHub username + icon after `Replied to: `
    - [x] Show correct message(now it's hard-coded)
- [x] Add icon to reply + add the onClick logic
- [x] Show message that you want to reply to
  - [x] Allow to click away the message that you want to reply to
  - [x] Fix hard-coded GitHub user + icon after `Reply tp:`
  - [x] Add tests

<img width="242" alt="Screenshot 2024-02-06 at 20 51 40"
src="https://github.com/zed-industries/zed/assets/62463826/a7a5f3e0-dee3-4d38-95db-258b169e4498">
<img width="240" alt="Screenshot 2024-02-06 at 20 52 02"
src="https://github.com/zed-industries/zed/assets/62463826/3e136de3-4135-4c07-bd43-30089b677c0a">


Release Notes:

- Added the ability to reply to a message.
- Added highlight message when you click on mention notifications or a
reply message.

---------

Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-02-06 13:22:54 -07:00
Piotr Osiewicz
743f9b345f
chore: Move workspace dependencies to workspace.dependencies (#7454)
We should prefer referring to local deps via `.workspace = true` from
now on.

Release Notes:

- N/A
2024-02-06 20:41:36 +01:00
Conrad Irwin
dcca48482b
disallow opening private files (#7165)
- Disallow sharing gitignored files through collab
- Show errors when failing to open files
- Show a warning to followers when view is unshared

/cc @mikaylamaki, let's update this to use your `private_files` config
before merge.


Release Notes:

- Added the ability to prevent sharing private files over collab.

---------

Co-authored-by: Piotr <piotr@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-31 12:05:51 -08:00
Marshall Bowers
e338f34097
Sort dependencies in Cargo.toml files (#7126)
This PR sorts the dependency lists in our `Cargo.toml` files so that
they are in alphabetical order.

This should make them easier to visually scan when looking for a
dependency.

Apologies in advance for any merge conflicts 🙈 

Release Notes:

- N/A
2024-01-30 21:41:29 -05:00
Marshall Bowers
0cb8b0e451
Clean up Cargo.toml files (#7044)
This PR cleans up some inconsistencies in the `Cargo.toml` files that
were driving me crazy.

Release Notes:

- N/A
2024-01-29 23:47:20 -05:00
Piotr Osiewicz
0a0a866dd5
Licenses: change license fields in Cargo.toml to AGPL-3.0-or-later. (#5535)
Release Notes:
- N/A
2024-01-27 13:51:16 +01:00
Conrad Irwin
08de0d88b1 Update channel moving to match 2024-01-26 10:07:51 -07:00
Conrad Irwin
c6d33d4bb9 Only allow Manage Members on root channels 2024-01-26 09:40:41 -07:00
Conrad Irwin
4b672621d3 Aggressively simplify channel permissions:
- Only allow setting permissions on the root channel
- Only allow public channels to be children of public channels
2024-01-25 23:26:32 -07:00
Conrad Irwin
b72c037199 TEMP 2024-01-25 13:24:45 -07:00
Conrad Irwin
01424a62ea Allow prompts to have detail, and use for good
Make channel panel errors louder
2024-01-24 23:15:37 -07:00
Conrad Irwin
df420c3767 Better naming 2024-01-24 20:48:29 -07:00
Conrad Irwin
4bcd3494b7 Try to send typed errors back and forth
TEMP

TEMP

First pass of structured errors

Improved error handling for channel joining failures
2024-01-24 20:32:39 -07:00