add config for brackets higlihghting

This commit is contained in:
Dongdong Zhou 2022-10-31 21:30:36 +00:00
parent e51ffc9e04
commit b80fc412cf
3 changed files with 11 additions and 1 deletions

View File

@ -20,6 +20,7 @@ auto-closing-matching-pairs = true
hover-delay = 300 # ms
modal-mode-relative-line-numbers = true
format-on-save = false
highlight-matching-brackets = true
autosave-interval = 0
enable-inlay-hints = true
inlay-hint-font-family = ""

View File

@ -353,8 +353,13 @@ pub struct EditorConfig {
desc = "Whether it should format the document on save (if there is an available formatter)"
)]
pub format_on_save: bool,
#[field_names(desc = "If matching brackets are highlighted")]
pub highlight_matching_brackets: bool,
#[field_names(desc = "If inlay hints should be displayed")]
pub enable_inlay_hints: bool,
#[field_names(
desc = "Set the inlay hint font family. If empty, it uses the editor font family."
)]

View File

@ -1901,6 +1901,10 @@ fn highlight_brackets(
data: &LapceEditorBufferData,
screen_lines: &ScreenLines,
) {
if !data.config.editor.highlight_matching_brackets {
return;
}
if screen_lines.lines.is_empty() {
return;
}
@ -1978,7 +1982,7 @@ fn paint_bracket_highlight(
.config
.get_color_unchecked(LapceTheme::EDITOR_CARET)
.clone()
.with_alpha(0.5),
.with_alpha(0.2),
);
}