diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f1c16b2d4d..a906c8b82d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -51,6 +51,7 @@ jobs:
rustup set profile minimal
rustup update stable
rustup target add wasm32-wasi
+ cargo install cargo-nextest
- name: Install Node
uses: actions/setup-node@v2
@@ -70,7 +71,7 @@ jobs:
run: cargo check --workspace
- name: Run tests
- run: cargo test --workspace --no-fail-fast
+ run: cargo nextest run --workspace --no-fail-fast
- name: Build collab
run: cargo build -p collab
diff --git a/.gitignore b/.gitignore
index 12711bd349..dbffa0f829 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,4 +20,5 @@ DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
+.swiftpm
**/*.db
diff --git a/Cargo.lock b/Cargo.lock
index 3f6ebf306f..3e28404fc1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -114,6 +114,7 @@ dependencies = [
"serde",
"serde_json",
"settings",
+ "smol",
"theme",
"tiktoken-rs",
"util",
@@ -642,7 +643,7 @@ dependencies = [
"http",
"http-body",
"hyper",
- "itoa",
+ "itoa 1.0.6",
"matchit",
"memchr",
"mime",
@@ -3108,7 +3109,7 @@ checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
dependencies = [
"bytes 1.4.0",
"fnv",
- "itoa",
+ "itoa 1.0.6",
]
[[package]]
@@ -3167,7 +3168,7 @@ dependencies = [
"http-body",
"httparse",
"httpdate",
- "itoa",
+ "itoa 1.0.6",
"pin-project-lite 0.2.9",
"socket2",
"tokio",
@@ -3433,6 +3434,12 @@ dependencies = [
"either",
]
+[[package]]
+name = "itoa"
+version = "0.4.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
+
[[package]]
name = "itoa"
version = "1.0.6"
@@ -3493,12 +3500,6 @@ dependencies = [
"wasm-bindgen",
]
-[[package]]
-name = "json_comments"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41ee439ee368ba4a77ac70d04f14015415af8600d6c894dc1f11bd79758c57d5"
-
[[package]]
name = "jwt"
version = "0.16.0"
@@ -3612,6 +3613,29 @@ dependencies = [
"workspace",
]
+[[package]]
+name = "language_tools"
+version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "client",
+ "collections",
+ "editor",
+ "env_logger 0.9.3",
+ "futures 0.3.28",
+ "gpui",
+ "language",
+ "lsp",
+ "project",
+ "serde",
+ "settings",
+ "theme",
+ "tree-sitter",
+ "unindent",
+ "util",
+ "workspace",
+]
+
[[package]]
name = "lazy_static"
version = "1.4.0"
@@ -3856,28 +3880,6 @@ dependencies = [
"url",
]
-[[package]]
-name = "lsp_log"
-version = "0.1.0"
-dependencies = [
- "anyhow",
- "client",
- "collections",
- "editor",
- "env_logger 0.9.3",
- "futures 0.3.28",
- "gpui",
- "language",
- "lsp",
- "project",
- "serde",
- "settings",
- "theme",
- "unindent",
- "util",
- "workspace",
-]
-
[[package]]
name = "mach"
version = "0.3.2"
@@ -5763,7 +5765,7 @@ dependencies = [
"bitflags",
"errno 0.2.8",
"io-lifetimes 0.5.3",
- "itoa",
+ "itoa 1.0.6",
"libc",
"linux-raw-sys 0.0.42",
"once_cell",
@@ -6195,7 +6197,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1"
dependencies = [
"indexmap",
- "itoa",
+ "itoa 1.0.6",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "serde_json_lenient"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7d7b9ce5b0a63c6269b9623ed828b39259545a6ec0d8a35d6135ad6af6232add"
+dependencies = [
+ "indexmap",
+ "itoa 0.4.8",
"ryu",
"serde",
]
@@ -6218,7 +6232,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [
"form_urlencoded",
- "itoa",
+ "itoa 1.0.6",
"ryu",
"serde",
]
@@ -6244,7 +6258,7 @@ dependencies = [
"fs",
"futures 0.3.28",
"gpui",
- "json_comments",
+ "indoc",
"lazy_static",
"postage",
"pretty_assertions",
@@ -6253,6 +6267,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
+ "serde_json_lenient",
"smallvec",
"sqlez",
"staff_mode",
@@ -6603,7 +6618,7 @@ dependencies = [
"hkdf",
"hmac 0.12.1",
"indexmap",
- "itoa",
+ "itoa 1.0.6",
"libc",
"libsqlite3-sys",
"log",
@@ -6998,18 +7013,6 @@ dependencies = [
"workspace",
]
-[[package]]
-name = "theme_testbench"
-version = "0.1.0"
-dependencies = [
- "gpui",
- "project",
- "settings",
- "smallvec",
- "theme",
- "workspace",
-]
-
[[package]]
name = "thiserror"
version = "1.0.40"
@@ -7089,7 +7092,7 @@ version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc"
dependencies = [
- "itoa",
+ "itoa 1.0.6",
"serde",
"time-core",
"time-macros",
@@ -7455,8 +7458,8 @@ dependencies = [
[[package]]
name = "tree-sitter"
-version = "0.20.9"
-source = "git+https://github.com/tree-sitter/tree-sitter?rev=c51896d32dcc11a38e41f36e3deb1a6a9c4f4b14#c51896d32dcc11a38e41f36e3deb1a6a9c4f4b14"
+version = "0.20.10"
+source = "git+https://github.com/tree-sitter/tree-sitter?rev=49226023693107fba9a1191136a4f47f38cdca73#49226023693107fba9a1191136a4f47f38cdca73"
dependencies = [
"cc",
"regex",
@@ -7519,6 +7522,15 @@ dependencies = [
"tree-sitter",
]
+[[package]]
+name = "tree-sitter-heex"
+version = "0.0.1"
+source = "git+https://github.com/phoenixframework/tree-sitter-heex?rev=2e1348c3cf2c9323e87c2744796cf3f3868aa82a#2e1348c3cf2c9323e87c2744796cf3f3868aa82a"
+dependencies = [
+ "cc",
+ "tree-sitter",
+]
+
[[package]]
name = "tree-sitter-html"
version = "0.19.0"
@@ -8893,7 +8905,7 @@ dependencies = [
[[package]]
name = "zed"
-version = "0.91.0"
+version = "0.93.0"
dependencies = [
"activity_indicator",
"ai",
@@ -8937,11 +8949,11 @@ dependencies = [
"journal",
"language",
"language_selector",
+ "language_tools",
"lazy_static",
"libc",
"log",
"lsp",
- "lsp_log",
"node_runtime",
"num_cpus",
"outline",
@@ -8972,7 +8984,6 @@ dependencies = [
"text",
"theme",
"theme_selector",
- "theme_testbench",
"thiserror",
"tiny_http",
"toml",
@@ -8983,6 +8994,7 @@ dependencies = [
"tree-sitter-elixir",
"tree-sitter-embedded-template",
"tree-sitter-go",
+ "tree-sitter-heex",
"tree-sitter-html",
"tree-sitter-json 0.20.0",
"tree-sitter-lua",
diff --git a/Cargo.toml b/Cargo.toml
index 528b7199cf..18e8e221a7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -32,10 +32,10 @@ members = [
"crates/journal",
"crates/language",
"crates/language_selector",
+ "crates/language_tools",
"crates/live_kit_client",
"crates/live_kit_server",
"crates/lsp",
- "crates/lsp_log",
"crates/media",
"crates/menu",
"crates/node_runtime",
@@ -61,7 +61,6 @@ members = [
"crates/text",
"crates/theme",
"crates/theme_selector",
- "crates/theme_testbench",
"crates/util",
"crates/vim",
"crates/workspace",
@@ -99,10 +98,11 @@ tempdir = { version = "0.3.7" }
thiserror = { version = "1.0.29" }
time = { version = "0.3", features = ["serde", "serde-well-known"] }
toml = { version = "0.5" }
+tree-sitter = "0.20"
unindent = { version = "0.1.7" }
[patch.crates-io]
-tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "c51896d32dcc11a38e41f36e3deb1a6a9c4f4b14" }
+tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "49226023693107fba9a1191136a4f47f38cdca73" }
async-task = { git = "https://github.com/zed-industries/async-task", rev = "341b57d6de98cdfd7b418567b8de2022ca993a6e" }
# TODO - Remove when a version is released with this PR: https://github.com/servo/core-foundation-rs/pull/457
diff --git a/assets/icons/robot_14.svg b/assets/icons/robot_14.svg
new file mode 100644
index 0000000000..7b6dc3f752
--- /dev/null
+++ b/assets/icons/robot_14.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/keymaps/atom.json b/assets/keymaps/atom.json
index 25143914cc..60acf5ea6f 100644
--- a/assets/keymaps/atom.json
+++ b/assets/keymaps/atom.json
@@ -55,7 +55,40 @@
"context": "Pane",
"bindings": {
"alt-cmd-/": "search::ToggleRegex",
- "ctrl-0": "project_panel::ToggleFocus"
+ "ctrl-0": "project_panel::ToggleFocus",
+ "cmd-1": [
+ "pane::ActivateItem",
+ 0
+ ],
+ "cmd-2": [
+ "pane::ActivateItem",
+ 1
+ ],
+ "cmd-3": [
+ "pane::ActivateItem",
+ 2
+ ],
+ "cmd-4": [
+ "pane::ActivateItem",
+ 3
+ ],
+ "cmd-5": [
+ "pane::ActivateItem",
+ 4
+ ],
+ "cmd-6": [
+ "pane::ActivateItem",
+ 5
+ ],
+ "cmd-7": [
+ "pane::ActivateItem",
+ 6
+ ],
+ "cmd-8": [
+ "pane::ActivateItem",
+ 7
+ ],
+ "cmd-9": "pane::ActivateLastItem"
}
},
{
diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json
index 45e85fd04f..84b11b53a1 100644
--- a/assets/keymaps/default.json
+++ b/assets/keymaps/default.json
@@ -200,7 +200,9 @@
"context": "AssistantEditor > Editor",
"bindings": {
"cmd-enter": "assistant::Assist",
- "cmd->": "assistant::QuoteSelection"
+ "cmd->": "assistant::QuoteSelection",
+ "shift-enter": "assistant::Split",
+ "ctrl-r": "assistant::CycleMessageRole"
}
},
{
@@ -409,6 +411,7 @@
"ctrl-shift-k": "editor::DeleteLine",
"cmd-shift-d": "editor::DuplicateLine",
"cmd-shift-l": "editor::SplitSelectionIntoLines",
+ "ctrl-j": "editor::JoinLines",
"ctrl-cmd-up": "editor::MoveLineUp",
"ctrl-cmd-down": "editor::MoveLineDown",
"ctrl-alt-backspace": "editor::DeleteToPreviousSubwordStart",
diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json
index 47c5f8c458..05159e9446 100644
--- a/assets/keymaps/vim.json
+++ b/assets/keymaps/vim.json
@@ -25,11 +25,15 @@
}
],
"h": "vim::Left",
+ "left": "vim::Left",
"backspace": "vim::Backspace",
"j": "vim::Down",
+ "down": "vim::Down",
"enter": "vim::NextLineStart",
"k": "vim::Up",
+ "up": "vim::Up",
"l": "vim::Right",
+ "right": "vim::Right",
"$": "vim::EndOfLine",
"shift-g": "vim::EndOfDocument",
"w": "vim::NextWordStart",
@@ -90,6 +94,8 @@
}
}
],
+ "ctrl-o": "pane::GoBack",
+ "ctrl-]": "editor::GoToDefinition",
"escape": "editor::Cancel",
"0": "vim::StartOfLine", // When no number operator present, use start of line motion
"1": [
@@ -143,6 +149,7 @@
"Delete"
],
"shift-d": "vim::DeleteToEndOfLine",
+ "shift-j": "editor::JoinLines",
"y": [
"vim::PushOperator",
"Yank"
@@ -184,7 +191,6 @@
"p": "vim::Paste",
"u": "editor::Undo",
"ctrl-r": "editor::Redo",
- "ctrl-o": "pane::GoBack",
"/": [
"buffer_search::Deploy",
{
diff --git a/assets/settings/default.json b/assets/settings/default.json
index c2c372fe51..bd73bcbf08 100644
--- a/assets/settings/default.json
+++ b/assets/settings/default.json
@@ -108,6 +108,8 @@
// Whether or not to remove any trailing whitespace from lines of a buffer
// before saving it.
"remove_trailing_whitespace_on_save": true,
+ // Whether to start a new line with a comment when a previous line is a comment as well.
+ "extend_comment_on_newline": true,
// Whether or not to ensure there's a single newline at the end of a buffer
// when saving it.
"ensure_final_newline_on_save": true,
diff --git a/assets/settings/initial_local_settings.json b/assets/settings/initial_local_settings.json
index 69be683aa8..82ddf88042 100644
--- a/assets/settings/initial_local_settings.json
+++ b/assets/settings/initial_local_settings.json
@@ -1,11 +1,5 @@
-// Folder-specific Zed settings
+// Folder-specific settings
//
-// A subset of Zed's settings can be configured on a per-folder basis.
-//
-// For information on how to configure Zed, see the Zed
-// documentation: https://zed.dev/docs/configuring-zed
-//
-// To see all of Zed's default settings without changing your
-// custom settings, run the `open default settings` command
-// from the command palette or from `Zed` application menu.
+// For a full list of overridable settings, and general information on folder-specific settings,
+// see the documentation: https://docs.zed.dev/configuration/configuring-zed#folder-specific-settings
{}
diff --git a/assets/settings/initial_user_settings.json b/assets/settings/initial_user_settings.json
index 2af677da9a..dc79fd7911 100644
--- a/assets/settings/initial_user_settings.json
+++ b/assets/settings/initial_user_settings.json
@@ -1,7 +1,7 @@
-// Folder-specific settings
+// Zed settings
//
-// For a full list of overridable settings, and general information on folder-specific settings, see the documentation:
-// https://docs.zed.dev/configuration/configuring-zed#folder-specific-settings
+// For information on how to configure Zed, see the Zed
+// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
diff --git a/crates/activity_indicator/src/activity_indicator.rs b/crates/activity_indicator/src/activity_indicator.rs
index 801c8f7172..f795d7321c 100644
--- a/crates/activity_indicator/src/activity_indicator.rs
+++ b/crates/activity_indicator/src/activity_indicator.rs
@@ -326,7 +326,7 @@ impl View for ActivityIndicator {
let mut element = MouseEventHandler::::new(0, cx, |state, cx| {
let theme = &theme::current(cx).workspace.status_bar.lsp_status;
let style = if state.hovered() && on_click.is_some() {
- theme.hover.as_ref().unwrap_or(&theme.default)
+ theme.hovered.as_ref().unwrap_or(&theme.default)
} else {
&theme.default
};
diff --git a/crates/ai/Cargo.toml b/crates/ai/Cargo.toml
index 9d67cbd108..7f8954bb21 100644
--- a/crates/ai/Cargo.toml
+++ b/crates/ai/Cargo.toml
@@ -28,6 +28,7 @@ isahc.workspace = true
schemars.workspace = true
serde.workspace = true
serde_json.workspace = true
+smol.workspace = true
tiktoken-rs = "0.4"
[dev-dependencies]
diff --git a/crates/ai/src/ai.rs b/crates/ai/src/ai.rs
index 40224b3229..b3b62c6a24 100644
--- a/crates/ai/src/ai.rs
+++ b/crates/ai/src/ai.rs
@@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
use std::fmt::{self, Display};
// Data types for chat completion requests
-#[derive(Serialize)]
+#[derive(Debug, Serialize)]
struct OpenAIRequest {
model: String,
messages: Vec,
diff --git a/crates/ai/src/assistant.rs b/crates/ai/src/assistant.rs
index 77353e1ee4..5b254fac4b 100644
--- a/crates/ai/src/assistant.rs
+++ b/crates/ai/src/assistant.rs
@@ -6,12 +6,9 @@ use anyhow::{anyhow, Result};
use chrono::{DateTime, Local};
use collections::{HashMap, HashSet};
use editor::{
- display_map::ToDisplayPoint,
- scroll::{
- autoscroll::{Autoscroll, AutoscrollStrategy},
- ScrollAnchor,
- },
- Anchor, DisplayPoint, Editor, ExcerptId, ExcerptRange, MultiBuffer,
+ display_map::{BlockDisposition, BlockId, BlockProperties, BlockStyle, ToDisplayPoint},
+ scroll::autoscroll::{Autoscroll, AutoscrollStrategy},
+ Anchor, Editor, ToOffset,
};
use fs::Fs;
use futures::{io::BufReader, AsyncBufReadExt, AsyncReadExt, Stream, StreamExt};
@@ -19,17 +16,20 @@ use gpui::{
actions,
elements::*,
executor::Background,
- geometry::vector::vec2f,
+ geometry::vector::{vec2f, Vector2F},
platform::{CursorStyle, MouseButton},
Action, AppContext, AsyncAppContext, ClipboardItem, Entity, ModelContext, ModelHandle,
Subscription, Task, View, ViewContext, ViewHandle, WeakViewHandle, WindowContext,
};
use isahc::{http::StatusCode, Request, RequestExt};
-use language::{language_settings::SoftWrap, Buffer, LanguageRegistry};
+use language::{language_settings::SoftWrap, Buffer, LanguageRegistry, ToOffset as _};
use serde::Deserialize;
use settings::SettingsStore;
-use std::{borrow::Cow, cell::RefCell, cmp, fmt::Write, io, rc::Rc, sync::Arc, time::Duration};
-use util::{post_inc, truncate_and_trailoff, ResultExt, TryFutureExt};
+use std::{
+ borrow::Cow, cell::RefCell, cmp, fmt::Write, io, iter, ops::Range, rc::Rc, sync::Arc,
+ time::Duration,
+};
+use util::{channel::ReleaseChannel, post_inc, truncate_and_trailoff, ResultExt, TryFutureExt};
use workspace::{
dock::{DockPosition, Panel},
item::Item,
@@ -40,10 +40,24 @@ const OPENAI_API_URL: &'static str = "https://api.openai.com/v1";
actions!(
assistant,
- [NewContext, Assist, QuoteSelection, ToggleFocus, ResetKey]
+ [
+ NewContext,
+ Assist,
+ Split,
+ CycleMessageRole,
+ QuoteSelection,
+ ToggleFocus,
+ ResetKey
+ ]
);
pub fn init(cx: &mut AppContext) {
+ if *util::channel::RELEASE_CHANNEL == ReleaseChannel::Stable {
+ cx.update_default_global::(move |filter, _cx| {
+ filter.filtered_namespaces.insert("assistant");
+ });
+ }
+
settings::register::(cx);
cx.add_action(
|workspace: &mut Workspace, _: &NewContext, cx: &mut ViewContext| {
@@ -58,8 +72,15 @@ pub fn init(cx: &mut AppContext) {
cx.capture_action(AssistantEditor::cancel_last_assist);
cx.add_action(AssistantEditor::quote_selection);
cx.capture_action(AssistantEditor::copy);
+ cx.capture_action(AssistantEditor::split);
+ cx.capture_action(AssistantEditor::cycle_message_role);
cx.add_action(AssistantPanel::save_api_key);
cx.add_action(AssistantPanel::reset_api_key);
+ cx.add_action(
+ |workspace: &mut Workspace, _: &ToggleFocus, cx: &mut ViewContext| {
+ workspace.toggle_panel_focus::(cx);
+ },
+ );
}
pub enum AssistantPanelEvent {
@@ -387,7 +408,7 @@ impl Panel for AssistantPanel {
}
fn icon_path(&self) -> &'static str {
- "icons/speech_bubble_12.svg"
+ "icons/robot_14.svg"
}
fn icon_tooltip(&self) -> (String, Option>) {
@@ -420,20 +441,20 @@ impl Panel for AssistantPanel {
}
enum AssistantEvent {
- MessagesEdited { ids: Vec },
+ MessagesEdited,
SummaryChanged,
StreamedCompletion,
}
struct Assistant {
- buffer: ModelHandle,
- messages: Vec,
- messages_metadata: HashMap,
+ buffer: ModelHandle,
+ message_anchors: Vec,
+ messages_metadata: HashMap,
+ next_message_id: MessageId,
summary: Option,
pending_summary: Task