Compare commits

...

8 Commits

Author SHA1 Message Date
Joseph T Lyons
7c21c10900 v0.139.x stable 2024-06-12 12:34:51 -04:00
Joseph T. Lyons
54a5341de3 Add event for yarn project identification (#12785)
Report a `open yarn project` `app_event` for each worktree where
`yarn.lock` is found and only report it once per session.

Release Notes:

- N/A
2024-06-09 19:42:11 -04:00
Zed Bot
0c083b7f38 Bump to 0.139.3 for @osiewicz 2024-06-07 01:34:57 -07:00
Piotr Osiewicz
7f1b4d6d82 workspace: Fix drag&dropping project panel entries into editor area (#12767)
Fixes #12733 

Release Notes:

- Fixed drag&dropping project panel entries into editor area & tab bar
2024-06-07 10:32:35 +02:00
Zed Bot
54226b2d04 Bump to 0.139.2 for @osiewicz 2024-06-07 01:30:07 -07:00
Zed Bot
301b01aaea Bump to 0.139.1 for @osiewicz 2024-06-06 01:25:22 -07:00
Chung Wei Leong
a678dada93 Fixed default LSP default settings for JavaScript, TypeScript & TSX (#12716)
Fixed the default LSP settings for `JavaScript`, `TypeScript` & `TSX`,
correcting the "rest" value from `".."` to `"..."`.

Release Notes:
- N/A
2024-06-06 10:24:03 +02:00
Joseph T Lyons
e398772002 v0.139.x preview 2024-06-05 12:23:40 -04:00
7 changed files with 77 additions and 39 deletions

2
Cargo.lock generated
View File

@@ -13151,7 +13151,7 @@ dependencies = [
[[package]]
name = "zed"
version = "0.139.0"
version = "0.139.3"
dependencies = [
"activity_indicator",
"anyhow",

View File

@@ -698,7 +698,7 @@
}
},
"JavaScript": {
"language_servers": ["typescript-language-server", "!vtsls", ".."],
"language_servers": ["typescript-language-server", "!vtsls", "..."],
"prettier": {
"allowed": true
}
@@ -741,7 +741,7 @@
}
},
"TSX": {
"language_servers": ["typescript-language-server", "!vtsls", ".."],
"language_servers": ["typescript-language-server", "!vtsls", "..."],
"prettier": {
"allowed": true
}
@@ -752,7 +752,7 @@
}
},
"TypeScript": {
"language_servers": ["typescript-language-server", "!vtsls", ".."],
"language_servers": ["typescript-language-server", "!vtsls", "..."],
"prettier": {
"allowed": true
}

View File

@@ -217,6 +217,7 @@ pub struct Project {
hosted_project_id: Option<ProjectId>,
dev_server_project_id: Option<client::DevServerProjectId>,
search_history: SearchHistory,
yarn_worktree_ids_reported: Vec<WorktreeId>,
}
pub enum LanguageServerToQuery {
@@ -773,6 +774,7 @@ impl Project {
hosted_project_id: None,
dev_server_project_id: None,
search_history: Self::new_search_history(),
yarn_worktree_ids_reported: Vec::new(),
}
})
}
@@ -930,6 +932,7 @@ impl Project {
.dev_server_project_id
.map(|dev_server_project_id| DevServerProjectId(dev_server_project_id)),
search_history: Self::new_search_history(),
yarn_worktree_ids_reported: Vec::new(),
};
this.set_role(role, cx);
for worktree in worktrees {
@@ -7592,6 +7595,8 @@ impl Project {
worktree.read(cx).id(),
changes.clone(),
));
this.report_yarn_project(&worktree, changes, cx);
}
worktree::Event::UpdatedGitRepositories(updated_repos) => {
if is_local {
@@ -7644,6 +7649,32 @@ impl Project {
self.metadata_changed(cx);
}
fn report_yarn_project(
&mut self,
worktree: &Model<Worktree>,
updated_entries_set: &UpdatedEntriesSet,
cx: &mut ModelContext<Self>,
) {
let worktree_id = worktree.update(cx, |worktree, _| worktree.id());
if !self.yarn_worktree_ids_reported.contains(&worktree_id) {
let is_yarn_project = updated_entries_set.iter().any(|(path, _, _)| {
path.as_ref()
.file_name()
.and_then(|name| name.to_str())
.map(|name_str| name_str == "yarn.lock")
.unwrap_or(false)
});
if is_yarn_project {
self.client()
.telemetry()
.report_app_event("open yarn project".to_string());
self.yarn_worktree_ids_reported.push(worktree_id);
}
}
}
fn update_local_worktree_buffers(
&mut self,
worktree_handle: &Model<Worktree>,

View File

@@ -36,7 +36,7 @@ use util::{maybe, NumericPrefixWithSuffix, ResultExt, TryFutureExt};
use workspace::{
dock::{DockPosition, Panel, PanelEvent},
notifications::{DetachAndPromptErr, NotifyTaskExt},
OpenInTerminal, Workspace,
DraggedSelection, OpenInTerminal, SelectedEntry, Workspace,
};
use worktree::CreatedEntry;
@@ -65,26 +65,6 @@ pub struct ProjectPanel {
pending_serialization: Task<Option<()>>,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
struct SelectedEntry {
worktree_id: WorktreeId,
entry_id: ProjectEntryId,
}
struct DraggedSelection {
active_selection: SelectedEntry,
marked_selections: Arc<BTreeSet<SelectedEntry>>,
}
impl DraggedSelection {
fn items<'a>(&'a self) -> Box<dyn Iterator<Item = &'a SelectedEntry> + 'a> {
if self.marked_selections.contains(&self.active_selection) {
Box::new(self.marked_selections.iter())
} else {
Box::new(std::iter::once(&self.active_selection))
}
}
}
#[derive(Clone, Debug)]
struct EditState {
worktree_id: WorktreeId,

View File

@@ -9,7 +9,7 @@ use crate::{
SplitDirection, ToggleZoom, Workspace,
};
use anyhow::Result;
use collections::{HashMap, HashSet, VecDeque};
use collections::{BTreeSet, HashMap, HashSet, VecDeque};
use futures::{stream::FuturesUnordered, StreamExt};
use gpui::{
actions, anchored, deferred, impl_actions, prelude::*, Action, AnchorCorner, AnyElement,
@@ -20,7 +20,7 @@ use gpui::{
};
use itertools::Itertools;
use parking_lot::Mutex;
use project::{Project, ProjectEntryId, ProjectPath};
use project::{Project, ProjectEntryId, ProjectPath, WorktreeId};
use serde::Deserialize;
use settings::{Settings, SettingsStore};
use std::{
@@ -43,6 +43,30 @@ use ui::{
use ui::{v_flex, ContextMenu};
use util::{debug_panic, maybe, truncate_and_remove_front, ResultExt};
/// A selected entry in e.g. project panel.
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct SelectedEntry {
pub worktree_id: WorktreeId,
pub entry_id: ProjectEntryId,
}
/// A group of selected entries from project panel.
#[derive(Debug)]
pub struct DraggedSelection {
pub active_selection: SelectedEntry,
pub marked_selections: Arc<BTreeSet<SelectedEntry>>,
}
impl DraggedSelection {
pub fn items<'a>(&'a self) -> Box<dyn Iterator<Item = &'a SelectedEntry> + 'a> {
if self.marked_selections.contains(&self.active_selection) {
Box::new(self.marked_selections.iter())
} else {
Box::new(std::iter::once(&self.active_selection))
}
}
}
#[derive(PartialEq, Clone, Copy, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub enum SaveIntent {
@@ -1594,7 +1618,7 @@ impl Pane {
.drag_over::<DraggedTab>(|tab, _, cx| {
tab.bg(cx.theme().colors().drop_target_background)
})
.drag_over::<ProjectEntryId>(|tab, _, cx| {
.drag_over::<DraggedSelection>(|tab, _, cx| {
tab.bg(cx.theme().colors().drop_target_background)
})
.when_some(self.can_drop_predicate.clone(), |this, p| {
@@ -1604,9 +1628,9 @@ impl Pane {
this.drag_split_direction = None;
this.handle_tab_drop(dragged_tab, ix, cx)
}))
.on_drop(cx.listener(move |this, entry_id: &ProjectEntryId, cx| {
.on_drop(cx.listener(move |this, selection: &DraggedSelection, cx| {
this.drag_split_direction = None;
this.handle_project_entry_drop(entry_id, cx)
this.handle_project_entry_drop(&selection.active_selection.entry_id, cx)
}))
.on_drop(cx.listener(move |this, paths, cx| {
this.drag_split_direction = None;
@@ -1812,16 +1836,16 @@ impl Pane {
.drag_over::<DraggedTab>(|bar, _, cx| {
bar.bg(cx.theme().colors().drop_target_background)
})
.drag_over::<ProjectEntryId>(|bar, _, cx| {
.drag_over::<DraggedSelection>(|bar, _, cx| {
bar.bg(cx.theme().colors().drop_target_background)
})
.on_drop(cx.listener(move |this, dragged_tab: &DraggedTab, cx| {
this.drag_split_direction = None;
this.handle_tab_drop(dragged_tab, this.items.len(), cx)
}))
.on_drop(cx.listener(move |this, entry_id: &ProjectEntryId, cx| {
.on_drop(cx.listener(move |this, selection: &DraggedSelection, cx| {
this.drag_split_direction = None;
this.handle_project_entry_drop(entry_id, cx)
this.handle_project_entry_drop(&selection.active_selection.entry_id, cx)
}))
.on_drop(cx.listener(move |this, paths, cx| {
this.drag_split_direction = None;
@@ -2171,7 +2195,7 @@ impl Render for Pane {
.relative()
.group("")
.on_drag_move::<DraggedTab>(cx.listener(Self::handle_drag_move))
.on_drag_move::<ProjectEntryId>(cx.listener(Self::handle_drag_move))
.on_drag_move::<DraggedSelection>(cx.listener(Self::handle_drag_move))
.on_drag_move::<ExternalPaths>(cx.listener(Self::handle_drag_move))
.map(|div| {
if let Some(item) = self.active_item() {
@@ -2197,7 +2221,7 @@ impl Render for Pane {
.absolute()
.bg(cx.theme().colors().drop_target_background)
.group_drag_over::<DraggedTab>("", |style| style.visible())
.group_drag_over::<ProjectEntryId>("", |style| style.visible())
.group_drag_over::<DraggedSelection>("", |style| style.visible())
.group_drag_over::<ExternalPaths>("", |style| style.visible())
.when_some(self.can_drop_predicate.clone(), |this, p| {
this.can_drop(move |a, cx| p(a, cx))
@@ -2205,8 +2229,11 @@ impl Render for Pane {
.on_drop(cx.listener(move |this, dragged_tab, cx| {
this.handle_tab_drop(dragged_tab, this.active_item_index(), cx)
}))
.on_drop(cx.listener(move |this, entry_id, cx| {
this.handle_project_entry_drop(entry_id, cx)
.on_drop(cx.listener(move |this, selection: &DraggedSelection, cx| {
this.handle_project_entry_drop(
&selection.active_selection.entry_id,
cx,
)
}))
.on_drop(cx.listener(move |this, paths, cx| {
this.handle_external_paths_drop(paths, cx)

View File

@@ -2,7 +2,7 @@
description = "The fast, collaborative code editor."
edition = "2021"
name = "zed"
version = "0.139.0"
version = "0.139.3"
publish = false
license = "GPL-3.0-or-later"
authors = ["Zed Team <hi@zed.dev>"]

View File

@@ -1 +1 @@
dev
stable