From 592fccc56c5677106914e4d8c488deb17708f2af Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Wed, 23 Apr 2025 10:33:47 +0200 Subject: [PATCH] Migrate Talon scopes --- .../scopes/talon/string.singleLine.scope | 17 ++++++++ .../scopes/talon/string.singleLine2.scope | 17 ++++++++ .../talon/textFragment.comment.line.scope | 10 +++++ .../textFragment.string.singleLine.scope | 10 +++++ .../textFragment.string.singleLine2.scope | 10 +++++ .../common/src/scopeSupportFacets/talon.ts | 40 ++++++++++++------- queries/talon.scm | 8 +++- 7 files changed, 96 insertions(+), 16 deletions(-) create mode 100644 data/fixtures/scopes/talon/string.singleLine.scope create mode 100644 data/fixtures/scopes/talon/string.singleLine2.scope create mode 100644 data/fixtures/scopes/talon/textFragment.comment.line.scope create mode 100644 data/fixtures/scopes/talon/textFragment.string.singleLine.scope create mode 100644 data/fixtures/scopes/talon/textFragment.string.singleLine2.scope diff --git a/data/fixtures/scopes/talon/string.singleLine.scope b/data/fixtures/scopes/talon/string.singleLine.scope new file mode 100644 index 0000000000..c4fe6b178e --- /dev/null +++ b/data/fixtures/scopes/talon/string.singleLine.scope @@ -0,0 +1,17 @@ +test: "foo" +--- + +[Content] = +[Domain] = 0:6-0:11 + >-----< +0| test: "foo" + +[Removal] = 0:5-0:11 + >------< +0| test: "foo" + +[Leading delimiter] = 0:5-0:6 + >-< +0| test: "foo" + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/talon/string.singleLine2.scope b/data/fixtures/scopes/talon/string.singleLine2.scope new file mode 100644 index 0000000000..ad2068c1cf --- /dev/null +++ b/data/fixtures/scopes/talon/string.singleLine2.scope @@ -0,0 +1,17 @@ +test: 'foo' +--- + +[Content] = +[Domain] = 0:6-0:11 + >-----< +0| test: 'foo' + +[Removal] = 0:5-0:11 + >------< +0| test: 'foo' + +[Leading delimiter] = 0:5-0:6 + >-< +0| test: 'foo' + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/talon/textFragment.comment.line.scope b/data/fixtures/scopes/talon/textFragment.comment.line.scope new file mode 100644 index 0000000000..2c362ef415 --- /dev/null +++ b/data/fixtures/scopes/talon/textFragment.comment.line.scope @@ -0,0 +1,10 @@ +# Hello world +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:13 + >-------------< +0| # Hello world + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/talon/textFragment.string.singleLine.scope b/data/fixtures/scopes/talon/textFragment.string.singleLine.scope new file mode 100644 index 0000000000..4a97704494 --- /dev/null +++ b/data/fixtures/scopes/talon/textFragment.string.singleLine.scope @@ -0,0 +1,10 @@ +test: "foo" +--- + +[Content] = +[Removal] = +[Domain] = 0:7-0:10 + >---< +0| test: "foo" + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/talon/textFragment.string.singleLine2.scope b/data/fixtures/scopes/talon/textFragment.string.singleLine2.scope new file mode 100644 index 0000000000..00b7eb724f --- /dev/null +++ b/data/fixtures/scopes/talon/textFragment.string.singleLine2.scope @@ -0,0 +1,10 @@ +test: 'foo' +--- + +[Content] = +[Removal] = +[Domain] = 0:7-0:10 + >---< +0| test: 'foo' + +[Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/talon.ts b/packages/common/src/scopeSupportFacets/talon.ts index 39ced3b085..b199666881 100644 --- a/packages/common/src/scopeSupportFacets/talon.ts +++ b/packages/common/src/scopeSupportFacets/talon.ts @@ -4,31 +4,35 @@ import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types"; const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel; export const talonScopeSupport: LanguageScopeSupportFacetMap = { - command: supported, - "interior.command": supported, - "name.field": supported, - "value.field": supported, + "argument.actual.iteration": supported, + "argument.actual": supported, + "comment.line": supported, + + "interior.command": supported, + "name.assignment": supported, + "name.field": supported, "name.variable": supported, - statement: supported, + "statement.iteration.block": supported, "statement.iteration.document": supported, - "value.variable": supported, + "value.assignment": supported, - "argument.actual": supported, - "argument.actual.iteration": supported, + "value.field": supported, + "value.variable": supported, + + command: supported, + statement: supported, + + "string.singleLine": supported, + + "textFragment.comment.line": supported, + "textFragment.string.singleLine": supported, // Unsupported fieldAccess: unsupported, - "string.singleLine": unsupported, - "string.multiLine": unsupported, - "textFragment.comment.line": unsupported, - "textFragment.string.singleLine": unsupported, - "textFragment.string.multiLine": unsupported, - "value.argument.actual": unsupported, - "value.argument.actual.iteration": unsupported, // Not applicable @@ -154,6 +158,10 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "type.typeArgument": notApplicable, "type.typeArgument.iteration": notApplicable, "type.variable": notApplicable, + "type.resource": notApplicable, + "type.resource.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.argument.actual.iteration": notApplicable, "value.argument.formal": notApplicable, "value.argument.formal.constructor": notApplicable, "value.argument.formal.constructor.iteration": notApplicable, @@ -171,4 +179,6 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "value.typeAlias": notApplicable, "value.variable.pattern": notApplicable, "value.yield": notApplicable, + "string.multiLine": notApplicable, + "textFragment.string.multiLine": notApplicable, }; diff --git a/queries/talon.scm b/queries/talon.scm index c0e554aad9..9b0e0e4e46 100644 --- a/queries/talon.scm +++ b/queries/talon.scm @@ -192,4 +192,10 @@ arguments: (implicit_string) @argumentOrParameter.iteration ;;!! # foo ;;! ^^^^^ -(comment) @comment +(comment) @comment @textFragment + +;;!! "foo" +;;! ^^^^^ +(string + (string_content) @textFragment +) @string