Commit Graph
22 Commits
Author SHA1 Message Date
Nathan SoboandPiotr Osiewicz 7abb63cfda Improve the ergonomics of creating local buffers (#10347)
This PR renames `language::Buffer::new` to `language::Buffer::local` and
simplifies its interface. Instead of taking a replica id (which should
always be 0 for the local case) and a `BufferId`, which was awkward and
verbose to construct, it simply takes text and a `cx`.

It uses the `cx` to derive a `BufferId` from the `EntityId` associated
with the `cx`, which should always be positive based on the following
analysis...

We convert the entity id to a u64 using this method on `EntityId`, which
is defined by macros in the `slotmap` crate:

```rust
    pub fn as_ffi(self) -> u64 {
        (u64::from(self.version.get()) << 32) | u64::from(self.idx)
    }
```

If you look at the type of `version` in `KeyData`, it is non-zero:

```rust
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct KeyData {
    idx: u32,
    version: NonZeroU32,
}
```

This commit also adds `Context::reserve_model` and
`Context::insert_model` to determine a model's entity ID before it is
created, which we need in order to assign a `BufferId` in the background
when loading a buffer asynchronously.

Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-04-10 08:32:51 -06:00
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
Marshall Bowers 5935681c5c Enable clippy::single_char_pattern (#8727)
This PR enables the
[`clippy::single_char_pattern`](https://rust-lang.github.io/rust-clippy/master/index.html#/single_char_pattern)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 17:04:59 -05:00
Max BrunsfeldandMarshall 6edeea7c8a Add logic for managing language and theme extensions (#7467)
This PR adds the initial support for loading extensions in Zed.

### Extensions Directory

Extensions are loaded from the extensions directory.

The extensions directory has the following structure:

```
extensions/
  installed/
    extension-a/
      grammars/
      languages/
    extension-b/
      themes/
  manifest.json
```

The `manifest.json` file is used internally by Zed to keep track of
which extensions are installed. This file should be maintained
automatically, and shouldn't require any direct interaction with it.

Extensions can provide Tree-sitter grammars, languages, and themes.

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-02-07 15:14:50 -05:00
Piotr Osiewicz 5ab715aac9 text: Wrap BufferId into a newtype 2024-01-29 20:00:47 +01:00
Max BrunsfeldandMikayla ecbd115542 Remove 2 suffix for assistant, journal
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 11:14:01 -08:00
KCaverly d5b6300fd7 moved from Boxes to Arcs for shared access of completion providers across the assistant panel and inline assistant 2023-11-02 10:08:47 -04:00
KCaverly b5fe0d72ee authenticate with completion provider on new inline assists 2023-11-02 09:34:18 -04:00
Kyle Caverly 1b9619ca7f added parsing support for <|S| |E|> spans (#3184)
added parsing support for <|S| and |E|> spans for inline generation
2023-11-01 10:26:01 -04:00
KCaverly 08e9b2e848 added parsing support for <|S| |E|> spans 2023-10-30 13:32:47 -04:00
KCaverly 142b94bdd4 Merge branch 'main' of github.com:zed-industries/zed into model_cleanup 2023-10-30 11:07:29 -04:00
KCaverly a2c3971ad6 moved authentication for the semantic index into the EmbeddingProvider 2023-10-30 10:02:27 -04:00
KCaverly 558f54c424 added credential provider to completion provider 2023-10-28 16:35:43 -04:00
KCaverly 7af77b1cf9 moved TestCompletionProvider into ai 2023-10-27 12:26:01 +02:00
KCaverly ec9d79b6fe add concept of LanguageModel to CompletionProvider 2023-10-27 08:51:30 +02:00
KCaverly 3447a9478c updated authentication for embedding provider 2023-10-26 11:18:16 +02:00
Piotr Osiewicz 7f6bb3d1eb Extract multi_buffer module out of editor (#3170)
Release Notes:

- N/A
2023-10-25 19:31:47 +02:00
KCaverly d813ae8845 replace OpenAIRequest with more generalized Box<dyn CompletionRequest> 2023-10-22 14:33:19 +02:00
KCaverly 05ae978cb7 move OpenAICompletionProvider to providers location 2023-10-22 13:57:13 +02:00
Antonio Scandurra b366592878 Don't include start of a line when selection ends at start of line 2023-10-10 19:11:13 +02:00
KCaverly 48e151495f introduce ai crate with completion providers 2023-09-21 22:44:56 -04:00
KCaverly 5f6334696a rename ai crate to assistant crate 2023-09-21 21:54:59 -04:00