Another batch of lint fixes (#36521)
- **Enable a bunch of extra lints** - **First batch of fixes** - **More fixes** Release Notes: - N/A
This commit is contained in:
parent
69b1c6d6f5
commit
6825715503
147 changed files with 788 additions and 1042 deletions
10
Cargo.toml
10
Cargo.toml
|
@ -822,14 +822,20 @@ style = { level = "allow", priority = -1 }
|
||||||
|
|
||||||
# Temporary list of style lints that we've fixed so far.
|
# Temporary list of style lints that we've fixed so far.
|
||||||
comparison_to_empty = "warn"
|
comparison_to_empty = "warn"
|
||||||
|
into_iter_on_ref = "warn"
|
||||||
iter_cloned_collect = "warn"
|
iter_cloned_collect = "warn"
|
||||||
iter_next_slice = "warn"
|
iter_next_slice = "warn"
|
||||||
iter_nth = "warn"
|
iter_nth = "warn"
|
||||||
iter_nth_zero = "warn"
|
iter_nth_zero = "warn"
|
||||||
iter_skip_next = "warn"
|
iter_skip_next = "warn"
|
||||||
|
let_and_return = "warn"
|
||||||
module_inception = { level = "deny" }
|
module_inception = { level = "deny" }
|
||||||
question_mark = { level = "deny" }
|
question_mark = { level = "deny" }
|
||||||
|
single_match = "warn"
|
||||||
redundant_closure = { level = "deny" }
|
redundant_closure = { level = "deny" }
|
||||||
|
redundant_static_lifetimes = { level = "warn" }
|
||||||
|
redundant_pattern_matching = "warn"
|
||||||
|
redundant_field_names = "warn"
|
||||||
declare_interior_mutable_const = { level = "deny" }
|
declare_interior_mutable_const = { level = "deny" }
|
||||||
collapsible_if = { level = "warn"}
|
collapsible_if = { level = "warn"}
|
||||||
collapsible_else_if = { level = "warn" }
|
collapsible_else_if = { level = "warn" }
|
||||||
|
@ -857,6 +863,10 @@ too_many_arguments = "allow"
|
||||||
# We often have large enum variants yet we rarely actually bother with splitting them up.
|
# We often have large enum variants yet we rarely actually bother with splitting them up.
|
||||||
large_enum_variant = "allow"
|
large_enum_variant = "allow"
|
||||||
|
|
||||||
|
# `enum_variant_names` fires for all enums, even when they derive serde traits.
|
||||||
|
# Adhering to this lint would be a breaking change.
|
||||||
|
enum_variant_names = "allow"
|
||||||
|
|
||||||
[workspace.metadata.cargo-machete]
|
[workspace.metadata.cargo-machete]
|
||||||
ignored = [
|
ignored = [
|
||||||
"bindgen",
|
"bindgen",
|
||||||
|
|
|
@ -264,15 +264,14 @@ impl ActionLog {
|
||||||
if let Some((git_diff, (buffer_repo, _))) = git_diff.as_ref().zip(buffer_repo) {
|
if let Some((git_diff, (buffer_repo, _))) = git_diff.as_ref().zip(buffer_repo) {
|
||||||
cx.update(|cx| {
|
cx.update(|cx| {
|
||||||
let mut old_head = buffer_repo.read(cx).head_commit.clone();
|
let mut old_head = buffer_repo.read(cx).head_commit.clone();
|
||||||
Some(cx.subscribe(git_diff, move |_, event, cx| match event {
|
Some(cx.subscribe(git_diff, move |_, event, cx| {
|
||||||
buffer_diff::BufferDiffEvent::DiffChanged { .. } => {
|
if let buffer_diff::BufferDiffEvent::DiffChanged { .. } = event {
|
||||||
let new_head = buffer_repo.read(cx).head_commit.clone();
|
let new_head = buffer_repo.read(cx).head_commit.clone();
|
||||||
if new_head != old_head {
|
if new_head != old_head {
|
||||||
old_head = new_head;
|
old_head = new_head;
|
||||||
git_diff_updates_tx.send(()).ok();
|
git_diff_updates_tx.send(()).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}))
|
}))
|
||||||
})?
|
})?
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -103,26 +103,21 @@ impl ActivityIndicator {
|
||||||
cx.subscribe_in(
|
cx.subscribe_in(
|
||||||
&workspace_handle,
|
&workspace_handle,
|
||||||
window,
|
window,
|
||||||
|activity_indicator, _, event, window, cx| match event {
|
|activity_indicator, _, event, window, cx| {
|
||||||
workspace::Event::ClearActivityIndicator { .. } => {
|
if let workspace::Event::ClearActivityIndicator { .. } = event
|
||||||
if activity_indicator.statuses.pop().is_some() {
|
&& activity_indicator.statuses.pop().is_some()
|
||||||
activity_indicator.dismiss_error_message(
|
{
|
||||||
&DismissErrorMessage,
|
activity_indicator.dismiss_error_message(&DismissErrorMessage, window, cx);
|
||||||
window,
|
cx.notify();
|
||||||
cx,
|
|
||||||
);
|
|
||||||
cx.notify();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.detach();
|
.detach();
|
||||||
|
|
||||||
cx.subscribe(
|
cx.subscribe(
|
||||||
&project.read(cx).lsp_store(),
|
&project.read(cx).lsp_store(),
|
||||||
|activity_indicator, _, event, cx| match event {
|
|activity_indicator, _, event, cx| {
|
||||||
LspStoreEvent::LanguageServerUpdate { name, message, .. } => {
|
if let LspStoreEvent::LanguageServerUpdate { name, message, .. } = event {
|
||||||
if let proto::update_language_server::Variant::StatusUpdate(status_update) =
|
if let proto::update_language_server::Variant::StatusUpdate(status_update) =
|
||||||
message
|
message
|
||||||
{
|
{
|
||||||
|
@ -191,7 +186,6 @@ impl ActivityIndicator {
|
||||||
}
|
}
|
||||||
cx.notify()
|
cx.notify()
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.detach();
|
.detach();
|
||||||
|
@ -206,9 +200,10 @@ impl ActivityIndicator {
|
||||||
|
|
||||||
cx.subscribe(
|
cx.subscribe(
|
||||||
&project.read(cx).git_store().clone(),
|
&project.read(cx).git_store().clone(),
|
||||||
|_, _, event: &GitStoreEvent, cx| match event {
|
|_, _, event: &GitStoreEvent, cx| {
|
||||||
project::git_store::GitStoreEvent::JobsUpdated => cx.notify(),
|
if let project::git_store::GitStoreEvent::JobsUpdated = event {
|
||||||
_ => {}
|
cx.notify()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.detach();
|
.detach();
|
||||||
|
|
|
@ -1645,15 +1645,13 @@ impl Thread {
|
||||||
self.tool_use
|
self.tool_use
|
||||||
.request_tool_use(tool_message_id, tool_use, tool_use_metadata.clone(), cx);
|
.request_tool_use(tool_message_id, tool_use, tool_use_metadata.clone(), cx);
|
||||||
|
|
||||||
let pending_tool_use = self.tool_use.insert_tool_output(
|
self.tool_use.insert_tool_output(
|
||||||
tool_use_id.clone(),
|
tool_use_id.clone(),
|
||||||
tool_name,
|
tool_name,
|
||||||
tool_output,
|
tool_output,
|
||||||
self.configured_model.as_ref(),
|
self.configured_model.as_ref(),
|
||||||
self.completion_mode,
|
self.completion_mode,
|
||||||
);
|
)
|
||||||
|
|
||||||
pending_tool_use
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn stream_completion(
|
pub fn stream_completion(
|
||||||
|
|
|
@ -74,7 +74,7 @@ impl Column for DataType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const RULES_FILE_NAMES: [&'static str; 9] = [
|
const RULES_FILE_NAMES: [&str; 9] = [
|
||||||
".rules",
|
".rules",
|
||||||
".cursorrules",
|
".cursorrules",
|
||||||
".windsurfrules",
|
".windsurfrules",
|
||||||
|
|
|
@ -28,7 +28,7 @@ use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
|
|
||||||
const RULES_FILE_NAMES: [&'static str; 9] = [
|
const RULES_FILE_NAMES: [&str; 9] = [
|
||||||
".rules",
|
".rules",
|
||||||
".cursorrules",
|
".cursorrules",
|
||||||
".windsurfrules",
|
".windsurfrules",
|
||||||
|
|
|
@ -655,8 +655,7 @@ mod tests {
|
||||||
mode: mode.clone(),
|
mode: mode.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = cx.update(|cx| resolve_path(&input, project, cx));
|
cx.update(|cx| resolve_path(&input, project, cx))
|
||||||
result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_resolved_path_eq(path: anyhow::Result<ProjectPath>, expected: &str) {
|
fn assert_resolved_path_eq(path: anyhow::Result<ProjectPath>, expected: &str) {
|
||||||
|
|
|
@ -149,7 +149,7 @@ impl acp_old::Client for OldAcpClientDelegate {
|
||||||
|
|
||||||
Ok(acp_old::RequestToolCallConfirmationResponse {
|
Ok(acp_old::RequestToolCallConfirmationResponse {
|
||||||
id: acp_old::ToolCallId(old_acp_id),
|
id: acp_old::ToolCallId(old_acp_id),
|
||||||
outcome: outcome,
|
outcome,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ impl acp_old::Client for OldAcpClientDelegate {
|
||||||
|
|
||||||
fn into_new_tool_call(id: acp::ToolCallId, request: acp_old::PushToolCallParams) -> acp::ToolCall {
|
fn into_new_tool_call(id: acp::ToolCallId, request: acp_old::PushToolCallParams) -> acp::ToolCall {
|
||||||
acp::ToolCall {
|
acp::ToolCall {
|
||||||
id: id,
|
id,
|
||||||
title: request.label,
|
title: request.label,
|
||||||
kind: acp_kind_from_old_icon(request.icon),
|
kind: acp_kind_from_old_icon(request.icon),
|
||||||
status: acp::ToolCallStatus::InProgress,
|
status: acp::ToolCallStatus::InProgress,
|
||||||
|
|
|
@ -175,9 +175,9 @@ impl McpServerTool for PermissionTool {
|
||||||
let claude_tool = ClaudeTool::infer(&input.tool_name, input.input.clone());
|
let claude_tool = ClaudeTool::infer(&input.tool_name, input.input.clone());
|
||||||
let tool_call_id = acp::ToolCallId(input.tool_use_id.context("Tool ID required")?.into());
|
let tool_call_id = acp::ToolCallId(input.tool_use_id.context("Tool ID required")?.into());
|
||||||
|
|
||||||
const ALWAYS_ALLOW: &'static str = "always_allow";
|
const ALWAYS_ALLOW: &str = "always_allow";
|
||||||
const ALLOW: &'static str = "allow";
|
const ALLOW: &str = "allow";
|
||||||
const REJECT: &'static str = "reject";
|
const REJECT: &str = "reject";
|
||||||
|
|
||||||
let chosen_option = thread
|
let chosen_option = thread
|
||||||
.update(cx, |thread, cx| {
|
.update(cx, |thread, cx| {
|
||||||
|
|
|
@ -428,12 +428,9 @@ pub async fn new_test_thread(
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let thread = cx
|
cx.update(|cx| connection.new_thread(project.clone(), current_dir.as_ref(), cx))
|
||||||
.update(|cx| connection.new_thread(project.clone(), current_dir.as_ref(), cx))
|
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap()
|
||||||
|
|
||||||
thread
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn run_until_first_tool_call(
|
pub async fn run_until_first_tool_call(
|
||||||
|
|
|
@ -134,8 +134,8 @@ impl MessageEditor {
|
||||||
if prevent_slash_commands {
|
if prevent_slash_commands {
|
||||||
subscriptions.push(cx.subscribe_in(&editor, window, {
|
subscriptions.push(cx.subscribe_in(&editor, window, {
|
||||||
let semantics_provider = semantics_provider.clone();
|
let semantics_provider = semantics_provider.clone();
|
||||||
move |this, editor, event, window, cx| match event {
|
move |this, editor, event, window, cx| {
|
||||||
EditorEvent::Edited { .. } => {
|
if let EditorEvent::Edited { .. } = event {
|
||||||
this.highlight_slash_command(
|
this.highlight_slash_command(
|
||||||
semantics_provider.clone(),
|
semantics_provider.clone(),
|
||||||
editor.clone(),
|
editor.clone(),
|
||||||
|
@ -143,7 +143,6 @@ impl MessageEditor {
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2124,7 +2124,7 @@ impl AcpThreadView {
|
||||||
.map(|view| div().px_4().w_full().max_w_128().child(view)),
|
.map(|view| div().px_4().w_full().max_w_128().child(view)),
|
||||||
)
|
)
|
||||||
.child(h_flex().mt_1p5().justify_center().children(
|
.child(h_flex().mt_1p5().justify_center().children(
|
||||||
connection.auth_methods().into_iter().map(|method| {
|
connection.auth_methods().iter().map(|method| {
|
||||||
Button::new(SharedString::from(method.id.0.clone()), method.name.clone())
|
Button::new(SharedString::from(method.id.0.clone()), method.name.clone())
|
||||||
.on_click({
|
.on_click({
|
||||||
let method_id = method.id.clone();
|
let method_id = method.id.clone();
|
||||||
|
@ -2574,7 +2574,7 @@ impl AcpThreadView {
|
||||||
) -> Div {
|
) -> Div {
|
||||||
let editor_bg_color = cx.theme().colors().editor_background;
|
let editor_bg_color = cx.theme().colors().editor_background;
|
||||||
|
|
||||||
v_flex().children(changed_buffers.into_iter().enumerate().flat_map(
|
v_flex().children(changed_buffers.iter().enumerate().flat_map(
|
||||||
|(index, (buffer, _diff))| {
|
|(index, (buffer, _diff))| {
|
||||||
let file = buffer.read(cx).file()?;
|
let file = buffer.read(cx).file()?;
|
||||||
let path = file.path();
|
let path = file.path();
|
||||||
|
|
|
@ -1373,12 +1373,12 @@ impl ActiveThread {
|
||||||
editor.focus_handle(cx).focus(window);
|
editor.focus_handle(cx).focus(window);
|
||||||
editor.move_to_end(&editor::actions::MoveToEnd, window, cx);
|
editor.move_to_end(&editor::actions::MoveToEnd, window, cx);
|
||||||
});
|
});
|
||||||
let buffer_edited_subscription = cx.subscribe(&editor, |this, _, event, cx| match event {
|
let buffer_edited_subscription =
|
||||||
EditorEvent::BufferEdited => {
|
cx.subscribe(&editor, |this, _, event: &EditorEvent, cx| {
|
||||||
this.update_editing_message_token_count(true, cx);
|
if event == &EditorEvent::BufferEdited {
|
||||||
}
|
this.update_editing_message_token_count(true, cx);
|
||||||
_ => {}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let context_picker_menu_handle = PopoverMenuHandle::default();
|
let context_picker_menu_handle = PopoverMenuHandle::default();
|
||||||
let context_strip = cx.new(|cx| {
|
let context_strip = cx.new(|cx| {
|
||||||
|
|
|
@ -958,7 +958,7 @@ impl AgentConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
parent.child(v_flex().py_1p5().px_1().gap_1().children(
|
parent.child(v_flex().py_1p5().px_1().gap_1().children(
|
||||||
tools.into_iter().enumerate().map(|(ix, tool)| {
|
tools.iter().enumerate().map(|(ix, tool)| {
|
||||||
h_flex()
|
h_flex()
|
||||||
.id(("tool-item", ix))
|
.id(("tool-item", ix))
|
||||||
.px_1()
|
.px_1()
|
||||||
|
|
|
@ -487,7 +487,7 @@ impl ConfigureContextServerModal {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_modal_description(&self, window: &mut Window, cx: &mut Context<Self>) -> AnyElement {
|
fn render_modal_description(&self, window: &mut Window, cx: &mut Context<Self>) -> AnyElement {
|
||||||
const MODAL_DESCRIPTION: &'static str = "Visit the MCP server configuration docs to find all necessary arguments and environment variables.";
|
const MODAL_DESCRIPTION: &str = "Visit the MCP server configuration docs to find all necessary arguments and environment variables.";
|
||||||
|
|
||||||
if let ConfigurationSource::Extension {
|
if let ConfigurationSource::Extension {
|
||||||
installation_instructions: Some(installation_instructions),
|
installation_instructions: Some(installation_instructions),
|
||||||
|
|
|
@ -322,16 +322,14 @@ impl AgentDiffPane {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_native_thread_event(&mut self, event: &ThreadEvent, cx: &mut Context<Self>) {
|
fn handle_native_thread_event(&mut self, event: &ThreadEvent, cx: &mut Context<Self>) {
|
||||||
match event {
|
if let ThreadEvent::SummaryGenerated = event {
|
||||||
ThreadEvent::SummaryGenerated => self.update_title(cx),
|
self.update_title(cx)
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_acp_thread_event(&mut self, event: &AcpThreadEvent, cx: &mut Context<Self>) {
|
fn handle_acp_thread_event(&mut self, event: &AcpThreadEvent, cx: &mut Context<Self>) {
|
||||||
match event {
|
if let AcpThreadEvent::TitleUpdated = event {
|
||||||
AcpThreadEvent::TitleUpdated => self.update_title(cx),
|
self.update_title(cx)
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1541,15 +1539,11 @@ impl AgentDiff {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
match event {
|
if let workspace::Event::ItemAdded { item } = event
|
||||||
workspace::Event::ItemAdded { item } => {
|
&& let Some(editor) = item.downcast::<Editor>()
|
||||||
if let Some(editor) = item.downcast::<Editor>()
|
&& let Some(buffer) = Self::full_editor_buffer(editor.read(cx), cx)
|
||||||
&& let Some(buffer) = Self::full_editor_buffer(editor.read(cx), cx)
|
{
|
||||||
{
|
self.register_editor(workspace.downgrade(), buffer.clone(), editor, window, cx);
|
||||||
self.register_editor(workspace.downgrade(), buffer.clone(), editor, window, cx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -354,7 +354,7 @@ impl ActiveView {
|
||||||
Self::Thread {
|
Self::Thread {
|
||||||
change_title_editor: editor,
|
change_title_editor: editor,
|
||||||
thread: active_thread,
|
thread: active_thread,
|
||||||
message_editor: message_editor,
|
message_editor,
|
||||||
_subscriptions: subscriptions,
|
_subscriptions: subscriptions,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -756,25 +756,25 @@ impl AgentPanel {
|
||||||
.ok();
|
.ok();
|
||||||
});
|
});
|
||||||
|
|
||||||
let _default_model_subscription = cx.subscribe(
|
let _default_model_subscription =
|
||||||
&LanguageModelRegistry::global(cx),
|
cx.subscribe(
|
||||||
|this, _, event: &language_model::Event, cx| match event {
|
&LanguageModelRegistry::global(cx),
|
||||||
language_model::Event::DefaultModelChanged => match &this.active_view {
|
|this, _, event: &language_model::Event, cx| {
|
||||||
ActiveView::Thread { thread, .. } => {
|
if let language_model::Event::DefaultModelChanged = event {
|
||||||
thread
|
match &this.active_view {
|
||||||
.read(cx)
|
ActiveView::Thread { thread, .. } => {
|
||||||
.thread()
|
thread.read(cx).thread().clone().update(cx, |thread, cx| {
|
||||||
.clone()
|
thread.get_or_init_configured_model(cx)
|
||||||
.update(cx, |thread, cx| thread.get_or_init_configured_model(cx));
|
});
|
||||||
|
}
|
||||||
|
ActiveView::ExternalAgentThread { .. }
|
||||||
|
| ActiveView::TextThread { .. }
|
||||||
|
| ActiveView::History
|
||||||
|
| ActiveView::Configuration => {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ActiveView::ExternalAgentThread { .. }
|
|
||||||
| ActiveView::TextThread { .. }
|
|
||||||
| ActiveView::History
|
|
||||||
| ActiveView::Configuration => {}
|
|
||||||
},
|
},
|
||||||
_ => {}
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
let onboarding = cx.new(|cx| {
|
let onboarding = cx.new(|cx| {
|
||||||
AgentPanelOnboarding::new(
|
AgentPanelOnboarding::new(
|
||||||
|
@ -1589,17 +1589,14 @@ impl AgentPanel {
|
||||||
let current_is_special = current_is_history || current_is_config;
|
let current_is_special = current_is_history || current_is_config;
|
||||||
let new_is_special = new_is_history || new_is_config;
|
let new_is_special = new_is_history || new_is_config;
|
||||||
|
|
||||||
match &self.active_view {
|
if let ActiveView::Thread { thread, .. } = &self.active_view {
|
||||||
ActiveView::Thread { thread, .. } => {
|
let thread = thread.read(cx);
|
||||||
let thread = thread.read(cx);
|
if thread.is_empty() {
|
||||||
if thread.is_empty() {
|
let id = thread.thread().read(cx).id().clone();
|
||||||
let id = thread.thread().read(cx).id().clone();
|
self.history_store.update(cx, |store, cx| {
|
||||||
self.history_store.update(cx, |store, cx| {
|
store.remove_recently_opened_thread(id, cx);
|
||||||
store.remove_recently_opened_thread(id, cx);
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
match &new_view {
|
match &new_view {
|
||||||
|
@ -3465,7 +3462,7 @@ impl AgentPanel {
|
||||||
.on_drop(cx.listener(move |this, paths: &ExternalPaths, window, cx| {
|
.on_drop(cx.listener(move |this, paths: &ExternalPaths, window, cx| {
|
||||||
let tasks = paths
|
let tasks = paths
|
||||||
.paths()
|
.paths()
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|path| {
|
.map(|path| {
|
||||||
Workspace::project_path_for_path(this.project.clone(), path, false, cx)
|
Workspace::project_path_for_path(this.project.clone(), path, false, cx)
|
||||||
})
|
})
|
||||||
|
|
|
@ -385,12 +385,11 @@ impl ContextPicker {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn select_first(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
pub fn select_first(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
match &self.mode {
|
// Other variants already select their first entry on open automatically
|
||||||
ContextPickerState::Default(entity) => entity.update(cx, |entity, cx| {
|
if let ContextPickerState::Default(entity) = &self.mode {
|
||||||
|
entity.update(cx, |entity, cx| {
|
||||||
entity.select_first(&Default::default(), window, cx)
|
entity.select_first(&Default::default(), window, cx)
|
||||||
}),
|
})
|
||||||
// Other variants already select their first entry on open automatically
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ pub(crate) fn create_editor(
|
||||||
let mut editor = Editor::new(
|
let mut editor = Editor::new(
|
||||||
editor::EditorMode::AutoHeight {
|
editor::EditorMode::AutoHeight {
|
||||||
min_lines,
|
min_lines,
|
||||||
max_lines: max_lines,
|
max_lines,
|
||||||
},
|
},
|
||||||
buffer,
|
buffer,
|
||||||
None,
|
None,
|
||||||
|
@ -215,9 +215,10 @@ impl MessageEditor {
|
||||||
|
|
||||||
let subscriptions = vec![
|
let subscriptions = vec![
|
||||||
cx.subscribe_in(&context_strip, window, Self::handle_context_strip_event),
|
cx.subscribe_in(&context_strip, window, Self::handle_context_strip_event),
|
||||||
cx.subscribe(&editor, |this, _, event, cx| match event {
|
cx.subscribe(&editor, |this, _, event: &EditorEvent, cx| {
|
||||||
EditorEvent::BufferEdited => this.handle_message_changed(cx),
|
if event == &EditorEvent::BufferEdited {
|
||||||
_ => {}
|
this.handle_message_changed(cx)
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
cx.observe(&context_store, |this, _, cx| {
|
cx.observe(&context_store, |this, _, cx| {
|
||||||
// When context changes, reload it for token counting.
|
// When context changes, reload it for token counting.
|
||||||
|
@ -1132,7 +1133,7 @@ impl MessageEditor {
|
||||||
)
|
)
|
||||||
.when(is_edit_changes_expanded, |parent| {
|
.when(is_edit_changes_expanded, |parent| {
|
||||||
parent.child(
|
parent.child(
|
||||||
v_flex().children(changed_buffers.into_iter().enumerate().flat_map(
|
v_flex().children(changed_buffers.iter().enumerate().flat_map(
|
||||||
|(index, (buffer, _diff))| {
|
|(index, (buffer, _diff))| {
|
||||||
let file = buffer.read(cx).file()?;
|
let file = buffer.read(cx).file()?;
|
||||||
let path = file.path();
|
let path = file.path();
|
||||||
|
@ -1605,7 +1606,8 @@ pub fn extract_message_creases(
|
||||||
.collect::<HashMap<_, _>>();
|
.collect::<HashMap<_, _>>();
|
||||||
// Filter the addon's list of creases based on what the editor reports,
|
// Filter the addon's list of creases based on what the editor reports,
|
||||||
// since the addon might have removed creases in it.
|
// since the addon might have removed creases in it.
|
||||||
let creases = editor.display_map.update(cx, |display_map, cx| {
|
|
||||||
|
editor.display_map.update(cx, |display_map, cx| {
|
||||||
display_map
|
display_map
|
||||||
.snapshot(cx)
|
.snapshot(cx)
|
||||||
.crease_snapshot
|
.crease_snapshot
|
||||||
|
@ -1629,8 +1631,7 @@ pub fn extract_message_creases(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
});
|
})
|
||||||
creases
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventEmitter<MessageEditorEvent> for MessageEditor {}
|
impl EventEmitter<MessageEditorEvent> for MessageEditor {}
|
||||||
|
|
|
@ -327,9 +327,7 @@ where
|
||||||
};
|
};
|
||||||
|
|
||||||
let picker_view = cx.new(|cx| {
|
let picker_view = cx.new(|cx| {
|
||||||
let picker =
|
Picker::uniform_list(delegate, window, cx).max_height(Some(rems(20.).into()))
|
||||||
Picker::uniform_list(delegate, window, cx).max_height(Some(rems(20.).into()));
|
|
||||||
picker
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let handle = self
|
let handle = self
|
||||||
|
|
|
@ -540,7 +540,7 @@ impl TextThreadEditor {
|
||||||
let context = self.context.read(cx);
|
let context = self.context.read(cx);
|
||||||
let sections = context
|
let sections = context
|
||||||
.slash_command_output_sections()
|
.slash_command_output_sections()
|
||||||
.into_iter()
|
.iter()
|
||||||
.filter(|section| section.is_valid(context.buffer().read(cx)))
|
.filter(|section| section.is_valid(context.buffer().read(cx)))
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
@ -1237,7 +1237,7 @@ impl TextThreadEditor {
|
||||||
let mut new_blocks = vec![];
|
let mut new_blocks = vec![];
|
||||||
let mut block_index_to_message = vec![];
|
let mut block_index_to_message = vec![];
|
||||||
for message in self.context.read(cx).messages(cx) {
|
for message in self.context.read(cx).messages(cx) {
|
||||||
if let Some(_) = blocks_to_remove.remove(&message.id) {
|
if blocks_to_remove.remove(&message.id).is_some() {
|
||||||
// This is an old message that we might modify.
|
// This is an old message that we might modify.
|
||||||
let Some((meta, block_id)) = old_blocks.get_mut(&message.id) else {
|
let Some((meta, block_id)) = old_blocks.get_mut(&message.id) else {
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
|
@ -1275,7 +1275,7 @@ impl TextThreadEditor {
|
||||||
context_editor_view: &Entity<TextThreadEditor>,
|
context_editor_view: &Entity<TextThreadEditor>,
|
||||||
cx: &mut Context<Workspace>,
|
cx: &mut Context<Workspace>,
|
||||||
) -> Option<(String, bool)> {
|
) -> Option<(String, bool)> {
|
||||||
const CODE_FENCE_DELIMITER: &'static str = "```";
|
const CODE_FENCE_DELIMITER: &str = "```";
|
||||||
|
|
||||||
let context_editor = context_editor_view.read(cx).editor.clone();
|
let context_editor = context_editor_view.read(cx).editor.clone();
|
||||||
context_editor.update(cx, |context_editor, cx| {
|
context_editor.update(cx, |context_editor, cx| {
|
||||||
|
@ -2161,8 +2161,8 @@ impl TextThreadEditor {
|
||||||
|
|
||||||
/// Returns the contents of the *outermost* fenced code block that contains the given offset.
|
/// Returns the contents of the *outermost* fenced code block that contains the given offset.
|
||||||
fn find_surrounding_code_block(snapshot: &BufferSnapshot, offset: usize) -> Option<Range<usize>> {
|
fn find_surrounding_code_block(snapshot: &BufferSnapshot, offset: usize) -> Option<Range<usize>> {
|
||||||
const CODE_BLOCK_NODE: &'static str = "fenced_code_block";
|
const CODE_BLOCK_NODE: &str = "fenced_code_block";
|
||||||
const CODE_BLOCK_CONTENT: &'static str = "code_fence_content";
|
const CODE_BLOCK_CONTENT: &str = "code_fence_content";
|
||||||
|
|
||||||
let layer = snapshot.syntax_layers().next()?;
|
let layer = snapshot.syntax_layers().next()?;
|
||||||
|
|
||||||
|
@ -3129,7 +3129,7 @@ mod tests {
|
||||||
let context_editor = window
|
let context_editor = window
|
||||||
.update(&mut cx, |_, window, cx| {
|
.update(&mut cx, |_, window, cx| {
|
||||||
cx.new(|cx| {
|
cx.new(|cx| {
|
||||||
let editor = TextThreadEditor::for_context(
|
TextThreadEditor::for_context(
|
||||||
context.clone(),
|
context.clone(),
|
||||||
fs,
|
fs,
|
||||||
workspace.downgrade(),
|
workspace.downgrade(),
|
||||||
|
@ -3137,8 +3137,7 @@ mod tests {
|
||||||
None,
|
None,
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
);
|
)
|
||||||
editor
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -14,13 +14,11 @@ pub struct IncompatibleToolsState {
|
||||||
|
|
||||||
impl IncompatibleToolsState {
|
impl IncompatibleToolsState {
|
||||||
pub fn new(thread: Entity<Thread>, cx: &mut Context<Self>) -> Self {
|
pub fn new(thread: Entity<Thread>, cx: &mut Context<Self>) -> Self {
|
||||||
let _tool_working_set_subscription =
|
let _tool_working_set_subscription = cx.subscribe(&thread, |this, _, event, _| {
|
||||||
cx.subscribe(&thread, |this, _, event, _| match event {
|
if let ThreadEvent::ProfileChanged = event {
|
||||||
ThreadEvent::ProfileChanged => {
|
this.cache.clear();
|
||||||
this.cache.clear();
|
}
|
||||||
}
|
});
|
||||||
_ => {}
|
|
||||||
});
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
cache: HashMap::default(),
|
cache: HashMap::default(),
|
||||||
|
|
|
@ -590,7 +590,7 @@ impl From<&Message> for MessageMetadata {
|
||||||
|
|
||||||
impl MessageMetadata {
|
impl MessageMetadata {
|
||||||
pub fn is_cache_valid(&self, buffer: &BufferSnapshot, range: &Range<usize>) -> bool {
|
pub fn is_cache_valid(&self, buffer: &BufferSnapshot, range: &Range<usize>) -> bool {
|
||||||
let result = match &self.cache {
|
match &self.cache {
|
||||||
Some(MessageCacheMetadata { cached_at, .. }) => !buffer.has_edits_since_in_range(
|
Some(MessageCacheMetadata { cached_at, .. }) => !buffer.has_edits_since_in_range(
|
||||||
cached_at,
|
cached_at,
|
||||||
Range {
|
Range {
|
||||||
|
@ -599,8 +599,7 @@ impl MessageMetadata {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
}
|
||||||
result
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2081,15 +2080,12 @@ impl AssistantContext {
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
LanguageModelCompletionEvent::StatusUpdate(status_update) => {
|
LanguageModelCompletionEvent::StatusUpdate(status_update) => {
|
||||||
match status_update {
|
if let CompletionRequestStatus::UsageUpdated { amount, limit } = status_update {
|
||||||
CompletionRequestStatus::UsageUpdated { amount, limit } => {
|
this.update_model_request_usage(
|
||||||
this.update_model_request_usage(
|
amount as u32,
|
||||||
amount as u32,
|
limit,
|
||||||
limit,
|
cx,
|
||||||
cx,
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LanguageModelCompletionEvent::StartMessage { .. } => {}
|
LanguageModelCompletionEvent::StartMessage { .. } => {}
|
||||||
|
|
|
@ -223,7 +223,7 @@ fn collect_files(
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> impl Stream<Item = Result<SlashCommandEvent>> + use<> {
|
) -> impl Stream<Item = Result<SlashCommandEvent>> + use<> {
|
||||||
let Ok(matchers) = glob_inputs
|
let Ok(matchers) = glob_inputs
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|glob_input| {
|
.map(|glob_input| {
|
||||||
custom_path_matcher::PathMatcher::new(&[glob_input.to_owned()])
|
custom_path_matcher::PathMatcher::new(&[glob_input.to_owned()])
|
||||||
.with_context(|| format!("invalid path {glob_input}"))
|
.with_context(|| format!("invalid path {glob_input}"))
|
||||||
|
@ -379,7 +379,7 @@ fn collect_files(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(_) = directory_stack.pop() {
|
while directory_stack.pop().is_some() {
|
||||||
events_tx.unbounded_send(Ok(SlashCommandEvent::EndSection))?;
|
events_tx.unbounded_send(Ok(SlashCommandEvent::EndSection))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -491,7 +491,7 @@ mod custom_path_matcher {
|
||||||
impl PathMatcher {
|
impl PathMatcher {
|
||||||
pub fn new(globs: &[String]) -> Result<Self, globset::Error> {
|
pub fn new(globs: &[String]) -> Result<Self, globset::Error> {
|
||||||
let globs = globs
|
let globs = globs
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|glob| Glob::new(&SanitizedPath::from(glob).to_glob_string()))
|
.map(|glob| Glob::new(&SanitizedPath::from(glob).to_glob_string()))
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
let sources = globs.iter().map(|glob| glob.glob().to_owned()).collect();
|
let sources = globs.iter().map(|glob| glob.glob().to_owned()).collect();
|
||||||
|
|
|
@ -156,13 +156,13 @@ fn resolve_context_server_tool_name_conflicts(
|
||||||
|
|
||||||
if duplicated_tool_names.is_empty() {
|
if duplicated_tool_names.is_empty() {
|
||||||
return context_server_tools
|
return context_server_tools
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|tool| (resolve_tool_name(tool).into(), tool.clone()))
|
.map(|tool| (resolve_tool_name(tool).into(), tool.clone()))
|
||||||
.collect();
|
.collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
context_server_tools
|
context_server_tools
|
||||||
.into_iter()
|
.iter()
|
||||||
.filter_map(|tool| {
|
.filter_map(|tool| {
|
||||||
let mut tool_name = resolve_tool_name(tool);
|
let mut tool_name = resolve_tool_name(tool);
|
||||||
if !duplicated_tool_names.contains(&tool_name) {
|
if !duplicated_tool_names.contains(&tool_name) {
|
||||||
|
|
|
@ -72,11 +72,10 @@ pub fn init(http_client: Arc<HttpClientWithUrl>, cx: &mut App) {
|
||||||
register_web_search_tool(&LanguageModelRegistry::global(cx), cx);
|
register_web_search_tool(&LanguageModelRegistry::global(cx), cx);
|
||||||
cx.subscribe(
|
cx.subscribe(
|
||||||
&LanguageModelRegistry::global(cx),
|
&LanguageModelRegistry::global(cx),
|
||||||
move |registry, event, cx| match event {
|
move |registry, event, cx| {
|
||||||
language_model::Event::DefaultModelChanged => {
|
if let language_model::Event::DefaultModelChanged = event {
|
||||||
register_web_search_tool(®istry, cx);
|
register_web_search_tool(®istry, cx);
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.detach();
|
.detach();
|
||||||
|
|
|
@ -1356,8 +1356,7 @@ mod tests {
|
||||||
mode: mode.clone(),
|
mode: mode.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = cx.update(|cx| resolve_path(&input, project, cx));
|
cx.update(|cx| resolve_path(&input, project, cx))
|
||||||
result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_resolved_path_eq(path: anyhow::Result<ProjectPath>, expected: &str) {
|
fn assert_resolved_path_eq(path: anyhow::Result<ProjectPath>, expected: &str) {
|
||||||
|
|
|
@ -216,7 +216,8 @@ impl Tool for TerminalTool {
|
||||||
async move |cx| {
|
async move |cx| {
|
||||||
let program = program.await;
|
let program = program.await;
|
||||||
let env = env.await;
|
let env = env.await;
|
||||||
let terminal = project
|
|
||||||
|
project
|
||||||
.update(cx, |project, cx| {
|
.update(cx, |project, cx| {
|
||||||
project.create_terminal(
|
project.create_terminal(
|
||||||
TerminalKind::Task(task::SpawnInTerminal {
|
TerminalKind::Task(task::SpawnInTerminal {
|
||||||
|
@ -229,8 +230,7 @@ impl Tool for TerminalTool {
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
})?
|
})?
|
||||||
.await;
|
.await
|
||||||
terminal
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -494,11 +494,11 @@ mod linux {
|
||||||
Ok(Fork::Parent(_)) => Ok(()),
|
Ok(Fork::Parent(_)) => Ok(()),
|
||||||
Ok(Fork::Child) => {
|
Ok(Fork::Child) => {
|
||||||
unsafe { std::env::set_var(FORCE_CLI_MODE_ENV_VAR_NAME, "") };
|
unsafe { std::env::set_var(FORCE_CLI_MODE_ENV_VAR_NAME, "") };
|
||||||
if let Err(_) = fork::setsid() {
|
if fork::setsid().is_err() {
|
||||||
eprintln!("failed to setsid: {}", std::io::Error::last_os_error());
|
eprintln!("failed to setsid: {}", std::io::Error::last_os_error());
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
if let Err(_) = fork::close_fd() {
|
if fork::close_fd().is_err() {
|
||||||
eprintln!("failed to close_fd: {}", std::io::Error::last_os_error());
|
eprintln!("failed to close_fd: {}", std::io::Error::last_os_error());
|
||||||
}
|
}
|
||||||
let error =
|
let error =
|
||||||
|
@ -534,8 +534,8 @@ mod flatpak {
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::{env, process};
|
use std::{env, process};
|
||||||
|
|
||||||
const EXTRA_LIB_ENV_NAME: &'static str = "ZED_FLATPAK_LIB_PATH";
|
const EXTRA_LIB_ENV_NAME: &str = "ZED_FLATPAK_LIB_PATH";
|
||||||
const NO_ESCAPE_ENV_NAME: &'static str = "ZED_FLATPAK_NO_ESCAPE";
|
const NO_ESCAPE_ENV_NAME: &str = "ZED_FLATPAK_NO_ESCAPE";
|
||||||
|
|
||||||
/// Adds bundled libraries to LD_LIBRARY_PATH if running under flatpak
|
/// Adds bundled libraries to LD_LIBRARY_PATH if running under flatpak
|
||||||
pub fn ld_extra_libs() {
|
pub fn ld_extra_libs() {
|
||||||
|
|
|
@ -4970,7 +4970,7 @@ async fn test_references(
|
||||||
"Rust",
|
"Rust",
|
||||||
FakeLspAdapter {
|
FakeLspAdapter {
|
||||||
name: "my-fake-lsp-adapter",
|
name: "my-fake-lsp-adapter",
|
||||||
capabilities: capabilities,
|
capabilities,
|
||||||
..FakeLspAdapter::default()
|
..FakeLspAdapter::default()
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -397,11 +397,10 @@ impl MessageEditor {
|
||||||
) -> Option<(Anchor, String, &'static [StringMatchCandidate])> {
|
) -> Option<(Anchor, String, &'static [StringMatchCandidate])> {
|
||||||
static EMOJI_FUZZY_MATCH_CANDIDATES: LazyLock<Vec<StringMatchCandidate>> =
|
static EMOJI_FUZZY_MATCH_CANDIDATES: LazyLock<Vec<StringMatchCandidate>> =
|
||||||
LazyLock::new(|| {
|
LazyLock::new(|| {
|
||||||
let emojis = emojis::iter()
|
emojis::iter()
|
||||||
.flat_map(|s| s.shortcodes())
|
.flat_map(|s| s.shortcodes())
|
||||||
.map(|emoji| StringMatchCandidate::new(0, emoji))
|
.map(|emoji| StringMatchCandidate::new(0, emoji))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>()
|
||||||
emojis
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let end_offset = end_anchor.to_offset(buffer.read(cx));
|
let end_offset = end_anchor.to_offset(buffer.read(cx));
|
||||||
|
|
|
@ -77,7 +77,7 @@ impl McpServer {
|
||||||
socket_path,
|
socket_path,
|
||||||
_server_task: server_task,
|
_server_task: server_task,
|
||||||
tools,
|
tools,
|
||||||
handlers: handlers,
|
handlers,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ impl PythonDebugAdapter {
|
||||||
return Err("Failed to create base virtual environment".into());
|
return Err("Failed to create base virtual environment".into());
|
||||||
}
|
}
|
||||||
|
|
||||||
const DIR: &'static str = if cfg!(target_os = "windows") {
|
const DIR: &str = if cfg!(target_os = "windows") {
|
||||||
"Scripts"
|
"Scripts"
|
||||||
} else {
|
} else {
|
||||||
"bin"
|
"bin"
|
||||||
|
|
|
@ -257,7 +257,7 @@ impl DebugPanel {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|entity| entity.downgrade()),
|
.map(|entity| entity.downgrade()),
|
||||||
task_context: task_context.clone(),
|
task_context: task_context.clone(),
|
||||||
worktree_id: worktree_id,
|
worktree_id,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
running.resolve_scenario(
|
running.resolve_scenario(
|
||||||
|
|
|
@ -87,7 +87,7 @@ impl DebugSession {
|
||||||
self.stack_trace_view.get_or_init(|| {
|
self.stack_trace_view.get_or_init(|| {
|
||||||
let stackframe_list = running_state.read(cx).stack_frame_list().clone();
|
let stackframe_list = running_state.read(cx).stack_frame_list().clone();
|
||||||
|
|
||||||
let stack_frame_view = cx.new(|cx| {
|
cx.new(|cx| {
|
||||||
StackTraceView::new(
|
StackTraceView::new(
|
||||||
workspace.clone(),
|
workspace.clone(),
|
||||||
project.clone(),
|
project.clone(),
|
||||||
|
@ -95,9 +95,7 @@ impl DebugSession {
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
});
|
})
|
||||||
|
|
||||||
stack_frame_view
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,7 @@ pub(crate) fn new_debugger_pane(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let ret = cx.new(move |cx| {
|
cx.new(move |cx| {
|
||||||
let mut pane = Pane::new(
|
let mut pane = Pane::new(
|
||||||
workspace.clone(),
|
workspace.clone(),
|
||||||
project.clone(),
|
project.clone(),
|
||||||
|
@ -562,9 +562,7 @@ pub(crate) fn new_debugger_pane(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
pane
|
pane
|
||||||
});
|
})
|
||||||
|
|
||||||
ret
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct DebugTerminal {
|
pub struct DebugTerminal {
|
||||||
|
|
|
@ -329,8 +329,8 @@ impl BreakpointList {
|
||||||
let text = self.input.read(cx).text(cx);
|
let text = self.input.read(cx).text(cx);
|
||||||
|
|
||||||
match mode {
|
match mode {
|
||||||
ActiveBreakpointStripMode::Log => match &entry.kind {
|
ActiveBreakpointStripMode::Log => {
|
||||||
BreakpointEntryKind::LineBreakpoint(line_breakpoint) => {
|
if let BreakpointEntryKind::LineBreakpoint(line_breakpoint) = &entry.kind {
|
||||||
Self::edit_line_breakpoint_inner(
|
Self::edit_line_breakpoint_inner(
|
||||||
&self.breakpoint_store,
|
&self.breakpoint_store,
|
||||||
line_breakpoint.breakpoint.path.clone(),
|
line_breakpoint.breakpoint.path.clone(),
|
||||||
|
@ -339,10 +339,9 @@ impl BreakpointList {
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_ => {}
|
}
|
||||||
},
|
ActiveBreakpointStripMode::Condition => {
|
||||||
ActiveBreakpointStripMode::Condition => match &entry.kind {
|
if let BreakpointEntryKind::LineBreakpoint(line_breakpoint) = &entry.kind {
|
||||||
BreakpointEntryKind::LineBreakpoint(line_breakpoint) => {
|
|
||||||
Self::edit_line_breakpoint_inner(
|
Self::edit_line_breakpoint_inner(
|
||||||
&self.breakpoint_store,
|
&self.breakpoint_store,
|
||||||
line_breakpoint.breakpoint.path.clone(),
|
line_breakpoint.breakpoint.path.clone(),
|
||||||
|
@ -351,10 +350,9 @@ impl BreakpointList {
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_ => {}
|
}
|
||||||
},
|
ActiveBreakpointStripMode::HitCondition => {
|
||||||
ActiveBreakpointStripMode::HitCondition => match &entry.kind {
|
if let BreakpointEntryKind::LineBreakpoint(line_breakpoint) = &entry.kind {
|
||||||
BreakpointEntryKind::LineBreakpoint(line_breakpoint) => {
|
|
||||||
Self::edit_line_breakpoint_inner(
|
Self::edit_line_breakpoint_inner(
|
||||||
&self.breakpoint_store,
|
&self.breakpoint_store,
|
||||||
line_breakpoint.breakpoint.path.clone(),
|
line_breakpoint.breakpoint.path.clone(),
|
||||||
|
@ -363,8 +361,7 @@ impl BreakpointList {
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_ => {}
|
}
|
||||||
},
|
|
||||||
}
|
}
|
||||||
self.focus_handle.focus(window);
|
self.focus_handle.focus(window);
|
||||||
} else {
|
} else {
|
||||||
|
@ -426,13 +423,10 @@ impl BreakpointList {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
match &mut entry.kind {
|
if let BreakpointEntryKind::LineBreakpoint(line_breakpoint) = &mut entry.kind {
|
||||||
BreakpointEntryKind::LineBreakpoint(line_breakpoint) => {
|
let path = line_breakpoint.breakpoint.path.clone();
|
||||||
let path = line_breakpoint.breakpoint.path.clone();
|
let row = line_breakpoint.breakpoint.row;
|
||||||
let row = line_breakpoint.breakpoint.row;
|
self.edit_line_breakpoint(path, row, BreakpointEditAction::Toggle, cx);
|
||||||
self.edit_line_breakpoint(path, row, BreakpointEditAction::Toggle, cx);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
@ -967,7 +961,7 @@ impl LineBreakpoint {
|
||||||
props,
|
props,
|
||||||
breakpoint: BreakpointEntry {
|
breakpoint: BreakpointEntry {
|
||||||
kind: BreakpointEntryKind::LineBreakpoint(self.clone()),
|
kind: BreakpointEntryKind::LineBreakpoint(self.clone()),
|
||||||
weak: weak,
|
weak,
|
||||||
},
|
},
|
||||||
is_selected,
|
is_selected,
|
||||||
focus_handle,
|
focus_handle,
|
||||||
|
@ -1179,7 +1173,7 @@ impl ExceptionBreakpoint {
|
||||||
props,
|
props,
|
||||||
breakpoint: BreakpointEntry {
|
breakpoint: BreakpointEntry {
|
||||||
kind: BreakpointEntryKind::ExceptionBreakpoint(self.clone()),
|
kind: BreakpointEntryKind::ExceptionBreakpoint(self.clone()),
|
||||||
weak: weak,
|
weak,
|
||||||
},
|
},
|
||||||
is_selected,
|
is_selected,
|
||||||
focus_handle,
|
focus_handle,
|
||||||
|
|
|
@ -947,7 +947,7 @@ impl VariableList {
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) fn assert_visual_entries(&self, expected: Vec<&str>) {
|
pub(crate) fn assert_visual_entries(&self, expected: Vec<&str>) {
|
||||||
const INDENT: &'static str = " ";
|
const INDENT: &str = " ";
|
||||||
|
|
||||||
let entries = &self.entries;
|
let entries = &self.entries;
|
||||||
let mut visual_entries = Vec::with_capacity(entries.len());
|
let mut visual_entries = Vec::with_capacity(entries.len());
|
||||||
|
|
|
@ -1445,11 +1445,8 @@ async fn test_variable_list_only_sends_requests_when_rendering(
|
||||||
|
|
||||||
cx.run_until_parked();
|
cx.run_until_parked();
|
||||||
|
|
||||||
let running_state = active_debug_session_panel(workspace, cx).update_in(cx, |item, _, _| {
|
let running_state = active_debug_session_panel(workspace, cx)
|
||||||
let state = item.running_state().clone();
|
.update_in(cx, |item, _, _| item.running_state().clone());
|
||||||
|
|
||||||
state
|
|
||||||
});
|
|
||||||
|
|
||||||
client
|
client
|
||||||
.fake_event(dap::messages::Events::Stopped(dap::StoppedEvent {
|
.fake_event(dap::messages::Events::Stopped(dap::StoppedEvent {
|
||||||
|
|
|
@ -21,7 +21,7 @@ static KEYMAP_LINUX: LazyLock<KeymapFile> = LazyLock::new(|| {
|
||||||
|
|
||||||
static ALL_ACTIONS: LazyLock<Vec<ActionDef>> = LazyLock::new(dump_all_gpui_actions);
|
static ALL_ACTIONS: LazyLock<Vec<ActionDef>> = LazyLock::new(dump_all_gpui_actions);
|
||||||
|
|
||||||
const FRONT_MATTER_COMMENT: &'static str = "<!-- ZED_META {} -->";
|
const FRONT_MATTER_COMMENT: &str = "<!-- ZED_META {} -->";
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
zlog::init();
|
zlog::init();
|
||||||
|
@ -105,8 +105,8 @@ fn handle_preprocessing() -> Result<()> {
|
||||||
template_and_validate_actions(&mut book, &mut errors);
|
template_and_validate_actions(&mut book, &mut errors);
|
||||||
|
|
||||||
if !errors.is_empty() {
|
if !errors.is_empty() {
|
||||||
const ANSI_RED: &'static str = "\x1b[31m";
|
const ANSI_RED: &str = "\x1b[31m";
|
||||||
const ANSI_RESET: &'static str = "\x1b[0m";
|
const ANSI_RESET: &str = "\x1b[0m";
|
||||||
for error in &errors {
|
for error in &errors {
|
||||||
eprintln!("{ANSI_RED}ERROR{ANSI_RESET}: {}", error);
|
eprintln!("{ANSI_RED}ERROR{ANSI_RESET}: {}", error);
|
||||||
}
|
}
|
||||||
|
@ -143,11 +143,8 @@ fn handle_frontmatter(book: &mut Book, errors: &mut HashSet<PreprocessorError>)
|
||||||
&serde_json::to_string(&metadata).expect("Failed to serialize metadata"),
|
&serde_json::to_string(&metadata).expect("Failed to serialize metadata"),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
match new_content {
|
if let Cow::Owned(content) = new_content {
|
||||||
Cow::Owned(content) => {
|
chapter.content = content;
|
||||||
chapter.content = content;
|
|
||||||
}
|
|
||||||
Cow::Borrowed(_) => {}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -409,13 +406,13 @@ fn handle_postprocessing() -> Result<()> {
|
||||||
.captures(contents)
|
.captures(contents)
|
||||||
.with_context(|| format!("Failed to find title in {:?}", pretty_path))
|
.with_context(|| format!("Failed to find title in {:?}", pretty_path))
|
||||||
.expect("Page has <title> element")[1];
|
.expect("Page has <title> element")[1];
|
||||||
let title = title_tag_contents
|
|
||||||
|
title_tag_contents
|
||||||
.trim()
|
.trim()
|
||||||
.strip_suffix("- Zed")
|
.strip_suffix("- Zed")
|
||||||
.unwrap_or(title_tag_contents)
|
.unwrap_or(title_tag_contents)
|
||||||
.trim()
|
.trim()
|
||||||
.to_string();
|
.to_string()
|
||||||
title
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,14 +61,14 @@ pub fn replacement(c: char) -> Option<&'static str> {
|
||||||
// but could if we tracked state in the classifier.
|
// but could if we tracked state in the classifier.
|
||||||
const IDEOGRAPHIC_SPACE: char = '\u{3000}';
|
const IDEOGRAPHIC_SPACE: char = '\u{3000}';
|
||||||
|
|
||||||
const C0_SYMBOLS: &'static [&'static str] = &[
|
const C0_SYMBOLS: &[&str] = &[
|
||||||
"␀", "␁", "␂", "␃", "␄", "␅", "␆", "␇", "␈", "␉", "␊", "␋", "␌", "␍", "␎", "␏", "␐", "␑", "␒",
|
"␀", "␁", "␂", "␃", "␄", "␅", "␆", "␇", "␈", "␉", "␊", "␋", "␌", "␍", "␎", "␏", "␐", "␑", "␒",
|
||||||
"␓", "␔", "␕", "␖", "␗", "␘", "␙", "␚", "␛", "␜", "␝", "␞", "␟",
|
"␓", "␔", "␕", "␖", "␗", "␘", "␙", "␚", "␛", "␜", "␝", "␞", "␟",
|
||||||
];
|
];
|
||||||
const DEL: &'static str = "␡";
|
const DEL: &str = "␡";
|
||||||
|
|
||||||
// generated using ucd-generate: ucd-generate general-category --include Format --chars ucd-16.0.0
|
// generated using ucd-generate: ucd-generate general-category --include Format --chars ucd-16.0.0
|
||||||
pub const FORMAT: &'static [(char, char)] = &[
|
pub const FORMAT: &[(char, char)] = &[
|
||||||
('\u{ad}', '\u{ad}'),
|
('\u{ad}', '\u{ad}'),
|
||||||
('\u{600}', '\u{605}'),
|
('\u{600}', '\u{605}'),
|
||||||
('\u{61c}', '\u{61c}'),
|
('\u{61c}', '\u{61c}'),
|
||||||
|
@ -93,7 +93,7 @@ pub const FORMAT: &'static [(char, char)] = &[
|
||||||
];
|
];
|
||||||
|
|
||||||
// hand-made base on https://invisible-characters.com (Excluding Cf)
|
// hand-made base on https://invisible-characters.com (Excluding Cf)
|
||||||
pub const OTHER: &'static [(char, char)] = &[
|
pub const OTHER: &[(char, char)] = &[
|
||||||
('\u{034f}', '\u{034f}'),
|
('\u{034f}', '\u{034f}'),
|
||||||
('\u{115F}', '\u{1160}'),
|
('\u{115F}', '\u{1160}'),
|
||||||
('\u{17b4}', '\u{17b5}'),
|
('\u{17b4}', '\u{17b5}'),
|
||||||
|
@ -107,7 +107,7 @@ pub const OTHER: &'static [(char, char)] = &[
|
||||||
];
|
];
|
||||||
|
|
||||||
// a subset of FORMAT/OTHER that may appear within glyphs
|
// a subset of FORMAT/OTHER that may appear within glyphs
|
||||||
const PRESERVE: &'static [(char, char)] = &[
|
const PRESERVE: &[(char, char)] = &[
|
||||||
('\u{034f}', '\u{034f}'),
|
('\u{034f}', '\u{034f}'),
|
||||||
('\u{200d}', '\u{200d}'),
|
('\u{200d}', '\u{200d}'),
|
||||||
('\u{17b4}', '\u{17b5}'),
|
('\u{17b4}', '\u{17b5}'),
|
||||||
|
|
|
@ -1943,26 +1943,24 @@ impl Editor {
|
||||||
let git_store = project.read(cx).git_store().clone();
|
let git_store = project.read(cx).git_store().clone();
|
||||||
let project = project.clone();
|
let project = project.clone();
|
||||||
project_subscriptions.push(cx.subscribe(&git_store, move |this, _, event, cx| {
|
project_subscriptions.push(cx.subscribe(&git_store, move |this, _, event, cx| {
|
||||||
match event {
|
if let GitStoreEvent::RepositoryUpdated(
|
||||||
GitStoreEvent::RepositoryUpdated(
|
_,
|
||||||
_,
|
RepositoryEvent::Updated {
|
||||||
RepositoryEvent::Updated {
|
new_instance: true, ..
|
||||||
new_instance: true, ..
|
},
|
||||||
},
|
_,
|
||||||
_,
|
) = event
|
||||||
) => {
|
{
|
||||||
this.load_diff_task = Some(
|
this.load_diff_task = Some(
|
||||||
update_uncommitted_diff_for_buffer(
|
update_uncommitted_diff_for_buffer(
|
||||||
cx.entity(),
|
cx.entity(),
|
||||||
&project,
|
&project,
|
||||||
this.buffer.read(cx).all_buffers(),
|
this.buffer.read(cx).all_buffers(),
|
||||||
this.buffer.clone(),
|
this.buffer.clone(),
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
.shared(),
|
.shared(),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -3221,35 +3219,31 @@ impl Editor {
|
||||||
selections.select_anchors(other_selections);
|
selections.select_anchors(other_selections);
|
||||||
});
|
});
|
||||||
|
|
||||||
let other_subscription =
|
let other_subscription = cx.subscribe(&other, |this, other, other_evt, cx| {
|
||||||
cx.subscribe(&other, |this, other, other_evt, cx| match other_evt {
|
if let EditorEvent::SelectionsChanged { local: true } = other_evt {
|
||||||
EditorEvent::SelectionsChanged { local: true } => {
|
let other_selections = other.read(cx).selections.disjoint.to_vec();
|
||||||
let other_selections = other.read(cx).selections.disjoint.to_vec();
|
if other_selections.is_empty() {
|
||||||
if other_selections.is_empty() {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.selections.change_with(cx, |selections| {
|
|
||||||
selections.select_anchors(other_selections);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
_ => {}
|
this.selections.change_with(cx, |selections| {
|
||||||
});
|
selections.select_anchors(other_selections);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let this_subscription =
|
let this_subscription = cx.subscribe_self::<EditorEvent>(move |this, this_evt, cx| {
|
||||||
cx.subscribe_self::<EditorEvent>(move |this, this_evt, cx| match this_evt {
|
if let EditorEvent::SelectionsChanged { local: true } = this_evt {
|
||||||
EditorEvent::SelectionsChanged { local: true } => {
|
let these_selections = this.selections.disjoint.to_vec();
|
||||||
let these_selections = this.selections.disjoint.to_vec();
|
if these_selections.is_empty() {
|
||||||
if these_selections.is_empty() {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
other.update(cx, |other_editor, cx| {
|
|
||||||
other_editor.selections.change_with(cx, |selections| {
|
|
||||||
selections.select_anchors(these_selections);
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
_ => {}
|
other.update(cx, |other_editor, cx| {
|
||||||
});
|
other_editor.selections.change_with(cx, |selections| {
|
||||||
|
selections.select_anchors(these_selections);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Subscription::join(other_subscription, this_subscription)
|
Subscription::join(other_subscription, this_subscription)
|
||||||
}
|
}
|
||||||
|
@ -5661,34 +5655,31 @@ impl Editor {
|
||||||
|
|
||||||
let Ok(()) = editor.update_in(cx, |editor, window, cx| {
|
let Ok(()) = editor.update_in(cx, |editor, window, cx| {
|
||||||
// Newer menu already set, so exit.
|
// Newer menu already set, so exit.
|
||||||
match editor.context_menu.borrow().as_ref() {
|
if let Some(CodeContextMenu::Completions(prev_menu)) =
|
||||||
Some(CodeContextMenu::Completions(prev_menu)) => {
|
editor.context_menu.borrow().as_ref()
|
||||||
if prev_menu.id > id {
|
&& prev_menu.id > id
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Only valid to take prev_menu because it the new menu is immediately set
|
// Only valid to take prev_menu because it the new menu is immediately set
|
||||||
// below, or the menu is hidden.
|
// below, or the menu is hidden.
|
||||||
match editor.context_menu.borrow_mut().take() {
|
if let Some(CodeContextMenu::Completions(prev_menu)) =
|
||||||
Some(CodeContextMenu::Completions(prev_menu)) => {
|
editor.context_menu.borrow_mut().take()
|
||||||
let position_matches =
|
{
|
||||||
if prev_menu.initial_position == menu.initial_position {
|
let position_matches =
|
||||||
true
|
if prev_menu.initial_position == menu.initial_position {
|
||||||
} else {
|
true
|
||||||
let snapshot = editor.buffer.read(cx).read(cx);
|
} else {
|
||||||
prev_menu.initial_position.to_offset(&snapshot)
|
let snapshot = editor.buffer.read(cx).read(cx);
|
||||||
== menu.initial_position.to_offset(&snapshot)
|
prev_menu.initial_position.to_offset(&snapshot)
|
||||||
};
|
== menu.initial_position.to_offset(&snapshot)
|
||||||
if position_matches {
|
};
|
||||||
// Preserve markdown cache before `set_filter_results` because it will
|
if position_matches {
|
||||||
// try to populate the documentation cache.
|
// Preserve markdown cache before `set_filter_results` because it will
|
||||||
menu.preserve_markdown_cache(prev_menu);
|
// try to populate the documentation cache.
|
||||||
}
|
menu.preserve_markdown_cache(prev_menu);
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
menu.set_filter_results(matches, provider, window, cx);
|
menu.set_filter_results(matches, provider, window, cx);
|
||||||
|
@ -6179,12 +6170,11 @@ impl Editor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Some(cx.background_spawn(async move {
|
Some(cx.background_spawn(async move {
|
||||||
let scenarios = futures::future::join_all(scenarios)
|
futures::future::join_all(scenarios)
|
||||||
.await
|
.await
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flatten()
|
.flatten()
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>()
|
||||||
scenarios
|
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| Task::ready(vec![]))
|
.unwrap_or_else(|| Task::ready(vec![]))
|
||||||
|
@ -7740,12 +7730,9 @@ impl Editor {
|
||||||
self.edit_prediction_settings =
|
self.edit_prediction_settings =
|
||||||
self.edit_prediction_settings_at_position(&buffer, cursor_buffer_position, cx);
|
self.edit_prediction_settings_at_position(&buffer, cursor_buffer_position, cx);
|
||||||
|
|
||||||
match self.edit_prediction_settings {
|
if let EditPredictionSettings::Disabled = self.edit_prediction_settings {
|
||||||
EditPredictionSettings::Disabled => {
|
self.discard_edit_prediction(false, cx);
|
||||||
self.discard_edit_prediction(false, cx);
|
return None;
|
||||||
return None;
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.edit_prediction_indent_conflict = multibuffer.is_line_whitespace_upto(cursor);
|
self.edit_prediction_indent_conflict = multibuffer.is_line_whitespace_upto(cursor);
|
||||||
|
@ -10638,8 +10625,7 @@ impl Editor {
|
||||||
.buffer_snapshot
|
.buffer_snapshot
|
||||||
.anchor_after(Point::new(row, line_len));
|
.anchor_after(Point::new(row, line_len));
|
||||||
|
|
||||||
let bp = self
|
self.breakpoint_store
|
||||||
.breakpoint_store
|
|
||||||
.as_ref()?
|
.as_ref()?
|
||||||
.read_with(cx, |breakpoint_store, cx| {
|
.read_with(cx, |breakpoint_store, cx| {
|
||||||
breakpoint_store
|
breakpoint_store
|
||||||
|
@ -10664,8 +10650,7 @@ impl Editor {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
})
|
||||||
bp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn edit_log_breakpoint(
|
pub fn edit_log_breakpoint(
|
||||||
|
@ -10701,7 +10686,7 @@ impl Editor {
|
||||||
let cursors = self
|
let cursors = self
|
||||||
.selections
|
.selections
|
||||||
.disjoint_anchors()
|
.disjoint_anchors()
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|selection| {
|
.map(|selection| {
|
||||||
let cursor_position: Point = selection.head().to_point(&snapshot.buffer_snapshot);
|
let cursor_position: Point = selection.head().to_point(&snapshot.buffer_snapshot);
|
||||||
|
|
||||||
|
@ -14878,7 +14863,7 @@ impl Editor {
|
||||||
let start = parent.start - offset;
|
let start = parent.start - offset;
|
||||||
offset += parent.len() - text.len();
|
offset += parent.len() - text.len();
|
||||||
selections.push(Selection {
|
selections.push(Selection {
|
||||||
id: id,
|
id,
|
||||||
start,
|
start,
|
||||||
end: start + text.len(),
|
end: start + text.len(),
|
||||||
reversed: false,
|
reversed: false,
|
||||||
|
@ -19202,7 +19187,7 @@ impl Editor {
|
||||||
let locations = self
|
let locations = self
|
||||||
.selections
|
.selections
|
||||||
.all_anchors(cx)
|
.all_anchors(cx)
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|selection| Location {
|
.map(|selection| Location {
|
||||||
buffer: buffer.clone(),
|
buffer: buffer.clone(),
|
||||||
range: selection.start.text_anchor..selection.end.text_anchor,
|
range: selection.start.text_anchor..selection.end.text_anchor,
|
||||||
|
@ -19914,11 +19899,8 @@ impl Editor {
|
||||||
event: &SessionEvent,
|
event: &SessionEvent,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
match event {
|
if let SessionEvent::InvalidateInlineValue = event {
|
||||||
SessionEvent::InvalidateInlineValue => {
|
self.refresh_inline_values(cx);
|
||||||
self.refresh_inline_values(cx);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21037,7 +21037,7 @@ fn assert_breakpoint(
|
||||||
let mut breakpoint = breakpoints
|
let mut breakpoint = breakpoints
|
||||||
.get(path)
|
.get(path)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|breakpoint| {
|
.map(|breakpoint| {
|
||||||
(
|
(
|
||||||
breakpoint.row,
|
breakpoint.row,
|
||||||
|
@ -23622,7 +23622,7 @@ pub fn handle_completion_request(
|
||||||
complete_from_position
|
complete_from_position
|
||||||
);
|
);
|
||||||
Ok(Some(lsp::CompletionResponse::List(lsp::CompletionList {
|
Ok(Some(lsp::CompletionResponse::List(lsp::CompletionList {
|
||||||
is_incomplete: is_incomplete,
|
is_incomplete,
|
||||||
item_defaults: None,
|
item_defaults: None,
|
||||||
items: completions
|
items: completions
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -724,7 +724,7 @@ impl EditorElement {
|
||||||
ColumnarMode::FromMouse => true,
|
ColumnarMode::FromMouse => true,
|
||||||
ColumnarMode::FromSelection => false,
|
ColumnarMode::FromSelection => false,
|
||||||
},
|
},
|
||||||
mode: mode,
|
mode,
|
||||||
goal_column: point_for_position.exact_unclipped.column(),
|
goal_column: point_for_position.exact_unclipped.column(),
|
||||||
},
|
},
|
||||||
window,
|
window,
|
||||||
|
@ -2437,14 +2437,13 @@ impl EditorElement {
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.padding as f32;
|
.padding as f32;
|
||||||
|
|
||||||
if let Some(edit_prediction) = editor.active_edit_prediction.as_ref() {
|
if let Some(edit_prediction) = editor.active_edit_prediction.as_ref()
|
||||||
match &edit_prediction.completion {
|
&& let EditPrediction::Edit {
|
||||||
EditPrediction::Edit {
|
display_mode: EditDisplayMode::TabAccept,
|
||||||
display_mode: EditDisplayMode::TabAccept,
|
..
|
||||||
..
|
} = &edit_prediction.completion
|
||||||
} => padding += INLINE_ACCEPT_SUGGESTION_EM_WIDTHS,
|
{
|
||||||
_ => {}
|
padding += INLINE_ACCEPT_SUGGESTION_EM_WIDTHS
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
padding * em_width
|
padding * em_width
|
||||||
|
@ -2978,8 +2977,8 @@ impl EditorElement {
|
||||||
.ilog10()
|
.ilog10()
|
||||||
+ 1;
|
+ 1;
|
||||||
|
|
||||||
let elements = buffer_rows
|
buffer_rows
|
||||||
.into_iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(ix, row_info)| {
|
.map(|(ix, row_info)| {
|
||||||
let ExpandInfo {
|
let ExpandInfo {
|
||||||
|
@ -3034,9 +3033,7 @@ impl EditorElement {
|
||||||
|
|
||||||
Some((toggle, origin))
|
Some((toggle, origin))
|
||||||
})
|
})
|
||||||
.collect();
|
.collect()
|
||||||
|
|
||||||
elements
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn calculate_relative_line_numbers(
|
fn calculate_relative_line_numbers(
|
||||||
|
@ -3136,7 +3133,7 @@ impl EditorElement {
|
||||||
let relative_rows = self.calculate_relative_line_numbers(snapshot, &rows, relative_to);
|
let relative_rows = self.calculate_relative_line_numbers(snapshot, &rows, relative_to);
|
||||||
let mut line_number = String::new();
|
let mut line_number = String::new();
|
||||||
let line_numbers = buffer_rows
|
let line_numbers = buffer_rows
|
||||||
.into_iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.flat_map(|(ix, row_info)| {
|
.flat_map(|(ix, row_info)| {
|
||||||
let display_row = DisplayRow(rows.start.0 + ix as u32);
|
let display_row = DisplayRow(rows.start.0 + ix as u32);
|
||||||
|
@ -3213,7 +3210,7 @@ impl EditorElement {
|
||||||
&& self.editor.read(cx).is_singleton(cx);
|
&& self.editor.read(cx).is_singleton(cx);
|
||||||
if include_fold_statuses {
|
if include_fold_statuses {
|
||||||
row_infos
|
row_infos
|
||||||
.into_iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(ix, info)| {
|
.map(|(ix, info)| {
|
||||||
if info.expand_info.is_some() {
|
if info.expand_info.is_some() {
|
||||||
|
|
|
@ -213,8 +213,8 @@ impl GitBlame {
|
||||||
let project_subscription = cx.subscribe(&project, {
|
let project_subscription = cx.subscribe(&project, {
|
||||||
let buffer = buffer.clone();
|
let buffer = buffer.clone();
|
||||||
|
|
||||||
move |this, _, event, cx| match event {
|
move |this, _, event, cx| {
|
||||||
project::Event::WorktreeUpdatedEntries(_, updated) => {
|
if let project::Event::WorktreeUpdatedEntries(_, updated) = event {
|
||||||
let project_entry_id = buffer.read(cx).entry_id(cx);
|
let project_entry_id = buffer.read(cx).entry_id(cx);
|
||||||
if updated
|
if updated
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -224,7 +224,6 @@ impl GitBlame {
|
||||||
this.generate(cx);
|
this.generate(cx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -292,7 +291,7 @@ impl GitBlame {
|
||||||
|
|
||||||
let buffer_id = self.buffer_snapshot.remote_id();
|
let buffer_id = self.buffer_snapshot.remote_id();
|
||||||
let mut cursor = self.entries.cursor::<u32>(&());
|
let mut cursor = self.entries.cursor::<u32>(&());
|
||||||
rows.into_iter().map(move |info| {
|
rows.iter().map(move |info| {
|
||||||
let row = info
|
let row = info
|
||||||
.buffer_row
|
.buffer_row
|
||||||
.filter(|_| info.buffer_id == Some(buffer_id))?;
|
.filter(|_| info.buffer_id == Some(buffer_id))?;
|
||||||
|
|
|
@ -603,18 +603,15 @@ async fn parse_blocks(
|
||||||
})
|
})
|
||||||
.join("\n\n");
|
.join("\n\n");
|
||||||
|
|
||||||
let rendered_block = cx
|
cx.new_window_entity(|_window, cx| {
|
||||||
.new_window_entity(|_window, cx| {
|
Markdown::new(
|
||||||
Markdown::new(
|
combined_text.into(),
|
||||||
combined_text.into(),
|
language_registry.cloned(),
|
||||||
language_registry.cloned(),
|
language.map(|language| language.name()),
|
||||||
language.map(|language| language.name()),
|
cx,
|
||||||
cx,
|
)
|
||||||
)
|
})
|
||||||
})
|
.ok()
|
||||||
.ok();
|
|
||||||
|
|
||||||
rendered_block
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hover_markdown_style(window: &Window, cx: &App) -> MarkdownStyle {
|
pub fn hover_markdown_style(window: &Window, cx: &App) -> MarkdownStyle {
|
||||||
|
|
|
@ -1009,16 +1009,12 @@ impl Item for Editor {
|
||||||
) {
|
) {
|
||||||
self.workspace = Some((workspace.weak_handle(), workspace.database_id()));
|
self.workspace = Some((workspace.weak_handle(), workspace.database_id()));
|
||||||
if let Some(workspace) = &workspace.weak_handle().upgrade() {
|
if let Some(workspace) = &workspace.weak_handle().upgrade() {
|
||||||
cx.subscribe(
|
cx.subscribe(workspace, |editor, _, event: &workspace::Event, _cx| {
|
||||||
workspace,
|
if let workspace::Event::ModalOpened = event {
|
||||||
|editor, _, event: &workspace::Event, _cx| match event {
|
editor.mouse_context_menu.take();
|
||||||
workspace::Event::ModalOpened => {
|
editor.inline_blame_popover.take();
|
||||||
editor.mouse_context_menu.take();
|
}
|
||||||
editor.inline_blame_popover.take();
|
})
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.detach();
|
.detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -808,10 +808,7 @@ mod jsx_tag_autoclose_tests {
|
||||||
);
|
);
|
||||||
buf
|
buf
|
||||||
});
|
});
|
||||||
let buffer_c = cx.new(|cx| {
|
let buffer_c = cx.new(|cx| language::Buffer::local("<span", cx));
|
||||||
let buf = language::Buffer::local("<span", cx);
|
|
||||||
buf
|
|
||||||
});
|
|
||||||
let buffer = cx.new(|cx| {
|
let buffer = cx.new(|cx| {
|
||||||
let mut buf = MultiBuffer::new(language::Capability::ReadWrite);
|
let mut buf = MultiBuffer::new(language::Capability::ReadWrite);
|
||||||
buf.push_excerpts(
|
buf.push_excerpts(
|
||||||
|
|
|
@ -241,24 +241,13 @@ impl ProposedChangesEditor {
|
||||||
event: &BufferEvent,
|
event: &BufferEvent,
|
||||||
_cx: &mut Context<Self>,
|
_cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
match event {
|
if let BufferEvent::Operation { .. } = event {
|
||||||
BufferEvent::Operation { .. } => {
|
self.recalculate_diffs_tx
|
||||||
self.recalculate_diffs_tx
|
.unbounded_send(RecalculateDiff {
|
||||||
.unbounded_send(RecalculateDiff {
|
buffer,
|
||||||
buffer,
|
debounce: true,
|
||||||
debounce: true,
|
})
|
||||||
})
|
.ok();
|
||||||
.ok();
|
|
||||||
}
|
|
||||||
// BufferEvent::DiffBaseChanged => {
|
|
||||||
// self.recalculate_diffs_tx
|
|
||||||
// .unbounded_send(RecalculateDiff {
|
|
||||||
// buffer,
|
|
||||||
// debounce: false,
|
|
||||||
// })
|
|
||||||
// .ok();
|
|
||||||
// }
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,8 +119,8 @@ impl SelectionsCollection {
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> Option<Selection<D>> {
|
) -> Option<Selection<D>> {
|
||||||
let map = self.display_map(cx);
|
let map = self.display_map(cx);
|
||||||
let selection = resolve_selections(self.pending_anchor().as_ref(), &map).next();
|
|
||||||
selection
|
resolve_selections(self.pending_anchor().as_ref(), &map).next()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn pending_mode(&self) -> Option<SelectMode> {
|
pub(crate) fn pending_mode(&self) -> Option<SelectMode> {
|
||||||
|
@ -276,18 +276,18 @@ impl SelectionsCollection {
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> Selection<D> {
|
) -> Selection<D> {
|
||||||
let map = self.display_map(cx);
|
let map = self.display_map(cx);
|
||||||
let selection = resolve_selections([self.newest_anchor()], &map)
|
|
||||||
|
resolve_selections([self.newest_anchor()], &map)
|
||||||
.next()
|
.next()
|
||||||
.unwrap();
|
.unwrap()
|
||||||
selection
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn newest_display(&self, cx: &mut App) -> Selection<DisplayPoint> {
|
pub fn newest_display(&self, cx: &mut App) -> Selection<DisplayPoint> {
|
||||||
let map = self.display_map(cx);
|
let map = self.display_map(cx);
|
||||||
let selection = resolve_selections_display([self.newest_anchor()], &map)
|
|
||||||
|
resolve_selections_display([self.newest_anchor()], &map)
|
||||||
.next()
|
.next()
|
||||||
.unwrap();
|
.unwrap()
|
||||||
selection
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn oldest_anchor(&self) -> &Selection<Anchor> {
|
pub fn oldest_anchor(&self) -> &Selection<Anchor> {
|
||||||
|
@ -303,10 +303,10 @@ impl SelectionsCollection {
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> Selection<D> {
|
) -> Selection<D> {
|
||||||
let map = self.display_map(cx);
|
let map = self.display_map(cx);
|
||||||
let selection = resolve_selections([self.oldest_anchor()], &map)
|
|
||||||
|
resolve_selections([self.oldest_anchor()], &map)
|
||||||
.next()
|
.next()
|
||||||
.unwrap();
|
.unwrap()
|
||||||
selection
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn first_anchor(&self) -> Selection<Anchor> {
|
pub fn first_anchor(&self) -> Selection<Anchor> {
|
||||||
|
|
|
@ -678,8 +678,8 @@ pub fn wait_for_lang_server(
|
||||||
[
|
[
|
||||||
cx.subscribe(&lsp_store, {
|
cx.subscribe(&lsp_store, {
|
||||||
let log_prefix = log_prefix.clone();
|
let log_prefix = log_prefix.clone();
|
||||||
move |_, event, _| match event {
|
move |_, event, _| {
|
||||||
project::LspStoreEvent::LanguageServerUpdate {
|
if let project::LspStoreEvent::LanguageServerUpdate {
|
||||||
message:
|
message:
|
||||||
client::proto::update_language_server::Variant::WorkProgress(
|
client::proto::update_language_server::Variant::WorkProgress(
|
||||||
LspWorkProgress {
|
LspWorkProgress {
|
||||||
|
@ -688,8 +688,10 @@ pub fn wait_for_lang_server(
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
..
|
..
|
||||||
} => println!("{}⟲ {message}", log_prefix),
|
} = event
|
||||||
_ => {}
|
{
|
||||||
|
println!("{}⟲ {message}", log_prefix)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
cx.subscribe(project, {
|
cx.subscribe(project, {
|
||||||
|
|
|
@ -484,14 +484,10 @@ impl ExtensionBuilder {
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
match &payload {
|
if let CustomSection(c) = &payload
|
||||||
CustomSection(c) => {
|
&& strip_custom_section(c.name())
|
||||||
if strip_custom_section(c.name()) {
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
if let Some((id, range)) = payload.as_section() {
|
if let Some((id, range)) = payload.as_section() {
|
||||||
RawSection {
|
RawSection {
|
||||||
|
|
|
@ -1675,9 +1675,8 @@ impl ExtensionStore {
|
||||||
let schema_path = &extension::build_debug_adapter_schema_path(adapter_name, meta);
|
let schema_path = &extension::build_debug_adapter_schema_path(adapter_name, meta);
|
||||||
|
|
||||||
if fs.is_file(&src_dir.join(schema_path)).await {
|
if fs.is_file(&src_dir.join(schema_path)).await {
|
||||||
match schema_path.parent() {
|
if let Some(parent) = schema_path.parent() {
|
||||||
Some(parent) => fs.create_dir(&tmp_dir.join(parent)).await?,
|
fs.create_dir(&tmp_dir.join(parent)).await?
|
||||||
None => {}
|
|
||||||
}
|
}
|
||||||
fs.copy_file(
|
fs.copy_file(
|
||||||
&src_dir.join(schema_path),
|
&src_dir.join(schema_path),
|
||||||
|
|
|
@ -532,7 +532,7 @@ fn wasm_engine(executor: &BackgroundExecutor) -> wasmtime::Engine {
|
||||||
// `Future::poll`.
|
// `Future::poll`.
|
||||||
const EPOCH_INTERVAL: Duration = Duration::from_millis(100);
|
const EPOCH_INTERVAL: Duration = Duration::from_millis(100);
|
||||||
let mut timer = Timer::interval(EPOCH_INTERVAL);
|
let mut timer = Timer::interval(EPOCH_INTERVAL);
|
||||||
while let Some(_) = timer.next().await {
|
while (timer.next().await).is_some() {
|
||||||
// Exit the loop and thread once the engine is dropped.
|
// Exit the loop and thread once the engine is dropped.
|
||||||
let Some(engine) = engine_ref.upgrade() else {
|
let Some(engine) = engine_ref.upgrade() else {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -863,7 +863,7 @@ impl ExtensionsPage {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> Entity<ContextMenu> {
|
) -> Entity<ContextMenu> {
|
||||||
let context_menu = ContextMenu::build(window, cx, |context_menu, window, _| {
|
ContextMenu::build(window, cx, |context_menu, window, _| {
|
||||||
context_menu
|
context_menu
|
||||||
.entry(
|
.entry(
|
||||||
"Install Another Version...",
|
"Install Another Version...",
|
||||||
|
@ -887,9 +887,7 @@ impl ExtensionsPage {
|
||||||
cx.write_to_clipboard(ClipboardItem::new_string(authors.join(", ")));
|
cx.write_to_clipboard(ClipboardItem::new_string(authors.join(", ")));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
context_menu
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_extension_version_list(
|
fn show_extension_version_list(
|
||||||
|
|
|
@ -112,7 +112,7 @@ impl OpenPathDelegate {
|
||||||
entries,
|
entries,
|
||||||
..
|
..
|
||||||
} => user_input
|
} => user_input
|
||||||
.into_iter()
|
.iter()
|
||||||
.filter(|user_input| !user_input.exists || !user_input.is_dir)
|
.filter(|user_input| !user_input.exists || !user_input.is_dir)
|
||||||
.map(|user_input| user_input.file.string.clone())
|
.map(|user_input| user_input.file.string.clone())
|
||||||
.chain(self.string_matches.iter().filter_map(|string_match| {
|
.chain(self.string_matches.iter().filter_map(|string_match| {
|
||||||
|
|
|
@ -2419,12 +2419,11 @@ impl Fs for FakeFs {
|
||||||
let watcher = watcher.clone();
|
let watcher = watcher.clone();
|
||||||
move |events| {
|
move |events| {
|
||||||
let result = events.iter().any(|evt_path| {
|
let result = events.iter().any(|evt_path| {
|
||||||
let result = watcher
|
watcher
|
||||||
.prefixes
|
.prefixes
|
||||||
.lock()
|
.lock()
|
||||||
.iter()
|
.iter()
|
||||||
.any(|prefix| evt_path.path.starts_with(prefix));
|
.any(|prefix| evt_path.path.starts_with(prefix))
|
||||||
result
|
|
||||||
});
|
});
|
||||||
let executor = executor.clone();
|
let executor = executor.clone();
|
||||||
async move {
|
async move {
|
||||||
|
|
|
@ -2028,7 +2028,7 @@ fn parse_branch_input(input: &str) -> Result<Vec<Branch>> {
|
||||||
|
|
||||||
branches.push(Branch {
|
branches.push(Branch {
|
||||||
is_head: is_current_branch,
|
is_head: is_current_branch,
|
||||||
ref_name: ref_name,
|
ref_name,
|
||||||
most_recent_commit: Some(CommitSummary {
|
most_recent_commit: Some(CommitSummary {
|
||||||
sha: head_sha,
|
sha: head_sha,
|
||||||
subject,
|
subject,
|
||||||
|
|
|
@ -123,7 +123,7 @@ impl FileDiffView {
|
||||||
old_buffer,
|
old_buffer,
|
||||||
new_buffer,
|
new_buffer,
|
||||||
_recalculate_diff_task: cx.spawn(async move |this, cx| {
|
_recalculate_diff_task: cx.spawn(async move |this, cx| {
|
||||||
while let Ok(_) = buffer_changes_rx.recv().await {
|
while buffer_changes_rx.recv().await.is_ok() {
|
||||||
loop {
|
loop {
|
||||||
let mut timer = cx
|
let mut timer = cx
|
||||||
.background_executor()
|
.background_executor()
|
||||||
|
|
|
@ -426,7 +426,7 @@ impl GitPanel {
|
||||||
let git_store = project.read(cx).git_store().clone();
|
let git_store = project.read(cx).git_store().clone();
|
||||||
let active_repository = project.read(cx).active_repository(cx);
|
let active_repository = project.read(cx).active_repository(cx);
|
||||||
|
|
||||||
let git_panel = cx.new(|cx| {
|
cx.new(|cx| {
|
||||||
let focus_handle = cx.focus_handle();
|
let focus_handle = cx.focus_handle();
|
||||||
cx.on_focus(&focus_handle, window, Self::focus_in).detach();
|
cx.on_focus(&focus_handle, window, Self::focus_in).detach();
|
||||||
cx.on_focus_out(&focus_handle, window, |this, _, window, cx| {
|
cx.on_focus_out(&focus_handle, window, |this, _, window, cx| {
|
||||||
|
@ -563,9 +563,7 @@ impl GitPanel {
|
||||||
|
|
||||||
this.schedule_update(false, window, cx);
|
this.schedule_update(false, window, cx);
|
||||||
this
|
this
|
||||||
});
|
})
|
||||||
|
|
||||||
git_panel
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hide_scrollbars(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
fn hide_scrollbars(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
|
@ -1198,14 +1196,13 @@ impl GitPanel {
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
cx.spawn(async move |this, cx| match prompt.await {
|
cx.spawn(async move |this, cx| {
|
||||||
Ok(RestoreCancel::RestoreTrackedFiles) => {
|
if let Ok(RestoreCancel::RestoreTrackedFiles) = prompt.await {
|
||||||
this.update(cx, |this, cx| {
|
this.update(cx, |this, cx| {
|
||||||
this.perform_checkout(entries, cx);
|
this.perform_checkout(entries, cx);
|
||||||
})
|
})
|
||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,22 +346,19 @@ impl ProjectDiff {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
match event {
|
if let EditorEvent::SelectionsChanged { local: true } = event {
|
||||||
EditorEvent::SelectionsChanged { local: true } => {
|
let Some(project_path) = self.active_path(cx) else {
|
||||||
let Some(project_path) = self.active_path(cx) else {
|
return;
|
||||||
return;
|
};
|
||||||
};
|
self.workspace
|
||||||
self.workspace
|
.update(cx, |workspace, cx| {
|
||||||
.update(cx, |workspace, cx| {
|
if let Some(git_panel) = workspace.panel::<GitPanel>(cx) {
|
||||||
if let Some(git_panel) = workspace.panel::<GitPanel>(cx) {
|
git_panel.update(cx, |git_panel, cx| {
|
||||||
git_panel.update(cx, |git_panel, cx| {
|
git_panel.select_entry_by_path(project_path, window, cx)
|
||||||
git_panel.select_entry_by_path(project_path, window, cx)
|
})
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
})
|
.ok();
|
||||||
.ok();
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
if editor.focus_handle(cx).contains_focused(window, cx)
|
if editor.focus_handle(cx).contains_focused(window, cx)
|
||||||
&& self.multibuffer.read(cx).is_empty()
|
&& self.multibuffer.read(cx).is_empty()
|
||||||
|
@ -513,7 +510,7 @@ impl ProjectDiff {
|
||||||
mut recv: postage::watch::Receiver<()>,
|
mut recv: postage::watch::Receiver<()>,
|
||||||
cx: &mut AsyncWindowContext,
|
cx: &mut AsyncWindowContext,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
while let Some(_) = recv.next().await {
|
while (recv.next().await).is_some() {
|
||||||
let buffers_to_load = this.update(cx, |this, cx| this.load_buffers(cx))?;
|
let buffers_to_load = this.update(cx, |this, cx| this.load_buffers(cx))?;
|
||||||
for buffer_to_load in buffers_to_load {
|
for buffer_to_load in buffers_to_load {
|
||||||
if let Some(buffer) = buffer_to_load.await.log_err() {
|
if let Some(buffer) = buffer_to_load.await.log_err() {
|
||||||
|
|
|
@ -207,7 +207,7 @@ impl TextDiffView {
|
||||||
path: Some(format!("Clipboard ↔ {selection_location_path}").into()),
|
path: Some(format!("Clipboard ↔ {selection_location_path}").into()),
|
||||||
buffer_changes_tx,
|
buffer_changes_tx,
|
||||||
_recalculate_diff_task: cx.spawn(async move |_, cx| {
|
_recalculate_diff_task: cx.spawn(async move |_, cx| {
|
||||||
while let Ok(_) = buffer_changes_rx.recv().await {
|
while buffer_changes_rx.recv().await.is_ok() {
|
||||||
loop {
|
loop {
|
||||||
let mut timer = cx
|
let mut timer = cx
|
||||||
.background_executor()
|
.background_executor()
|
||||||
|
|
|
@ -1707,8 +1707,8 @@ impl App {
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
is_first = true;
|
is_first = true;
|
||||||
let future = A::load(source.clone(), self);
|
let future = A::load(source.clone(), self);
|
||||||
let task = self.background_executor().spawn(future).shared();
|
|
||||||
task
|
self.background_executor().spawn(future).shared()
|
||||||
});
|
});
|
||||||
|
|
||||||
self.loading_assets.insert(asset_id, Box::new(task.clone()));
|
self.loading_assets.insert(asset_id, Box::new(task.clone()));
|
||||||
|
|
|
@ -326,7 +326,7 @@ impl TextLayout {
|
||||||
vec![text_style.to_run(text.len())]
|
vec![text_style.to_run(text.len())]
|
||||||
};
|
};
|
||||||
|
|
||||||
let layout_id = window.request_measured_layout(Default::default(), {
|
window.request_measured_layout(Default::default(), {
|
||||||
let element_state = self.clone();
|
let element_state = self.clone();
|
||||||
|
|
||||||
move |known_dimensions, available_space, window, cx| {
|
move |known_dimensions, available_space, window, cx| {
|
||||||
|
@ -416,9 +416,7 @@ impl TextLayout {
|
||||||
|
|
||||||
size
|
size
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
layout_id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepaint(&self, bounds: Bounds<Pixels>, text: &str) {
|
fn prepaint(&self, bounds: Bounds<Pixels>, text: &str) {
|
||||||
|
|
|
@ -949,11 +949,8 @@ impl Dispatch<WlCallback, ObjectId> for WaylandClientStatePtr {
|
||||||
};
|
};
|
||||||
drop(state);
|
drop(state);
|
||||||
|
|
||||||
match event {
|
if let wl_callback::Event::Done { .. } = event {
|
||||||
wl_callback::Event::Done { .. } => {
|
window.frame();
|
||||||
window.frame();
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2014,25 +2011,22 @@ impl Dispatch<wl_data_offer::WlDataOffer, ()> for WaylandClientStatePtr {
|
||||||
let client = this.get_client();
|
let client = this.get_client();
|
||||||
let mut state = client.borrow_mut();
|
let mut state = client.borrow_mut();
|
||||||
|
|
||||||
match event {
|
if let wl_data_offer::Event::Offer { mime_type } = event {
|
||||||
wl_data_offer::Event::Offer { mime_type } => {
|
// Drag and drop
|
||||||
// Drag and drop
|
if mime_type == FILE_LIST_MIME_TYPE {
|
||||||
if mime_type == FILE_LIST_MIME_TYPE {
|
let serial = state.serial_tracker.get(SerialKind::DataDevice);
|
||||||
let serial = state.serial_tracker.get(SerialKind::DataDevice);
|
let mime_type = mime_type.clone();
|
||||||
let mime_type = mime_type.clone();
|
data_offer.accept(serial, Some(mime_type));
|
||||||
data_offer.accept(serial, Some(mime_type));
|
}
|
||||||
}
|
|
||||||
|
// Clipboard
|
||||||
// Clipboard
|
if let Some(offer) = state
|
||||||
if let Some(offer) = state
|
.data_offers
|
||||||
.data_offers
|
.iter_mut()
|
||||||
.iter_mut()
|
.find(|wrapper| wrapper.inner.id() == data_offer.id())
|
||||||
.find(|wrapper| wrapper.inner.id() == data_offer.id())
|
{
|
||||||
{
|
offer.add_mime_type(mime_type);
|
||||||
offer.add_mime_type(mime_type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2113,13 +2107,10 @@ impl Dispatch<zwp_primary_selection_offer_v1::ZwpPrimarySelectionOfferV1, ()>
|
||||||
let client = this.get_client();
|
let client = this.get_client();
|
||||||
let mut state = client.borrow_mut();
|
let mut state = client.borrow_mut();
|
||||||
|
|
||||||
match event {
|
if let zwp_primary_selection_offer_v1::Event::Offer { mime_type } = event
|
||||||
zwp_primary_selection_offer_v1::Event::Offer { mime_type } => {
|
&& let Some(offer) = state.primary_data_offer.as_mut()
|
||||||
if let Some(offer) = state.primary_data_offer.as_mut() {
|
{
|
||||||
offer.add_mime_type(mime_type);
|
offer.add_mime_type(mime_type);
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,85 +355,82 @@ impl WaylandWindowStatePtr {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_xdg_surface_event(&self, event: xdg_surface::Event) {
|
pub fn handle_xdg_surface_event(&self, event: xdg_surface::Event) {
|
||||||
match event {
|
if let xdg_surface::Event::Configure { serial } = event {
|
||||||
xdg_surface::Event::Configure { serial } => {
|
{
|
||||||
{
|
|
||||||
let mut state = self.state.borrow_mut();
|
|
||||||
if let Some(window_controls) = state.in_progress_window_controls.take() {
|
|
||||||
state.window_controls = window_controls;
|
|
||||||
|
|
||||||
drop(state);
|
|
||||||
let mut callbacks = self.callbacks.borrow_mut();
|
|
||||||
if let Some(appearance_changed) = callbacks.appearance_changed.as_mut() {
|
|
||||||
appearance_changed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
let mut state = self.state.borrow_mut();
|
|
||||||
|
|
||||||
if let Some(mut configure) = state.in_progress_configure.take() {
|
|
||||||
let got_unmaximized = state.maximized && !configure.maximized;
|
|
||||||
state.fullscreen = configure.fullscreen;
|
|
||||||
state.maximized = configure.maximized;
|
|
||||||
state.tiling = configure.tiling;
|
|
||||||
// Limit interactive resizes to once per vblank
|
|
||||||
if configure.resizing && state.resize_throttle {
|
|
||||||
return;
|
|
||||||
} else if configure.resizing {
|
|
||||||
state.resize_throttle = true;
|
|
||||||
}
|
|
||||||
if !configure.fullscreen && !configure.maximized {
|
|
||||||
configure.size = if got_unmaximized {
|
|
||||||
Some(state.window_bounds.size)
|
|
||||||
} else {
|
|
||||||
compute_outer_size(state.inset(), configure.size, state.tiling)
|
|
||||||
};
|
|
||||||
if let Some(size) = configure.size {
|
|
||||||
state.window_bounds = Bounds {
|
|
||||||
origin: Point::default(),
|
|
||||||
size,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
drop(state);
|
|
||||||
if let Some(size) = configure.size {
|
|
||||||
self.resize(size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let mut state = self.state.borrow_mut();
|
let mut state = self.state.borrow_mut();
|
||||||
state.xdg_surface.ack_configure(serial);
|
if let Some(window_controls) = state.in_progress_window_controls.take() {
|
||||||
|
state.window_controls = window_controls;
|
||||||
|
|
||||||
let window_geometry = inset_by_tiling(
|
|
||||||
state.bounds.map_origin(|_| px(0.0)),
|
|
||||||
state.inset(),
|
|
||||||
state.tiling,
|
|
||||||
)
|
|
||||||
.map(|v| v.0 as i32)
|
|
||||||
.map_size(|v| if v <= 0 { 1 } else { v });
|
|
||||||
|
|
||||||
state.xdg_surface.set_window_geometry(
|
|
||||||
window_geometry.origin.x,
|
|
||||||
window_geometry.origin.y,
|
|
||||||
window_geometry.size.width,
|
|
||||||
window_geometry.size.height,
|
|
||||||
);
|
|
||||||
|
|
||||||
let request_frame_callback = !state.acknowledged_first_configure;
|
|
||||||
if request_frame_callback {
|
|
||||||
state.acknowledged_first_configure = true;
|
|
||||||
drop(state);
|
drop(state);
|
||||||
self.frame();
|
let mut callbacks = self.callbacks.borrow_mut();
|
||||||
|
if let Some(appearance_changed) = callbacks.appearance_changed.as_mut() {
|
||||||
|
appearance_changed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
{
|
||||||
|
let mut state = self.state.borrow_mut();
|
||||||
|
|
||||||
|
if let Some(mut configure) = state.in_progress_configure.take() {
|
||||||
|
let got_unmaximized = state.maximized && !configure.maximized;
|
||||||
|
state.fullscreen = configure.fullscreen;
|
||||||
|
state.maximized = configure.maximized;
|
||||||
|
state.tiling = configure.tiling;
|
||||||
|
// Limit interactive resizes to once per vblank
|
||||||
|
if configure.resizing && state.resize_throttle {
|
||||||
|
return;
|
||||||
|
} else if configure.resizing {
|
||||||
|
state.resize_throttle = true;
|
||||||
|
}
|
||||||
|
if !configure.fullscreen && !configure.maximized {
|
||||||
|
configure.size = if got_unmaximized {
|
||||||
|
Some(state.window_bounds.size)
|
||||||
|
} else {
|
||||||
|
compute_outer_size(state.inset(), configure.size, state.tiling)
|
||||||
|
};
|
||||||
|
if let Some(size) = configure.size {
|
||||||
|
state.window_bounds = Bounds {
|
||||||
|
origin: Point::default(),
|
||||||
|
size,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drop(state);
|
||||||
|
if let Some(size) = configure.size {
|
||||||
|
self.resize(size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let mut state = self.state.borrow_mut();
|
||||||
|
state.xdg_surface.ack_configure(serial);
|
||||||
|
|
||||||
|
let window_geometry = inset_by_tiling(
|
||||||
|
state.bounds.map_origin(|_| px(0.0)),
|
||||||
|
state.inset(),
|
||||||
|
state.tiling,
|
||||||
|
)
|
||||||
|
.map(|v| v.0 as i32)
|
||||||
|
.map_size(|v| if v <= 0 { 1 } else { v });
|
||||||
|
|
||||||
|
state.xdg_surface.set_window_geometry(
|
||||||
|
window_geometry.origin.x,
|
||||||
|
window_geometry.origin.y,
|
||||||
|
window_geometry.size.width,
|
||||||
|
window_geometry.size.height,
|
||||||
|
);
|
||||||
|
|
||||||
|
let request_frame_callback = !state.acknowledged_first_configure;
|
||||||
|
if request_frame_callback {
|
||||||
|
state.acknowledged_first_configure = true;
|
||||||
|
drop(state);
|
||||||
|
self.frame();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_toplevel_decoration_event(&self, event: zxdg_toplevel_decoration_v1::Event) {
|
pub fn handle_toplevel_decoration_event(&self, event: zxdg_toplevel_decoration_v1::Event) {
|
||||||
match event {
|
if let zxdg_toplevel_decoration_v1::Event::Configure { mode } = event {
|
||||||
zxdg_toplevel_decoration_v1::Event::Configure { mode } => match mode {
|
match mode {
|
||||||
WEnum::Value(zxdg_toplevel_decoration_v1::Mode::ServerSide) => {
|
WEnum::Value(zxdg_toplevel_decoration_v1::Mode::ServerSide) => {
|
||||||
self.state.borrow_mut().decorations = WindowDecorations::Server;
|
self.state.borrow_mut().decorations = WindowDecorations::Server;
|
||||||
if let Some(mut appearance_changed) =
|
if let Some(mut appearance_changed) =
|
||||||
|
@ -457,17 +454,13 @@ impl WaylandWindowStatePtr {
|
||||||
WEnum::Unknown(v) => {
|
WEnum::Unknown(v) => {
|
||||||
log::warn!("Unknown decoration mode: {}", v);
|
log::warn!("Unknown decoration mode: {}", v);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_fractional_scale_event(&self, event: wp_fractional_scale_v1::Event) {
|
pub fn handle_fractional_scale_event(&self, event: wp_fractional_scale_v1::Event) {
|
||||||
match event {
|
if let wp_fractional_scale_v1::Event::PreferredScale { scale } = event {
|
||||||
wp_fractional_scale_v1::Event::PreferredScale { scale } => {
|
self.rescale(scale as f32 / 120.0);
|
||||||
self.rescale(scale as f32 / 120.0);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,15 +232,12 @@ impl X11ClientStatePtr {
|
||||||
};
|
};
|
||||||
let mut state = client.0.borrow_mut();
|
let mut state = client.0.borrow_mut();
|
||||||
|
|
||||||
if let Some(window_ref) = state.windows.remove(&x_window) {
|
if let Some(window_ref) = state.windows.remove(&x_window)
|
||||||
match window_ref.refresh_state {
|
&& let Some(RefreshState::PeriodicRefresh {
|
||||||
Some(RefreshState::PeriodicRefresh {
|
event_loop_token, ..
|
||||||
event_loop_token, ..
|
}) = window_ref.refresh_state
|
||||||
}) => {
|
{
|
||||||
state.loop_handle.remove(event_loop_token);
|
state.loop_handle.remove(event_loop_token);
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if state.mouse_focused_window == Some(x_window) {
|
if state.mouse_focused_window == Some(x_window) {
|
||||||
state.mouse_focused_window = None;
|
state.mouse_focused_window = None;
|
||||||
|
@ -876,22 +873,19 @@ impl X11Client {
|
||||||
let Some(reply) = reply else {
|
let Some(reply) = reply else {
|
||||||
return Some(());
|
return Some(());
|
||||||
};
|
};
|
||||||
match str::from_utf8(&reply.value) {
|
if let Ok(file_list) = str::from_utf8(&reply.value) {
|
||||||
Ok(file_list) => {
|
let paths: SmallVec<[_; 2]> = file_list
|
||||||
let paths: SmallVec<[_; 2]> = file_list
|
.lines()
|
||||||
.lines()
|
.filter_map(|path| Url::parse(path).log_err())
|
||||||
.filter_map(|path| Url::parse(path).log_err())
|
.filter_map(|url| url.to_file_path().log_err())
|
||||||
.filter_map(|url| url.to_file_path().log_err())
|
.collect();
|
||||||
.collect();
|
let input = PlatformInput::FileDrop(FileDropEvent::Entered {
|
||||||
let input = PlatformInput::FileDrop(FileDropEvent::Entered {
|
position: state.xdnd_state.position,
|
||||||
position: state.xdnd_state.position,
|
paths: crate::ExternalPaths(paths),
|
||||||
paths: crate::ExternalPaths(paths),
|
});
|
||||||
});
|
drop(state);
|
||||||
drop(state);
|
window.handle_input(input);
|
||||||
window.handle_input(input);
|
self.0.borrow_mut().xdnd_state.retrieved = true;
|
||||||
self.0.borrow_mut().xdnd_state.retrieved = true;
|
|
||||||
}
|
|
||||||
Err(_) => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::ConfigureNotify(event) => {
|
Event::ConfigureNotify(event) => {
|
||||||
|
|
|
@ -426,7 +426,7 @@ unsafe fn parse_keystroke(native_event: id) -> Keystroke {
|
||||||
key_char = Some(chars_for_modified_key(native_event.keyCode(), mods));
|
key_char = Some(chars_for_modified_key(native_event.keyCode(), mods));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut key = if shift
|
if shift
|
||||||
&& chars_ignoring_modifiers
|
&& chars_ignoring_modifiers
|
||||||
.chars()
|
.chars()
|
||||||
.all(|c| c.is_ascii_lowercase())
|
.all(|c| c.is_ascii_lowercase())
|
||||||
|
@ -437,9 +437,7 @@ unsafe fn parse_keystroke(native_event: id) -> Keystroke {
|
||||||
chars_with_shift
|
chars_with_shift
|
||||||
} else {
|
} else {
|
||||||
chars_ignoring_modifiers
|
chars_ignoring_modifiers
|
||||||
};
|
}
|
||||||
|
|
||||||
key
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2063,8 +2063,8 @@ fn screen_point_to_gpui_point(this: &Object, position: NSPoint) -> Point<Pixels>
|
||||||
let frame = get_frame(this);
|
let frame = get_frame(this);
|
||||||
let window_x = position.x - frame.origin.x;
|
let window_x = position.x - frame.origin.x;
|
||||||
let window_y = frame.size.height - (position.y - frame.origin.y);
|
let window_y = frame.size.height - (position.y - frame.origin.y);
|
||||||
let position = point(px(window_x as f32), px(window_y as f32));
|
|
||||||
position
|
point(px(window_x as f32), px(window_y as f32))
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" fn dragging_entered(this: &Object, _: Sel, dragging_info: id) -> NSDragOperation {
|
extern "C" fn dragging_entered(this: &Object, _: Sel, dragging_info: id) -> NSDragOperation {
|
||||||
|
|
|
@ -228,7 +228,7 @@ fn run_capture(
|
||||||
display,
|
display,
|
||||||
size,
|
size,
|
||||||
}));
|
}));
|
||||||
if let Err(_) = stream_send_result {
|
if stream_send_result.is_err() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while !cancel_stream.load(std::sync::atomic::Ordering::SeqCst) {
|
while !cancel_stream.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
|
|
|
@ -1128,22 +1128,19 @@ impl WindowsWindowInner {
|
||||||
&& let Some(parameter_string) = unsafe { parameter.to_string() }.log_err()
|
&& let Some(parameter_string) = unsafe { parameter.to_string() }.log_err()
|
||||||
{
|
{
|
||||||
log::info!("System settings changed: {}", parameter_string);
|
log::info!("System settings changed: {}", parameter_string);
|
||||||
match parameter_string.as_str() {
|
if parameter_string.as_str() == "ImmersiveColorSet" {
|
||||||
"ImmersiveColorSet" => {
|
let new_appearance = system_appearance()
|
||||||
let new_appearance = system_appearance()
|
.context("unable to get system appearance when handling ImmersiveColorSet")
|
||||||
.context("unable to get system appearance when handling ImmersiveColorSet")
|
.log_err()?;
|
||||||
.log_err()?;
|
let mut lock = self.state.borrow_mut();
|
||||||
let mut lock = self.state.borrow_mut();
|
if new_appearance != lock.appearance {
|
||||||
if new_appearance != lock.appearance {
|
lock.appearance = new_appearance;
|
||||||
lock.appearance = new_appearance;
|
let mut callback = lock.callbacks.appearance_changed.take()?;
|
||||||
let mut callback = lock.callbacks.appearance_changed.take()?;
|
drop(lock);
|
||||||
drop(lock);
|
callback();
|
||||||
callback();
|
self.state.borrow_mut().callbacks.appearance_changed = Some(callback);
|
||||||
self.state.borrow_mut().callbacks.appearance_changed = Some(callback);
|
configure_dwm_dark_mode(handle, new_appearance);
|
||||||
configure_dwm_dark_mode(handle, new_appearance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(0)
|
Some(0)
|
||||||
|
@ -1469,7 +1466,7 @@ pub(crate) fn current_modifiers() -> Modifiers {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) fn current_capslock() -> Capslock {
|
pub(crate) fn current_capslock() -> Capslock {
|
||||||
let on = unsafe { GetKeyState(VK_CAPITAL.0 as i32) & 1 } > 0;
|
let on = unsafe { GetKeyState(VK_CAPITAL.0 as i32) & 1 } > 0;
|
||||||
Capslock { on: on }
|
Capslock { on }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_client_area_insets(
|
fn get_client_area_insets(
|
||||||
|
|
|
@ -58,23 +58,21 @@ impl TaffyLayoutEngine {
|
||||||
children: &[LayoutId],
|
children: &[LayoutId],
|
||||||
) -> LayoutId {
|
) -> LayoutId {
|
||||||
let taffy_style = style.to_taffy(rem_size);
|
let taffy_style = style.to_taffy(rem_size);
|
||||||
let layout_id = if children.is_empty() {
|
|
||||||
|
if children.is_empty() {
|
||||||
self.taffy
|
self.taffy
|
||||||
.new_leaf(taffy_style)
|
.new_leaf(taffy_style)
|
||||||
.expect(EXPECT_MESSAGE)
|
.expect(EXPECT_MESSAGE)
|
||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
let parent_id = self
|
self.taffy
|
||||||
.taffy
|
|
||||||
// This is safe because LayoutId is repr(transparent) to taffy::tree::NodeId.
|
// This is safe because LayoutId is repr(transparent) to taffy::tree::NodeId.
|
||||||
.new_with_children(taffy_style, unsafe {
|
.new_with_children(taffy_style, unsafe {
|
||||||
std::mem::transmute::<&[LayoutId], &[taffy::NodeId]>(children)
|
std::mem::transmute::<&[LayoutId], &[taffy::NodeId]>(children)
|
||||||
})
|
})
|
||||||
.expect(EXPECT_MESSAGE)
|
.expect(EXPECT_MESSAGE)
|
||||||
.into();
|
.into()
|
||||||
parent_id
|
}
|
||||||
};
|
|
||||||
layout_id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn request_measured_layout(
|
pub fn request_measured_layout(
|
||||||
|
@ -91,8 +89,7 @@ impl TaffyLayoutEngine {
|
||||||
) -> LayoutId {
|
) -> LayoutId {
|
||||||
let taffy_style = style.to_taffy(rem_size);
|
let taffy_style = style.to_taffy(rem_size);
|
||||||
|
|
||||||
let layout_id = self
|
self.taffy
|
||||||
.taffy
|
|
||||||
.new_leaf_with_context(
|
.new_leaf_with_context(
|
||||||
taffy_style,
|
taffy_style,
|
||||||
NodeContext {
|
NodeContext {
|
||||||
|
@ -100,8 +97,7 @@ impl TaffyLayoutEngine {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.expect(EXPECT_MESSAGE)
|
.expect(EXPECT_MESSAGE)
|
||||||
.into();
|
.into()
|
||||||
layout_id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to understand performance
|
// Used to understand performance
|
||||||
|
|
|
@ -44,7 +44,7 @@ impl LineWrapper {
|
||||||
let mut prev_c = '\0';
|
let mut prev_c = '\0';
|
||||||
let mut index = 0;
|
let mut index = 0;
|
||||||
let mut candidates = fragments
|
let mut candidates = fragments
|
||||||
.into_iter()
|
.iter()
|
||||||
.flat_map(move |fragment| fragment.wrap_boundary_candidates())
|
.flat_map(move |fragment| fragment.wrap_boundary_candidates())
|
||||||
.peekable();
|
.peekable();
|
||||||
iter::from_fn(move || {
|
iter::from_fn(move || {
|
||||||
|
|
|
@ -58,13 +58,7 @@ pub trait FluentBuilder {
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
self.map(|this| {
|
self.map(|this| if option.is_some() { this } else { then(this) })
|
||||||
if let Some(_) = option {
|
|
||||||
this
|
|
||||||
} else {
|
|
||||||
then(this)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ impl Parse for Args {
|
||||||
Ok(Args {
|
Ok(Args {
|
||||||
seeds,
|
seeds,
|
||||||
max_retries,
|
max_retries,
|
||||||
max_iterations: max_iterations,
|
max_iterations,
|
||||||
on_failure_fn_name,
|
on_failure_fn_name,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -435,8 +435,7 @@ impl HttpClient for FakeHttpClient {
|
||||||
&self,
|
&self,
|
||||||
req: Request<AsyncBody>,
|
req: Request<AsyncBody>,
|
||||||
) -> BoxFuture<'static, anyhow::Result<Response<AsyncBody>>> {
|
) -> BoxFuture<'static, anyhow::Result<Response<AsyncBody>>> {
|
||||||
let future = (self.handler.lock().as_ref().unwrap())(req);
|
((self.handler.lock().as_ref().unwrap())(req)) as _
|
||||||
future
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn user_agent(&self) -> Option<&HeaderValue> {
|
fn user_agent(&self) -> Option<&HeaderValue> {
|
||||||
|
|
|
@ -50,16 +50,13 @@ impl RealJujutsuRepository {
|
||||||
|
|
||||||
impl JujutsuRepository for RealJujutsuRepository {
|
impl JujutsuRepository for RealJujutsuRepository {
|
||||||
fn list_bookmarks(&self) -> Vec<Bookmark> {
|
fn list_bookmarks(&self) -> Vec<Bookmark> {
|
||||||
let bookmarks = self
|
self.repository
|
||||||
.repository
|
|
||||||
.view()
|
.view()
|
||||||
.bookmarks()
|
.bookmarks()
|
||||||
.map(|(ref_name, _target)| Bookmark {
|
.map(|(ref_name, _target)| Bookmark {
|
||||||
ref_name: ref_name.as_str().to_string().into(),
|
ref_name: ref_name.as_str().to_string().into(),
|
||||||
})
|
})
|
||||||
.collect();
|
.collect()
|
||||||
|
|
||||||
bookmarks
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,11 +195,9 @@ pub fn new_journal_entry(workspace: &Workspace, window: &mut Window, cx: &mut Ap
|
||||||
}
|
}
|
||||||
|
|
||||||
fn journal_dir(path: &str) -> Option<PathBuf> {
|
fn journal_dir(path: &str) -> Option<PathBuf> {
|
||||||
let expanded_journal_dir = shellexpand::full(path) //TODO handle this better
|
shellexpand::full(path) //TODO handle this better
|
||||||
.ok()
|
.ok()
|
||||||
.map(|dir| Path::new(&dir.to_string()).to_path_buf().join("journal"));
|
.map(|dir| Path::new(&dir.to_string()).to_path_buf().join("journal"))
|
||||||
|
|
||||||
expanded_journal_dir
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn heading_entry(now: NaiveTime, hour_format: &Option<HourFormat>) -> String {
|
fn heading_entry(now: NaiveTime, hour_format: &Option<HourFormat>) -> String {
|
||||||
|
|
|
@ -1128,7 +1128,7 @@ impl Buffer {
|
||||||
} else {
|
} else {
|
||||||
ranges.as_slice()
|
ranges.as_slice()
|
||||||
}
|
}
|
||||||
.into_iter()
|
.iter()
|
||||||
.peekable();
|
.peekable();
|
||||||
|
|
||||||
let mut edits = Vec::new();
|
let mut edits = Vec::new();
|
||||||
|
@ -1395,7 +1395,8 @@ impl Buffer {
|
||||||
is_first = false;
|
is_first = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
let any_sub_ranges_contain_range = layer
|
|
||||||
|
layer
|
||||||
.included_sub_ranges
|
.included_sub_ranges
|
||||||
.map(|sub_ranges| {
|
.map(|sub_ranges| {
|
||||||
sub_ranges.iter().any(|sub_range| {
|
sub_ranges.iter().any(|sub_range| {
|
||||||
|
@ -1404,9 +1405,7 @@ impl Buffer {
|
||||||
!is_before_start && !is_after_end
|
!is_before_start && !is_after_end
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.unwrap_or(true);
|
.unwrap_or(true)
|
||||||
let result = any_sub_ranges_contain_range;
|
|
||||||
result
|
|
||||||
})
|
})
|
||||||
.last()
|
.last()
|
||||||
.map(|info| info.language.clone())
|
.map(|info| info.language.clone())
|
||||||
|
@ -2616,7 +2615,7 @@ impl Buffer {
|
||||||
self.completion_triggers = self
|
self.completion_triggers = self
|
||||||
.completion_triggers_per_language_server
|
.completion_triggers_per_language_server
|
||||||
.values()
|
.values()
|
||||||
.flat_map(|triggers| triggers.into_iter().cloned())
|
.flat_map(|triggers| triggers.iter().cloned())
|
||||||
.collect();
|
.collect();
|
||||||
} else {
|
} else {
|
||||||
self.completion_triggers_per_language_server
|
self.completion_triggers_per_language_server
|
||||||
|
@ -2776,7 +2775,7 @@ impl Buffer {
|
||||||
self.completion_triggers = self
|
self.completion_triggers = self
|
||||||
.completion_triggers_per_language_server
|
.completion_triggers_per_language_server
|
||||||
.values()
|
.values()
|
||||||
.flat_map(|triggers| triggers.into_iter().cloned())
|
.flat_map(|triggers| triggers.iter().cloned())
|
||||||
.collect();
|
.collect();
|
||||||
} else {
|
} else {
|
||||||
self.completion_triggers_per_language_server
|
self.completion_triggers_per_language_server
|
||||||
|
|
|
@ -1513,9 +1513,8 @@ impl Language {
|
||||||
.map(|ix| {
|
.map(|ix| {
|
||||||
let mut config = BracketsPatternConfig::default();
|
let mut config = BracketsPatternConfig::default();
|
||||||
for setting in query.property_settings(ix) {
|
for setting in query.property_settings(ix) {
|
||||||
match setting.key.as_ref() {
|
if setting.key.as_ref() == "newline.only" {
|
||||||
"newline.only" => config.newline_only = true,
|
config.newline_only = true
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
config
|
config
|
||||||
|
|
|
@ -300,7 +300,7 @@ impl From<AnthropicError> for LanguageModelCompletionError {
|
||||||
},
|
},
|
||||||
AnthropicError::ServerOverloaded { retry_after } => Self::ServerOverloaded {
|
AnthropicError::ServerOverloaded { retry_after } => Self::ServerOverloaded {
|
||||||
provider,
|
provider,
|
||||||
retry_after: retry_after,
|
retry_after,
|
||||||
},
|
},
|
||||||
AnthropicError::ApiError(api_error) => api_error.into(),
|
AnthropicError::ApiError(api_error) => api_error.into(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -404,7 +404,7 @@ pub fn into_open_ai(
|
||||||
match content {
|
match content {
|
||||||
MessageContent::Text(text) | MessageContent::Thinking { text, .. } => {
|
MessageContent::Text(text) | MessageContent::Thinking { text, .. } => {
|
||||||
add_message_content_part(
|
add_message_content_part(
|
||||||
open_ai::MessagePart::Text { text: text },
|
open_ai::MessagePart::Text { text },
|
||||||
message.role,
|
message.role,
|
||||||
&mut messages,
|
&mut messages,
|
||||||
)
|
)
|
||||||
|
|
|
@ -234,7 +234,7 @@ impl JsonLspAdapter {
|
||||||
schemas
|
schemas
|
||||||
.as_array_mut()
|
.as_array_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.extend(cx.all_action_names().into_iter().map(|&name| {
|
.extend(cx.all_action_names().iter().map(|&name| {
|
||||||
project::lsp_store::json_language_server_ext::url_schema_for_action(name)
|
project::lsp_store::json_language_server_ext::url_schema_for_action(name)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -711,7 +711,7 @@ impl Default for PythonToolchainProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ENV_PRIORITY_LIST: &'static [PythonEnvironmentKind] = &[
|
static ENV_PRIORITY_LIST: &[PythonEnvironmentKind] = &[
|
||||||
// Prioritize non-Conda environments.
|
// Prioritize non-Conda environments.
|
||||||
PythonEnvironmentKind::Poetry,
|
PythonEnvironmentKind::Poetry,
|
||||||
PythonEnvironmentKind::Pipenv,
|
PythonEnvironmentKind::Pipenv,
|
||||||
|
|
|
@ -5205,13 +5205,9 @@ impl MultiBufferSnapshot {
|
||||||
if offset == diff_transforms.start().0
|
if offset == diff_transforms.start().0
|
||||||
&& bias == Bias::Left
|
&& bias == Bias::Left
|
||||||
&& let Some(prev_item) = diff_transforms.prev_item()
|
&& let Some(prev_item) = diff_transforms.prev_item()
|
||||||
|
&& let DiffTransform::DeletedHunk { .. } = prev_item
|
||||||
{
|
{
|
||||||
match prev_item {
|
diff_transforms.prev();
|
||||||
DiffTransform::DeletedHunk { .. } => {
|
|
||||||
diff_transforms.prev();
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let offset_in_transform = offset - diff_transforms.start().0;
|
let offset_in_transform = offset - diff_transforms.start().0;
|
||||||
let mut excerpt_offset = diff_transforms.start().1;
|
let mut excerpt_offset = diff_transforms.start().1;
|
||||||
|
|
|
@ -76,9 +76,8 @@ impl NodeRuntime {
|
||||||
let mut state = self.0.lock().await;
|
let mut state = self.0.lock().await;
|
||||||
|
|
||||||
let options = loop {
|
let options = loop {
|
||||||
match state.options.borrow().as_ref() {
|
if let Some(options) = state.options.borrow().as_ref() {
|
||||||
Some(options) => break options.clone(),
|
break options.clone();
|
||||||
None => {}
|
|
||||||
}
|
}
|
||||||
match state.options.changed().await {
|
match state.options.changed().await {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
|
|
|
@ -19,7 +19,7 @@ use util::ResultExt;
|
||||||
use workspace::{ModalView, Workspace};
|
use workspace::{ModalView, Workspace};
|
||||||
use zed_actions::agent::OpenSettings;
|
use zed_actions::agent::OpenSettings;
|
||||||
|
|
||||||
const FEATURED_PROVIDERS: [&'static str; 4] = ["anthropic", "google", "openai", "ollama"];
|
const FEATURED_PROVIDERS: [&str; 4] = ["anthropic", "google", "openai", "ollama"];
|
||||||
|
|
||||||
fn render_llm_provider_section(
|
fn render_llm_provider_section(
|
||||||
tab_index: &mut isize,
|
tab_index: &mut isize,
|
||||||
|
@ -410,7 +410,7 @@ impl AiPrivacyTooltip {
|
||||||
|
|
||||||
impl Render for AiPrivacyTooltip {
|
impl Render for AiPrivacyTooltip {
|
||||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
const DESCRIPTION: &'static str = "We believe in opt-in data sharing as the default for building AI products, rather than opt-out. We'll only use or store your data if you affirmatively send it to us. ";
|
const DESCRIPTION: &str = "We believe in opt-in data sharing as the default for building AI products, rather than opt-out. We'll only use or store your data if you affirmatively send it to us. ";
|
||||||
|
|
||||||
tooltip_container(window, cx, move |this, _, _| {
|
tooltip_container(window, cx, move |this, _, _| {
|
||||||
this.child(
|
this.child(
|
||||||
|
|
|
@ -16,8 +16,8 @@ use vim_mode_setting::VimModeSetting;
|
||||||
|
|
||||||
use crate::theme_preview::{ThemePreviewStyle, ThemePreviewTile};
|
use crate::theme_preview::{ThemePreviewStyle, ThemePreviewTile};
|
||||||
|
|
||||||
const LIGHT_THEMES: [&'static str; 3] = ["One Light", "Ayu Light", "Gruvbox Light"];
|
const LIGHT_THEMES: [&str; 3] = ["One Light", "Ayu Light", "Gruvbox Light"];
|
||||||
const DARK_THEMES: [&'static str; 3] = ["One Dark", "Ayu Dark", "Gruvbox Dark"];
|
const DARK_THEMES: [&str; 3] = ["One Dark", "Ayu Dark", "Gruvbox Dark"];
|
||||||
const FAMILY_NAMES: [SharedString; 3] = [
|
const FAMILY_NAMES: [SharedString; 3] = [
|
||||||
SharedString::new_static("One"),
|
SharedString::new_static("One"),
|
||||||
SharedString::new_static("Ayu"),
|
SharedString::new_static("Ayu"),
|
||||||
|
@ -114,7 +114,7 @@ fn render_theme_section(tab_index: &mut isize, cx: &mut App) -> impl IntoElement
|
||||||
|
|
||||||
let themes = theme_names.map(|theme| theme_registry.get(theme).unwrap());
|
let themes = theme_names.map(|theme| theme_registry.get(theme).unwrap());
|
||||||
|
|
||||||
let theme_previews = [0, 1, 2].map(|index| {
|
[0, 1, 2].map(|index| {
|
||||||
let theme = &themes[index];
|
let theme = &themes[index];
|
||||||
let is_selected = theme.name == current_theme_name;
|
let is_selected = theme.name == current_theme_name;
|
||||||
let name = theme.name.clone();
|
let name = theme.name.clone();
|
||||||
|
@ -176,9 +176,7 @@ fn render_theme_section(tab_index: &mut isize, cx: &mut App) -> impl IntoElement
|
||||||
.color(Color::Muted)
|
.color(Color::Muted)
|
||||||
.size(LabelSize::Small),
|
.size(LabelSize::Small),
|
||||||
)
|
)
|
||||||
});
|
})
|
||||||
|
|
||||||
theme_previews
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_mode_change(mode: ThemeMode, cx: &mut App) {
|
fn write_mode_change(mode: ThemeMode, cx: &mut App) {
|
||||||
|
|
|
@ -605,7 +605,7 @@ fn render_popular_settings_section(
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> impl IntoElement {
|
) -> impl IntoElement {
|
||||||
const LIGATURE_TOOLTIP: &'static str =
|
const LIGATURE_TOOLTIP: &str =
|
||||||
"Font ligatures combine two characters into one. For example, turning =/= into ≠.";
|
"Font ligatures combine two characters into one. For example, turning =/= into ≠.";
|
||||||
|
|
||||||
v_flex()
|
v_flex()
|
||||||
|
|
|
@ -733,7 +733,8 @@ impl OutlinePanel {
|
||||||
) -> Entity<Self> {
|
) -> Entity<Self> {
|
||||||
let project = workspace.project().clone();
|
let project = workspace.project().clone();
|
||||||
let workspace_handle = cx.entity().downgrade();
|
let workspace_handle = cx.entity().downgrade();
|
||||||
let outline_panel = cx.new(|cx| {
|
|
||||||
|
cx.new(|cx| {
|
||||||
let filter_editor = cx.new(|cx| {
|
let filter_editor = cx.new(|cx| {
|
||||||
let mut editor = Editor::single_line(window, cx);
|
let mut editor = Editor::single_line(window, cx);
|
||||||
editor.set_placeholder_text("Filter...", cx);
|
editor.set_placeholder_text("Filter...", cx);
|
||||||
|
@ -912,9 +913,7 @@ impl OutlinePanel {
|
||||||
outline_panel.replace_active_editor(item, editor, window, cx);
|
outline_panel.replace_active_editor(item, editor, window, cx);
|
||||||
}
|
}
|
||||||
outline_panel
|
outline_panel
|
||||||
});
|
})
|
||||||
|
|
||||||
outline_panel
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn serialization_key(workspace: &Workspace) -> Option<String> {
|
fn serialization_key(workspace: &Workspace) -> Option<String> {
|
||||||
|
@ -2624,7 +2623,7 @@ impl OutlinePanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn entry_name(&self, worktree_id: &WorktreeId, entry: &Entry, cx: &App) -> String {
|
fn entry_name(&self, worktree_id: &WorktreeId, entry: &Entry, cx: &App) -> String {
|
||||||
let name = match self.project.read(cx).worktree_for_id(*worktree_id, cx) {
|
match self.project.read(cx).worktree_for_id(*worktree_id, cx) {
|
||||||
Some(worktree) => {
|
Some(worktree) => {
|
||||||
let worktree = worktree.read(cx);
|
let worktree = worktree.read(cx);
|
||||||
match worktree.snapshot().root_entry() {
|
match worktree.snapshot().root_entry() {
|
||||||
|
@ -2645,8 +2644,7 @@ impl OutlinePanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => file_name(entry.path.as_ref()),
|
None => file_name(entry.path.as_ref()),
|
||||||
};
|
}
|
||||||
name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_fs_entries(
|
fn update_fs_entries(
|
||||||
|
@ -2681,7 +2679,8 @@ impl OutlinePanel {
|
||||||
new_collapsed_entries = outline_panel.collapsed_entries.clone();
|
new_collapsed_entries = outline_panel.collapsed_entries.clone();
|
||||||
new_unfolded_dirs = outline_panel.unfolded_dirs.clone();
|
new_unfolded_dirs = outline_panel.unfolded_dirs.clone();
|
||||||
let multi_buffer_snapshot = active_multi_buffer.read(cx).snapshot(cx);
|
let multi_buffer_snapshot = active_multi_buffer.read(cx).snapshot(cx);
|
||||||
let buffer_excerpts = multi_buffer_snapshot.excerpts().fold(
|
|
||||||
|
multi_buffer_snapshot.excerpts().fold(
|
||||||
HashMap::default(),
|
HashMap::default(),
|
||||||
|mut buffer_excerpts, (excerpt_id, buffer_snapshot, excerpt_range)| {
|
|mut buffer_excerpts, (excerpt_id, buffer_snapshot, excerpt_range)| {
|
||||||
let buffer_id = buffer_snapshot.remote_id();
|
let buffer_id = buffer_snapshot.remote_id();
|
||||||
|
@ -2728,8 +2727,7 @@ impl OutlinePanel {
|
||||||
);
|
);
|
||||||
buffer_excerpts
|
buffer_excerpts
|
||||||
},
|
},
|
||||||
);
|
)
|
||||||
buffer_excerpts
|
|
||||||
}) else {
|
}) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
@ -4807,7 +4805,7 @@ impl OutlinePanel {
|
||||||
.with_compute_indents_fn(cx.entity(), |outline_panel, range, _, _| {
|
.with_compute_indents_fn(cx.entity(), |outline_panel, range, _, _| {
|
||||||
let entries = outline_panel.cached_entries.get(range);
|
let entries = outline_panel.cached_entries.get(range);
|
||||||
if let Some(entries) = entries {
|
if let Some(entries) = entries {
|
||||||
entries.into_iter().map(|item| item.depth).collect()
|
entries.iter().map(|item| item.depth).collect()
|
||||||
} else {
|
} else {
|
||||||
smallvec::SmallVec::new()
|
smallvec::SmallVec::new()
|
||||||
}
|
}
|
||||||
|
|
|
@ -413,13 +413,10 @@ impl LocalBufferStore {
|
||||||
cx: &mut Context<BufferStore>,
|
cx: &mut Context<BufferStore>,
|
||||||
) {
|
) {
|
||||||
cx.subscribe(worktree, |this, worktree, event, cx| {
|
cx.subscribe(worktree, |this, worktree, event, cx| {
|
||||||
if worktree.read(cx).is_local() {
|
if worktree.read(cx).is_local()
|
||||||
match event {
|
&& let worktree::Event::UpdatedEntries(changes) = event
|
||||||
worktree::Event::UpdatedEntries(changes) => {
|
{
|
||||||
Self::local_worktree_entries_changed(this, &worktree, changes, cx);
|
Self::local_worktree_entries_changed(this, &worktree, changes, cx);
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
@ -947,10 +944,9 @@ impl BufferStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_by_path(&self, path: &ProjectPath) -> Option<Entity<Buffer>> {
|
pub fn get_by_path(&self, path: &ProjectPath) -> Option<Entity<Buffer>> {
|
||||||
self.path_to_buffer_id.get(path).and_then(|buffer_id| {
|
self.path_to_buffer_id
|
||||||
let buffer = self.get(*buffer_id);
|
.get(path)
|
||||||
buffer
|
.and_then(|buffer_id| self.get(*buffer_id))
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(&self, buffer_id: BufferId) -> Option<Entity<Buffer>> {
|
pub fn get(&self, buffer_id: BufferId) -> Option<Entity<Buffer>> {
|
||||||
|
|
|
@ -4,8 +4,8 @@ use gpui::{Hsla, Rgba};
|
||||||
use lsp::{CompletionItem, Documentation};
|
use lsp::{CompletionItem, Documentation};
|
||||||
use regex::{Regex, RegexBuilder};
|
use regex::{Regex, RegexBuilder};
|
||||||
|
|
||||||
const HEX: &'static str = r#"(#(?:[\da-fA-F]{3}){1,2})"#;
|
const HEX: &str = r#"(#(?:[\da-fA-F]{3}){1,2})"#;
|
||||||
const RGB_OR_HSL: &'static str = r#"(rgba?|hsla?)\(\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*(?:,\s*(1|0?\.\d+))?\s*\)"#;
|
const RGB_OR_HSL: &str = r#"(rgba?|hsla?)\(\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*(?:,\s*(1|0?\.\d+))?\s*\)"#;
|
||||||
|
|
||||||
static RELAXED_HEX_REGEX: LazyLock<Regex> = LazyLock::new(|| {
|
static RELAXED_HEX_REGEX: LazyLock<Regex> = LazyLock::new(|| {
|
||||||
RegexBuilder::new(HEX)
|
RegexBuilder::new(HEX)
|
||||||
|
@ -141,7 +141,7 @@ mod tests {
|
||||||
use gpui::rgba;
|
use gpui::rgba;
|
||||||
use lsp::{CompletionItem, CompletionItemKind};
|
use lsp::{CompletionItem, CompletionItemKind};
|
||||||
|
|
||||||
pub const COLOR_TABLE: &[(&'static str, Option<u32>)] = &[
|
pub const COLOR_TABLE: &[(&str, Option<u32>)] = &[
|
||||||
// -- Invalid --
|
// -- Invalid --
|
||||||
// Invalid hex
|
// Invalid hex
|
||||||
("f0f", None),
|
("f0f", None),
|
||||||
|
|
|
@ -642,8 +642,8 @@ mod tests {
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_context_server_status(cx: &mut TestAppContext) {
|
async fn test_context_server_status(cx: &mut TestAppContext) {
|
||||||
const SERVER_1_ID: &'static str = "mcp-1";
|
const SERVER_1_ID: &str = "mcp-1";
|
||||||
const SERVER_2_ID: &'static str = "mcp-2";
|
const SERVER_2_ID: &str = "mcp-2";
|
||||||
|
|
||||||
let (_fs, project) = setup_context_server_test(
|
let (_fs, project) = setup_context_server_test(
|
||||||
cx,
|
cx,
|
||||||
|
@ -722,8 +722,8 @@ mod tests {
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_context_server_status_events(cx: &mut TestAppContext) {
|
async fn test_context_server_status_events(cx: &mut TestAppContext) {
|
||||||
const SERVER_1_ID: &'static str = "mcp-1";
|
const SERVER_1_ID: &str = "mcp-1";
|
||||||
const SERVER_2_ID: &'static str = "mcp-2";
|
const SERVER_2_ID: &str = "mcp-2";
|
||||||
|
|
||||||
let (_fs, project) = setup_context_server_test(
|
let (_fs, project) = setup_context_server_test(
|
||||||
cx,
|
cx,
|
||||||
|
@ -784,7 +784,7 @@ mod tests {
|
||||||
|
|
||||||
#[gpui::test(iterations = 25)]
|
#[gpui::test(iterations = 25)]
|
||||||
async fn test_context_server_concurrent_starts(cx: &mut TestAppContext) {
|
async fn test_context_server_concurrent_starts(cx: &mut TestAppContext) {
|
||||||
const SERVER_1_ID: &'static str = "mcp-1";
|
const SERVER_1_ID: &str = "mcp-1";
|
||||||
|
|
||||||
let (_fs, project) = setup_context_server_test(
|
let (_fs, project) = setup_context_server_test(
|
||||||
cx,
|
cx,
|
||||||
|
@ -845,8 +845,8 @@ mod tests {
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_context_server_maintain_servers_loop(cx: &mut TestAppContext) {
|
async fn test_context_server_maintain_servers_loop(cx: &mut TestAppContext) {
|
||||||
const SERVER_1_ID: &'static str = "mcp-1";
|
const SERVER_1_ID: &str = "mcp-1";
|
||||||
const SERVER_2_ID: &'static str = "mcp-2";
|
const SERVER_2_ID: &str = "mcp-2";
|
||||||
|
|
||||||
let server_1_id = ContextServerId(SERVER_1_ID.into());
|
let server_1_id = ContextServerId(SERVER_1_ID.into());
|
||||||
let server_2_id = ContextServerId(SERVER_2_ID.into());
|
let server_2_id = ContextServerId(SERVER_2_ID.into());
|
||||||
|
@ -1084,7 +1084,7 @@ mod tests {
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_context_server_enabled_disabled(cx: &mut TestAppContext) {
|
async fn test_context_server_enabled_disabled(cx: &mut TestAppContext) {
|
||||||
const SERVER_1_ID: &'static str = "mcp-1";
|
const SERVER_1_ID: &str = "mcp-1";
|
||||||
|
|
||||||
let server_1_id = ContextServerId(SERVER_1_ID.into());
|
let server_1_id = ContextServerId(SERVER_1_ID.into());
|
||||||
|
|
||||||
|
|
|
@ -470,9 +470,8 @@ impl DapStore {
|
||||||
session_id: impl Borrow<SessionId>,
|
session_id: impl Borrow<SessionId>,
|
||||||
) -> Option<Entity<session::Session>> {
|
) -> Option<Entity<session::Session>> {
|
||||||
let session_id = session_id.borrow();
|
let session_id = session_id.borrow();
|
||||||
let client = self.sessions.get(session_id).cloned();
|
|
||||||
|
|
||||||
client
|
self.sessions.get(session_id).cloned()
|
||||||
}
|
}
|
||||||
pub fn sessions(&self) -> impl Iterator<Item = &Entity<Session>> {
|
pub fn sessions(&self) -> impl Iterator<Item = &Entity<Session>> {
|
||||||
self.sessions.values()
|
self.sessions.values()
|
||||||
|
|
|
@ -174,7 +174,7 @@ impl DapLocator for GoLocator {
|
||||||
request: "launch".to_string(),
|
request: "launch".to_string(),
|
||||||
mode: "test".to_string(),
|
mode: "test".to_string(),
|
||||||
program,
|
program,
|
||||||
args: args,
|
args,
|
||||||
build_flags,
|
build_flags,
|
||||||
cwd: build_config.cwd.clone(),
|
cwd: build_config.cwd.clone(),
|
||||||
env: build_config.env.clone(),
|
env: build_config.env.clone(),
|
||||||
|
@ -185,7 +185,7 @@ impl DapLocator for GoLocator {
|
||||||
label: resolved_label.to_string().into(),
|
label: resolved_label.to_string().into(),
|
||||||
adapter: adapter.0.clone(),
|
adapter: adapter.0.clone(),
|
||||||
build: None,
|
build: None,
|
||||||
config: config,
|
config,
|
||||||
tcp_connection: None,
|
tcp_connection: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ impl DapLocator for GoLocator {
|
||||||
request: "launch".to_string(),
|
request: "launch".to_string(),
|
||||||
mode: "debug".to_string(),
|
mode: "debug".to_string(),
|
||||||
program,
|
program,
|
||||||
args: args,
|
args,
|
||||||
build_flags,
|
build_flags,
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -226,7 +226,7 @@ impl RunningMode {
|
||||||
|
|
||||||
fn unset_breakpoints_from_paths(&self, paths: &Vec<Arc<Path>>, cx: &mut App) -> Task<()> {
|
fn unset_breakpoints_from_paths(&self, paths: &Vec<Arc<Path>>, cx: &mut App) -> Task<()> {
|
||||||
let tasks: Vec<_> = paths
|
let tasks: Vec<_> = paths
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|path| {
|
.map(|path| {
|
||||||
self.request(dap_command::SetBreakpoints {
|
self.request(dap_command::SetBreakpoints {
|
||||||
source: client_source(path),
|
source: client_source(path),
|
||||||
|
@ -508,13 +508,12 @@ impl RunningMode {
|
||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
let ret = if configuration_done_supported {
|
if configuration_done_supported {
|
||||||
this.request(ConfigurationDone {})
|
this.request(ConfigurationDone {})
|
||||||
} else {
|
} else {
|
||||||
Task::ready(Ok(()))
|
Task::ready(Ok(()))
|
||||||
}
|
}
|
||||||
.await;
|
.await
|
||||||
ret
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -839,7 +838,7 @@ impl Session {
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
||||||
let this = Self {
|
Self {
|
||||||
mode: SessionState::Booting(None),
|
mode: SessionState::Booting(None),
|
||||||
id: session_id,
|
id: session_id,
|
||||||
child_session_ids: HashSet::default(),
|
child_session_ids: HashSet::default(),
|
||||||
|
@ -868,9 +867,7 @@ impl Session {
|
||||||
task_context,
|
task_context,
|
||||||
memory: memory::Memory::new(),
|
memory: memory::Memory::new(),
|
||||||
quirks,
|
quirks,
|
||||||
};
|
}
|
||||||
|
|
||||||
this
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -446,15 +446,12 @@ impl ImageStore {
|
||||||
event: &ImageItemEvent,
|
event: &ImageItemEvent,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
match event {
|
if let ImageItemEvent::FileHandleChanged = event
|
||||||
ImageItemEvent::FileHandleChanged => {
|
&& let Some(local) = self.state.as_local()
|
||||||
if let Some(local) = self.state.as_local() {
|
{
|
||||||
local.update(cx, |local, cx| {
|
local.update(cx, |local, cx| {
|
||||||
local.image_changed_file(image, cx);
|
local.image_changed_file(image, cx);
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,13 +528,10 @@ impl ImageStoreImpl for Entity<LocalImageStore> {
|
||||||
impl LocalImageStore {
|
impl LocalImageStore {
|
||||||
fn subscribe_to_worktree(&mut self, worktree: &Entity<Worktree>, cx: &mut Context<Self>) {
|
fn subscribe_to_worktree(&mut self, worktree: &Entity<Worktree>, cx: &mut Context<Self>) {
|
||||||
cx.subscribe(worktree, |this, worktree, event, cx| {
|
cx.subscribe(worktree, |this, worktree, event, cx| {
|
||||||
if worktree.read(cx).is_local() {
|
if worktree.read(cx).is_local()
|
||||||
match event {
|
&& let worktree::Event::UpdatedEntries(changes) = event
|
||||||
worktree::Event::UpdatedEntries(changes) => {
|
{
|
||||||
this.local_worktree_entries_changed(&worktree, changes, cx);
|
this.local_worktree_entries_changed(&worktree, changes, cx);
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
|
@ -2501,8 +2501,8 @@ pub(crate) fn parse_completion_text_edit(
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(ParsedCompletionEdit {
|
Some(ParsedCompletionEdit {
|
||||||
insert_range: insert_range,
|
insert_range,
|
||||||
replace_range: replace_range,
|
replace_range,
|
||||||
new_text: new_text.clone(),
|
new_text: new_text.clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -550,7 +550,7 @@ impl LocalLspStore {
|
||||||
|
|
||||||
if let Some(settings) = settings.binary.as_ref() {
|
if let Some(settings) = settings.binary.as_ref() {
|
||||||
if let Some(arguments) = &settings.arguments {
|
if let Some(arguments) = &settings.arguments {
|
||||||
binary.arguments = arguments.into_iter().map(Into::into).collect();
|
binary.arguments = arguments.iter().map(Into::into).collect();
|
||||||
}
|
}
|
||||||
if let Some(env) = &settings.env {
|
if let Some(env) = &settings.env {
|
||||||
shell_env.extend(env.iter().map(|(k, v)| (k.clone(), v.clone())));
|
shell_env.extend(env.iter().map(|(k, v)| (k.clone(), v.clone())));
|
||||||
|
@ -1060,8 +1060,8 @@ impl LocalLspStore {
|
||||||
};
|
};
|
||||||
let delegate: Arc<dyn ManifestDelegate> =
|
let delegate: Arc<dyn ManifestDelegate> =
|
||||||
Arc::new(ManifestQueryDelegate::new(worktree.read(cx).snapshot()));
|
Arc::new(ManifestQueryDelegate::new(worktree.read(cx).snapshot()));
|
||||||
let root = self
|
|
||||||
.lsp_tree
|
self.lsp_tree
|
||||||
.get(
|
.get(
|
||||||
project_path,
|
project_path,
|
||||||
language.name(),
|
language.name(),
|
||||||
|
@ -1069,9 +1069,7 @@ impl LocalLspStore {
|
||||||
&delegate,
|
&delegate,
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>()
|
||||||
|
|
||||||
root
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn language_server_ids_for_buffer(
|
fn language_server_ids_for_buffer(
|
||||||
|
@ -2397,7 +2395,8 @@ impl LocalLspStore {
|
||||||
|
|
||||||
let server_id = server_node.server_id_or_init(|disposition| {
|
let server_id = server_node.server_id_or_init(|disposition| {
|
||||||
let path = &disposition.path;
|
let path = &disposition.path;
|
||||||
let server_id = {
|
|
||||||
|
{
|
||||||
let uri =
|
let uri =
|
||||||
Url::from_file_path(worktree.read(cx).abs_path().join(&path.path));
|
Url::from_file_path(worktree.read(cx).abs_path().join(&path.path));
|
||||||
|
|
||||||
|
@ -2415,9 +2414,7 @@ impl LocalLspStore {
|
||||||
state.add_workspace_folder(uri);
|
state.add_workspace_folder(uri);
|
||||||
};
|
};
|
||||||
server_id
|
server_id
|
||||||
};
|
}
|
||||||
|
|
||||||
server_id
|
|
||||||
})?;
|
})?;
|
||||||
let server_state = self.language_servers.get(&server_id)?;
|
let server_state = self.language_servers.get(&server_id)?;
|
||||||
if let LanguageServerState::Running {
|
if let LanguageServerState::Running {
|
||||||
|
@ -3047,16 +3044,14 @@ impl LocalLspStore {
|
||||||
buffer.edit([(range, text)], None, cx);
|
buffer.edit([(range, text)], None, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
let transaction = buffer.end_transaction(cx).and_then(|transaction_id| {
|
buffer.end_transaction(cx).and_then(|transaction_id| {
|
||||||
if push_to_history {
|
if push_to_history {
|
||||||
buffer.finalize_last_transaction();
|
buffer.finalize_last_transaction();
|
||||||
buffer.get_transaction(transaction_id).cloned()
|
buffer.get_transaction(transaction_id).cloned()
|
||||||
} else {
|
} else {
|
||||||
buffer.forget_transaction(transaction_id)
|
buffer.forget_transaction(transaction_id)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
transaction
|
|
||||||
})?;
|
})?;
|
||||||
if let Some(transaction) = transaction {
|
if let Some(transaction) = transaction {
|
||||||
project_transaction.0.insert(buffer_to_edit, transaction);
|
project_transaction.0.insert(buffer_to_edit, transaction);
|
||||||
|
@ -4370,13 +4365,11 @@ impl LspStore {
|
||||||
if let Some((client, downstream_project_id)) = self.downstream_client.clone()
|
if let Some((client, downstream_project_id)) = self.downstream_client.clone()
|
||||||
&& let Some(diangostic_summaries) = self.diagnostic_summaries.get(&worktree.id())
|
&& let Some(diangostic_summaries) = self.diagnostic_summaries.get(&worktree.id())
|
||||||
{
|
{
|
||||||
let mut summaries = diangostic_summaries
|
let mut summaries = diangostic_summaries.iter().flat_map(|(path, summaries)| {
|
||||||
.into_iter()
|
summaries
|
||||||
.flat_map(|(path, summaries)| {
|
.iter()
|
||||||
summaries
|
.map(|(server_id, summary)| summary.to_proto(*server_id, path))
|
||||||
.into_iter()
|
});
|
||||||
.map(|(server_id, summary)| summary.to_proto(*server_id, path))
|
|
||||||
});
|
|
||||||
if let Some(summary) = summaries.next() {
|
if let Some(summary) = summaries.next() {
|
||||||
client
|
client
|
||||||
.send(proto::UpdateDiagnosticSummary {
|
.send(proto::UpdateDiagnosticSummary {
|
||||||
|
@ -4564,7 +4557,7 @@ impl LspStore {
|
||||||
anyhow::anyhow!(message)
|
anyhow::anyhow!(message)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let response = request
|
request
|
||||||
.response_from_lsp(
|
.response_from_lsp(
|
||||||
response,
|
response,
|
||||||
this.upgrade().context("no app context")?,
|
this.upgrade().context("no app context")?,
|
||||||
|
@ -4572,8 +4565,7 @@ impl LspStore {
|
||||||
language_server.server_id(),
|
language_server.server_id(),
|
||||||
cx.clone(),
|
cx.clone(),
|
||||||
)
|
)
|
||||||
.await;
|
.await
|
||||||
response
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4853,7 +4845,7 @@ impl LspStore {
|
||||||
push_to_history: bool,
|
push_to_history: bool,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Task<anyhow::Result<ProjectTransaction>> {
|
) -> Task<anyhow::Result<ProjectTransaction>> {
|
||||||
if let Some(_) = self.as_local() {
|
if self.as_local().is_some() {
|
||||||
cx.spawn(async move |lsp_store, cx| {
|
cx.spawn(async move |lsp_store, cx| {
|
||||||
let buffers = buffers.into_iter().collect::<Vec<_>>();
|
let buffers = buffers.into_iter().collect::<Vec<_>>();
|
||||||
let result = LocalLspStore::execute_code_action_kind_locally(
|
let result = LocalLspStore::execute_code_action_kind_locally(
|
||||||
|
@ -7804,7 +7796,7 @@ impl LspStore {
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
diagnostics_summary = Some(proto::UpdateDiagnosticSummary {
|
diagnostics_summary = Some(proto::UpdateDiagnosticSummary {
|
||||||
project_id: project_id,
|
project_id,
|
||||||
worktree_id: worktree_id.to_proto(),
|
worktree_id: worktree_id.to_proto(),
|
||||||
summary: Some(proto::DiagnosticSummary {
|
summary: Some(proto::DiagnosticSummary {
|
||||||
path: project_path.path.as_ref().to_proto(),
|
path: project_path.path.as_ref().to_proto(),
|
||||||
|
@ -10054,7 +10046,7 @@ impl LspStore {
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Task<anyhow::Result<ProjectTransaction>> {
|
) -> Task<anyhow::Result<ProjectTransaction>> {
|
||||||
let logger = zlog::scoped!("format");
|
let logger = zlog::scoped!("format");
|
||||||
if let Some(_) = self.as_local() {
|
if self.as_local().is_some() {
|
||||||
zlog::trace!(logger => "Formatting locally");
|
zlog::trace!(logger => "Formatting locally");
|
||||||
let logger = zlog::scoped!(logger => "local");
|
let logger = zlog::scoped!(logger => "local");
|
||||||
let buffers = buffers
|
let buffers = buffers
|
||||||
|
|
|
@ -43,12 +43,9 @@ impl WorktreeRoots {
|
||||||
match event {
|
match event {
|
||||||
WorktreeEvent::UpdatedEntries(changes) => {
|
WorktreeEvent::UpdatedEntries(changes) => {
|
||||||
for (path, _, kind) in changes.iter() {
|
for (path, _, kind) in changes.iter() {
|
||||||
match kind {
|
if kind == &worktree::PathChange::Removed {
|
||||||
worktree::PathChange::Removed => {
|
let path = TriePath::from(path.as_ref());
|
||||||
let path = TriePath::from(path.as_ref());
|
this.roots.remove(&path);
|
||||||
this.roots.remove(&path);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,11 +194,8 @@ impl ManifestTree {
|
||||||
evt: &WorktreeStoreEvent,
|
evt: &WorktreeStoreEvent,
|
||||||
_: &mut Context<Self>,
|
_: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
match evt {
|
if let WorktreeStoreEvent::WorktreeRemoved(_, worktree_id) = evt {
|
||||||
WorktreeStoreEvent::WorktreeRemoved(_, worktree_id) => {
|
self.root_points.remove(worktree_id);
|
||||||
self.root_points.remove(worktree_id);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue