diff --git a/data/fixtures/scopes/typescript.core/type.enum.scope b/data/fixtures/scopes/typescript.core/type.enum.scope new file mode 100644 index 0000000000..ebf7a46bf9 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/type.enum.scope @@ -0,0 +1,15 @@ +enum Aaa { + bbb, +} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:1 + >---------- +0| enum Aaa { +1| bbb, +2| } + -< + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/type.enum2.scope b/data/fixtures/scopes/typescript.core/type.enum2.scope new file mode 100644 index 0000000000..5cfb564c0c --- /dev/null +++ b/data/fixtures/scopes/typescript.core/type.enum2.scope @@ -0,0 +1,15 @@ +const enum Aaa { + bbb, +} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:1 + >---------------- +0| const enum Aaa { +1| bbb, +2| } + -< + +[Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts index 8c3341452b..f3d49cd8b8 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts @@ -666,6 +666,10 @@ export const scopeSupportFacetInfos: Record< description: "An interface declaration", scopeType: "type", }, + "type.enum": { + description: "An enum declaration", + scopeType: "type", + }, "type.class": { description: "An class declaration", scopeType: "type", diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts index 11d1d4bd5e..e3ffa37903 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts @@ -165,6 +165,7 @@ export const scopeSupportFacets = [ "type.field.iteration", "type.foreach", "type.interface", + "type.enum", "type.alias", "type.cast", "type.class", diff --git a/packages/common/src/scopeSupportFacets/typescript.ts b/packages/common/src/scopeSupportFacets/typescript.ts index ee1a64e127..7dd70a41ae 100644 --- a/packages/common/src/scopeSupportFacets/typescript.ts +++ b/packages/common/src/scopeSupportFacets/typescript.ts @@ -19,6 +19,7 @@ export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { "type.cast": supported, "type.field": supported, "type.interface": supported, + "type.enum": supported, "type.return": supported, "type.variable": supported, diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index 912dfe3eb8..fa655fe672 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -34,6 +34,10 @@ value: (_) @value ) @_.domain +;;!! enum Aaa {} +;;! ^^^^^^^^^^^ +(enum_declaration) @type + ;;!! function aaa(bbb: Ccc = "ddd") {} ;;! ^^^------------- (required_parameter