Do not enable copilot for always read-only editors (#16356)

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2024-08-16 17:22:47 +03:00 committed by GitHub
parent 0fe22f2a48
commit f1a2638d29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 13 deletions

View file

@ -494,7 +494,10 @@ impl PromptLibrary {
let mut editor = Editor::auto_width(cx);
editor.set_placeholder_text("Untitled", cx);
editor.set_text(prompt_metadata.title.unwrap_or_default(), cx);
editor.set_read_only(prompt_id.is_built_in());
if prompt_id.is_built_in() {
editor.set_read_only(true);
editor.set_show_inline_completions(false);
}
editor
});
let body_editor = cx.new_view(|cx| {
@ -506,7 +509,10 @@ impl PromptLibrary {
});
let mut editor = Editor::for_buffer(buffer, None, cx);
editor.set_read_only(prompt_id.is_built_in());
if prompt_id.is_built_in() {
editor.set_read_only(true);
editor.set_show_inline_completions(false);
}
editor.set_soft_wrap_mode(SoftWrap::EditorWidth, cx);
editor.set_show_gutter(false, cx);
editor.set_show_wrap_guides(false, cx);