Updates to chat after Hack#2 (#4175)
Release Notes: - Channels: Improved font sizes in chat - Channels: Added a link preview when hovering over links in chat - Channels: Fixed rendering of newlines in chat messages - Added a new setting "use_autoclose" (defaulting to true) that lets you disable autoclose per language. ([#1420](https://github.com/zed-industries/community/issues/1420)) ([#1903](https://github.com/zed-industries/community/issues/1903))
This commit is contained in:
commit
3b84291343
11 changed files with 242 additions and 43 deletions
|
@ -409,6 +409,7 @@ pub struct Editor {
|
|||
style: Option<EditorStyle>,
|
||||
editor_actions: Vec<Box<dyn Fn(&mut ViewContext<Self>)>>,
|
||||
show_copilot_suggestions: bool,
|
||||
use_autoclose: bool,
|
||||
}
|
||||
|
||||
pub struct EditorSnapshot {
|
||||
|
@ -1411,6 +1412,7 @@ impl Editor {
|
|||
keymap_context_layers: Default::default(),
|
||||
input_enabled: true,
|
||||
read_only: false,
|
||||
use_autoclose: true,
|
||||
leader_peer_id: None,
|
||||
remote_id: None,
|
||||
hover_state: Default::default(),
|
||||
|
@ -1692,6 +1694,10 @@ impl Editor {
|
|||
self.read_only = read_only;
|
||||
}
|
||||
|
||||
pub fn set_use_autoclose(&mut self, autoclose: bool) {
|
||||
self.use_autoclose = autoclose;
|
||||
}
|
||||
|
||||
pub fn set_show_copilot_suggestions(&mut self, show_copilot_suggestions: bool) {
|
||||
self.show_copilot_suggestions = show_copilot_suggestions;
|
||||
}
|
||||
|
@ -2290,7 +2296,12 @@ impl Editor {
|
|||
),
|
||||
&bracket_pair.start[..prefix_len],
|
||||
));
|
||||
if following_text_allows_autoclose && preceding_text_matches_prefix {
|
||||
let autoclose = self.use_autoclose
|
||||
&& snapshot.settings_at(selection.start, cx).use_autoclose;
|
||||
if autoclose
|
||||
&& following_text_allows_autoclose
|
||||
&& preceding_text_matches_prefix
|
||||
{
|
||||
let anchor = snapshot.anchor_before(selection.end);
|
||||
new_selections.push((selection.map(|_| anchor), text.len()));
|
||||
new_autoclose_regions.push((
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue