diff --git a/data/fixtures/scopes/xml/attribute.scope b/data/fixtures/scopes/xml/attribute.scope new file mode 100644 index 0000000000..7589cdb988 --- /dev/null +++ b/data/fixtures/scopes/xml/attribute.scope @@ -0,0 +1,17 @@ +Me +--- + +[Content] = +[Domain] = 0:6-0:15 + >---------< +0| Me + +[Removal] = 0:5-0:15 + >----------< +0| Me + +[Leading delimiter] = 0:5-0:6 + >-< +0| Me + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/xml/comment.block.scope b/data/fixtures/scopes/xml/comment.block.scope index 56d4f90cb9..a1c5843a5e 100644 --- a/data/fixtures/scopes/xml/comment.block.scope +++ b/data/fixtures/scopes/xml/comment.block.scope @@ -1,10 +1,15 @@ - + --- [Content] = [Removal] = -[Domain] = 0:0-0:12 - >------------< -0| +[Domain] = 0:0-2:3 + >---- +0| + ---< [Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/xml/element.scope b/data/fixtures/scopes/xml/element.scope new file mode 100644 index 0000000000..2f1a2d68a5 --- /dev/null +++ b/data/fixtures/scopes/xml/element.scope @@ -0,0 +1,10 @@ +Me +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:25 + >-------------------------< +0| Me + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/xml/endTag.scope b/data/fixtures/scopes/xml/endTag.scope new file mode 100644 index 0000000000..b36de243a3 --- /dev/null +++ b/data/fixtures/scopes/xml/endTag.scope @@ -0,0 +1,13 @@ +Me +--- + +[Content] = +[Removal] = 0:18-0:25 + >-------< +0| Me + +[Domain] = 0:0-0:25 + >-------------------------< +0| Me + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/xml/interior.element.scope b/data/fixtures/scopes/xml/interior.element.scope new file mode 100644 index 0000000000..e5f4411af9 --- /dev/null +++ b/data/fixtures/scopes/xml/interior.element.scope @@ -0,0 +1,37 @@ +Me +--- + +[#1 Content] = +[#1 Removal] = 0:1-0:5 + >----< +0| Me + +[#1 Domain] = 0:0-0:6 + >------< +0| Me + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 0:6-0:8 + >--< +0| Me + +[#2 Domain] = 0:0-0:15 + >---------------< +0| Me + +[#2 Insertion delimiter] = " " + + +[#3 Content] = +[#3 Removal] = 0:10-0:14 + >----< +0| Me + +[#3 Domain] = 0:8-0:15 + >-------< +0| Me + +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/xml/key.attribute.scope b/data/fixtures/scopes/xml/key.attribute.scope new file mode 100644 index 0000000000..c2a9d776c7 --- /dev/null +++ b/data/fixtures/scopes/xml/key.attribute.scope @@ -0,0 +1,20 @@ +Me +--- + +[Content] = 0:6-0:8 + >--< +0| Me + +[Removal] = 0:6-0:9 + >---< +0| Me + +[Trailing delimiter] = 0:8-0:9 + >-< +0| Me + +[Domain] = 0:6-0:15 + >---------< +0| Me + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/xml/startTag.scope b/data/fixtures/scopes/xml/startTag.scope new file mode 100644 index 0000000000..9ce8da9abf --- /dev/null +++ b/data/fixtures/scopes/xml/startTag.scope @@ -0,0 +1,13 @@ +Me +--- + +[Content] = +[Removal] = 0:0-0:16 + >----------------< +0| Me + +[Domain] = 0:0-0:25 + >-------------------------< +0| Me + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/xml/string.singleLine.scope b/data/fixtures/scopes/xml/string.singleLine.scope new file mode 100644 index 0000000000..8a003dd6ae --- /dev/null +++ b/data/fixtures/scopes/xml/string.singleLine.scope @@ -0,0 +1,10 @@ +Me +--- + +[Content] = +[Removal] = +[Domain] = 0:9-0:15 + >------< +0| Me + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/xml/tags.scope b/data/fixtures/scopes/xml/tags.scope new file mode 100644 index 0000000000..adc2f0e3e2 --- /dev/null +++ b/data/fixtures/scopes/xml/tags.scope @@ -0,0 +1,20 @@ +Me +--- + +[.1 Content] = +[.1 Removal] = 0:0-0:16 + >----------------< +0| Me + +[.1 Insertion delimiter] = " " + +[.2 Content] = +[.2 Removal] = 0:18-0:25 + >-------< +0| Me + +[.2 Insertion delimiter] = " " + +[Domain] = 0:0-0:25 + >-------------------------< +0| Me diff --git a/data/fixtures/scopes/xml/textFragment.comment.block.scope b/data/fixtures/scopes/xml/textFragment.comment.block.scope new file mode 100644 index 0000000000..b25539f2d7 --- /dev/null +++ b/data/fixtures/scopes/xml/textFragment.comment.block.scope @@ -0,0 +1,15 @@ + +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:3 + >---- +0| + ---< + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/xml/textFragment.element.scope b/data/fixtures/scopes/xml/textFragment.element.scope new file mode 100644 index 0000000000..8521c6a84d --- /dev/null +++ b/data/fixtures/scopes/xml/textFragment.element.scope @@ -0,0 +1,10 @@ +Me +--- + +[Content] = +[Removal] = +[Domain] = 0:6-0:8 + >--< +0| Me + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/xml/textFragment.string.singleLine.scope b/data/fixtures/scopes/xml/textFragment.string.singleLine.scope new file mode 100644 index 0000000000..3f9ba7b635 --- /dev/null +++ b/data/fixtures/scopes/xml/textFragment.string.singleLine.scope @@ -0,0 +1,10 @@ + +--- + +[Content] = +[Removal] = +[Domain] = 0:10-0:14 + >----< +0| + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/xml/value.attribute.scope b/data/fixtures/scopes/xml/value.attribute.scope new file mode 100644 index 0000000000..1d7c1e12d0 --- /dev/null +++ b/data/fixtures/scopes/xml/value.attribute.scope @@ -0,0 +1,20 @@ +Me +--- + +[Content] = 0:9-0:15 + >------< +0| Me + +[Removal] = 0:8-0:15 + >-------< +0| Me + +[Leading delimiter] = 0:8-0:9 + >-< +0| Me + +[Domain] = 0:6-0:15 + >---------< +0| Me + +[Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/xml.ts b/packages/common/src/scopeSupportFacets/xml.ts index 70bc4cdc2e..8f19d84a63 100644 --- a/packages/common/src/scopeSupportFacets/xml.ts +++ b/packages/common/src/scopeSupportFacets/xml.ts @@ -1,9 +1,171 @@ import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types"; import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types"; -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel; +const { supported, notApplicable } = ScopeSupportFacetLevel; export const xmlScopeSupport: LanguageScopeSupportFacetMap = { "comment.block": supported, + "interior.element": supported, + "key.attribute": supported, + "string.singleLine": supported, + "textFragment.comment.block": supported, + "textFragment.element": supported, + "textFragment.string.singleLine": supported, + "value.attribute": supported, + attribute: supported, + element: supported, + endTag: supported, + startTag: supported, + tags: supported, + + // Not applicable + + anonymousFunction: notApplicable, + "argument.actual": notApplicable, + "argument.actual.constructor": notApplicable, + "argument.actual.constructor.iteration": notApplicable, + "argument.actual.iteration": notApplicable, + "argument.actual.method": notApplicable, + "argument.actual.method.iteration": notApplicable, + "argument.formal": notApplicable, + "argument.formal.constructor": notApplicable, + "argument.formal.constructor.iteration": notApplicable, + "argument.formal.iteration": notApplicable, + "argument.formal.method": notApplicable, + "argument.formal.method.iteration": notApplicable, + "branch.if": notApplicable, + "branch.if.iteration": notApplicable, + "branch.loop": notApplicable, + "branch.switchCase": notApplicable, + "branch.switchCase.iteration": notApplicable, + "branch.ternary": notApplicable, + "branch.try": notApplicable, + "branch.try.iteration": notApplicable, + class: notApplicable, + "class.iteration.block": notApplicable, + "class.iteration.document": notApplicable, + className: notApplicable, + "className.iteration.block": notApplicable, + "className.iteration.document": notApplicable, + "collectionItem.unenclosed": notApplicable, + "collectionItem.unenclosed.iteration": notApplicable, + command: notApplicable, + "comment.line": notApplicable, + "condition.doWhile": notApplicable, + "condition.for": notApplicable, + "condition.if": notApplicable, + "condition.switchCase": notApplicable, + "condition.switchCase.iteration": notApplicable, + "condition.ternary": notApplicable, + "condition.while": notApplicable, + disqualifyDelimiter: notApplicable, + environment: notApplicable, + fieldAccess: notApplicable, + functionCall: notApplicable, + "functionCall.constructor": notApplicable, + functionCallee: notApplicable, + "functionCallee.constructor": notApplicable, + functionName: notApplicable, + "functionName.constructor": notApplicable, + "functionName.iteration.block": notApplicable, + "functionName.iteration.document": notApplicable, + "functionName.method": notApplicable, + "functionName.method.iteration.class": notApplicable, + ifStatement: notApplicable, + "interior.cell": notApplicable, + "interior.class": notApplicable, + "interior.command": notApplicable, + "interior.function": notApplicable, + "interior.if": notApplicable, + "interior.lambda": notApplicable, + "interior.loop": notApplicable, + "interior.resource": notApplicable, + "interior.switchCase": notApplicable, + "interior.ternary": notApplicable, + "interior.try": notApplicable, + "key.mapPair": notApplicable, + "key.mapPair.iteration": notApplicable, + list: notApplicable, + map: notApplicable, + "name.argument.actual": notApplicable, + "name.argument.actual.iteration": notApplicable, + "name.argument.formal": notApplicable, + "name.argument.formal.constructor": notApplicable, + "name.argument.formal.constructor.iteration": notApplicable, + "name.argument.formal.iteration": notApplicable, + "name.argument.formal.method": notApplicable, + "name.argument.formal.method.iteration": notApplicable, + "name.assignment": notApplicable, + "name.assignment.pattern": notApplicable, + "name.class": notApplicable, + "name.constructor": notApplicable, + "name.field": notApplicable, + "name.foreach": notApplicable, + "name.function": notApplicable, + "name.iteration.block": notApplicable, + "name.iteration.document": notApplicable, + "name.method": notApplicable, + "name.resource": notApplicable, + "name.resource.iteration": notApplicable, + "name.variable": notApplicable, + "name.variable.pattern": notApplicable, + namedFunction: notApplicable, + "namedFunction.constructor": notApplicable, + "namedFunction.iteration.block": notApplicable, + "namedFunction.iteration.document": notApplicable, + "namedFunction.method": notApplicable, + "namedFunction.method.iteration.class": notApplicable, + notebookCell: notApplicable, + pairDelimiter: notApplicable, + regularExpression: notApplicable, + section: notApplicable, + "section.iteration.document": notApplicable, + "section.iteration.parent": notApplicable, + statement: notApplicable, + "statement.class": notApplicable, + "statement.iteration.block": notApplicable, + "statement.iteration.document": notApplicable, + "string.multiLine": notApplicable, + switchStatementSubject: notApplicable, + "textFragment.comment.line": notApplicable, + "textFragment.string.multiLine": notApplicable, + "type.alias": notApplicable, + "type.argument.formal": notApplicable, + "type.argument.formal.constructor": notApplicable, + "type.argument.formal.constructor.iteration": notApplicable, + "type.argument.formal.iteration": notApplicable, + "type.argument.formal.method": notApplicable, + "type.argument.formal.method.iteration": notApplicable, + "type.cast": notApplicable, + "type.class": notApplicable, + "type.enum": notApplicable, + "type.field": notApplicable, + "type.field.iteration": notApplicable, + "type.foreach": notApplicable, + "type.interface": notApplicable, + "type.return": notApplicable, + "type.typeArgument": notApplicable, + "type.typeArgument.iteration": notApplicable, + "type.variable": 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, + "value.argument.formal.iteration": notApplicable, + "value.argument.formal.method": notApplicable, + "value.argument.formal.method.iteration": notApplicable, + "value.assignment": notApplicable, + "value.field": notApplicable, + "value.foreach": notApplicable, + "value.mapPair": notApplicable, + "value.mapPair.iteration": notApplicable, + "value.resource": notApplicable, + "value.resource.iteration": notApplicable, + "value.return": notApplicable, + "value.return.lambda": notApplicable, + "value.typeAlias": notApplicable, + "value.variable": notApplicable, + "value.variable.pattern": notApplicable, + "value.yield": notApplicable, }; diff --git a/queries/xml.scm b/queries/xml.scm index e509419245..f8e3098d6f 100644 --- a/queries/xml.scm +++ b/queries/xml.scm @@ -35,7 +35,12 @@ ;;!! ;;! ^^^^ -(AttValue) @string @textFragment +(AttValue + . + _ @textFragment.start.endOf + _ @textFragment.end.startOf + . +) @string ;;!! text ;;! ^^^^