diff --git a/data/fixtures/scopes/rust/string.singleLine.scope b/data/fixtures/scopes/rust/string.singleLine.scope new file mode 100644 index 0000000000..68b4966a86 --- /dev/null +++ b/data/fixtures/scopes/rust/string.singleLine.scope @@ -0,0 +1,30 @@ +"aaa" +r#"bbb"# +r##"ccc"## +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-0:5 + >-----< +0| "aaa" + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:0-1:8 + >--------< +1| r#"bbb"# + +[#2 Insertion delimiter] = " " + + +[#3 Content] = +[#3 Removal] = +[#3 Domain] = 2:0-2:10 + >----------< +2| r##"ccc"## + +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/rust/textFragment.string.singleLine.scope b/data/fixtures/scopes/rust/textFragment.string.singleLine.scope new file mode 100644 index 0000000000..9d115cbc7b --- /dev/null +++ b/data/fixtures/scopes/rust/textFragment.string.singleLine.scope @@ -0,0 +1,30 @@ +"aaa" +r#"bbb"# +r##"ccc"## +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:1-0:4 + >---< +0| "aaa" + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:3-1:6 + >---< +1| r#"bbb"# + +[#2 Insertion delimiter] = " " + + +[#3 Content] = +[#3 Removal] = +[#3 Domain] = 2:4-2:7 + >---< +2| r##"ccc"## + +[#3 Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/rust.ts b/packages/common/src/scopeSupportFacets/rust.ts index 125b6a5dd6..c8e7f844a8 100644 --- a/packages/common/src/scopeSupportFacets/rust.ts +++ b/packages/common/src/scopeSupportFacets/rust.ts @@ -7,4 +7,6 @@ const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel; export const rustScopeSupport: LanguageScopeSupportFacetMap = { ifStatement: supported, disqualifyDelimiter: supported, + "string.singleLine": supported, + "textFragment.string.singleLine": supported, }; diff --git a/queries/rust.scm b/queries/rust.scm index a49b0aba0f..22dfafefce 100644 --- a/queries/rust.scm +++ b/queries/rust.scm @@ -5,14 +5,19 @@ (if_let_expression) ] @ifStatement +;;!! "hello" ( - [ - (raw_string_literal) - (string_literal) - ] @string @textFragment + (string_literal) @string @textFragment (#child-range! @textFragment 0 -1 true true) ) +;;!! r#"foobar"# +( + (raw_string_literal) @string @textFragment + (#shrink-to-match! @textFragment "r#+\"(?.*)\"#+") + +) + [ (line_comment) (block_comment)