Disable copilot for feedback and lsp log editors
LSP log editor caused recursive flood of messages, and feedback editor is better with people writing their own feedback.
This commit is contained in:
parent
600b5c65e9
commit
253c8dbe8e
3 changed files with 12 additions and 3 deletions
|
@ -604,6 +604,7 @@ pub struct Editor {
|
||||||
gutter_width: Pixels,
|
gutter_width: Pixels,
|
||||||
style: Option<EditorStyle>,
|
style: Option<EditorStyle>,
|
||||||
editor_actions: Vec<Box<dyn Fn(&mut ViewContext<Self>)>>,
|
editor_actions: Vec<Box<dyn Fn(&mut ViewContext<Self>)>>,
|
||||||
|
show_copilot_suggestions: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct EditorSnapshot {
|
pub struct EditorSnapshot {
|
||||||
|
@ -1804,6 +1805,7 @@ impl Editor {
|
||||||
gutter_width: Default::default(),
|
gutter_width: Default::default(),
|
||||||
style: None,
|
style: None,
|
||||||
editor_actions: Default::default(),
|
editor_actions: Default::default(),
|
||||||
|
show_copilot_suggestions: mode == EditorMode::Full,
|
||||||
_subscriptions: vec![
|
_subscriptions: vec![
|
||||||
cx.observe(&buffer, Self::on_buffer_changed),
|
cx.observe(&buffer, Self::on_buffer_changed),
|
||||||
cx.subscribe(&buffer, Self::on_buffer_event),
|
cx.subscribe(&buffer, Self::on_buffer_event),
|
||||||
|
@ -2066,6 +2068,10 @@ impl Editor {
|
||||||
self.read_only = read_only;
|
self.read_only = read_only;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_show_copilot_suggestions(&mut self, show_copilot_suggestions: bool) {
|
||||||
|
self.show_copilot_suggestions = show_copilot_suggestions;
|
||||||
|
}
|
||||||
|
|
||||||
fn selections_did_change(
|
fn selections_did_change(
|
||||||
&mut self,
|
&mut self,
|
||||||
local: bool,
|
local: bool,
|
||||||
|
@ -3976,7 +3982,7 @@ impl Editor {
|
||||||
cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
) -> Option<()> {
|
) -> Option<()> {
|
||||||
let copilot = Copilot::global(cx)?;
|
let copilot = Copilot::global(cx)?;
|
||||||
if self.mode != EditorMode::Full || !copilot.read(cx).status().is_authorized() {
|
if !self.show_copilot_suggestions || !copilot.read(cx).status().is_authorized() {
|
||||||
self.clear_copilot_suggestions(cx);
|
self.clear_copilot_suggestions(cx);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
@ -4036,7 +4042,7 @@ impl Editor {
|
||||||
cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
) -> Option<()> {
|
) -> Option<()> {
|
||||||
let copilot = Copilot::global(cx)?;
|
let copilot = Copilot::global(cx)?;
|
||||||
if self.mode != EditorMode::Full || !copilot.read(cx).status().is_authorized() {
|
if !self.show_copilot_suggestions || !copilot.read(cx).status().is_authorized() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4161,7 +4167,8 @@ impl Editor {
|
||||||
let file = snapshot.file_at(location);
|
let file = snapshot.file_at(location);
|
||||||
let language = snapshot.language_at(location);
|
let language = snapshot.language_at(location);
|
||||||
let settings = all_language_settings(file, cx);
|
let settings = all_language_settings(file, cx);
|
||||||
settings.copilot_enabled(language, file.map(|f| f.path().as_ref()))
|
self.show_copilot_suggestions
|
||||||
|
&& settings.copilot_enabled(language, file.map(|f| f.path().as_ref()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_active_copilot_suggestion(&self, cx: &AppContext) -> bool {
|
fn has_active_copilot_suggestion(&self, cx: &AppContext) -> bool {
|
||||||
|
|
|
@ -186,6 +186,7 @@ impl FeedbackModal {
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
editor.set_show_gutter(false, cx);
|
editor.set_show_gutter(false, cx);
|
||||||
|
editor.set_show_copilot_suggestions(false);
|
||||||
editor.set_vertical_scroll_margin(5, cx);
|
editor.set_vertical_scroll_margin(5, cx);
|
||||||
editor
|
editor
|
||||||
});
|
});
|
||||||
|
|
|
@ -449,6 +449,7 @@ impl LspLogView {
|
||||||
editor.set_text(log_contents, cx);
|
editor.set_text(log_contents, cx);
|
||||||
editor.move_to_end(&MoveToEnd, cx);
|
editor.move_to_end(&MoveToEnd, cx);
|
||||||
editor.set_read_only(true);
|
editor.set_read_only(true);
|
||||||
|
editor.set_show_copilot_suggestions(false);
|
||||||
editor
|
editor
|
||||||
});
|
});
|
||||||
let editor_subscription = cx.subscribe(
|
let editor_subscription = cx.subscribe(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue