Add inclusive range scope overrides. Don't auto-close quotes at the ends of line comments (#20206)

Closes #9195
Closes #19787

Release Notes:

- Fixed an issue where single quotation marks were spuriously
auto-closed when typing in line comments
This commit is contained in:
Max Brunsfeld 2024-11-04 15:36:39 -08:00 committed by GitHub
parent 369de400be
commit 258cf6c746
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 120 additions and 61 deletions

View file

@ -2120,8 +2120,8 @@ fn test_language_scope_at_with_javascript(cx: &mut AppContext) {
},
],
disabled_scopes_by_bracket_ix: vec![
Vec::new(), //
vec!["string".into()],
Vec::new(), //
vec!["string".into(), "comment".into()], // single quotes disabled
],
},
overrides: [(
@ -2142,6 +2142,7 @@ fn test_language_scope_at_with_javascript(cx: &mut AppContext) {
r#"
(jsx_element) @element
(string) @string
(comment) @comment.inclusive
[
(jsx_opening_element)
(jsx_closing_element)
@ -2155,7 +2156,7 @@ fn test_language_scope_at_with_javascript(cx: &mut AppContext) {
a["b"] = <C d="e">
<F></F>
{ g() }
</C>;
</C>; // a comment
"#
.unindent();
@ -2170,6 +2171,14 @@ fn test_language_scope_at_with_javascript(cx: &mut AppContext) {
&[true, true]
);
let comment_config = snapshot
.language_scope_at(text.find("comment").unwrap() + "comment".len())
.unwrap();
assert_eq!(
comment_config.brackets().map(|e| e.1).collect::<Vec<_>>(),
&[true, false]
);
let string_config = snapshot
.language_scope_at(text.find("b\"").unwrap())
.unwrap();