diff --git a/data/fixtures/scopes/typescript.core/namedFunction.constructor.scope b/data/fixtures/scopes/typescript.core/namedFunction.constructor.scope new file mode 100644 index 0000000000..35a859b925 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/namedFunction.constructor.scope @@ -0,0 +1,53 @@ +class MyClass { + constructor(value: string) + constructor(value: number); + constructor(value: string | number) {} +} +--- + +[#1 Content] = +[#1 Domain] = 1:2-1:28 + >--------------------------< +1| constructor(value: string) + +[#1 Removal] = 1:0-1:28 + >----------------------------< +1| constructor(value: string) + +[#1 Leading delimiter] = 1:0-1:2 + >--< +1| constructor(value: string) + +[#1 Insertion delimiter] = "\n\n" + + +[#2 Content] = +[#2 Domain] = 2:2-2:29 + >---------------------------< +2| constructor(value: number); + +[#2 Removal] = 2:0-2:29 + >-----------------------------< +2| constructor(value: number); + +[#2 Leading delimiter] = 2:0-2:2 + >--< +2| constructor(value: number); + +[#2 Insertion delimiter] = "\n\n" + + +[#3 Content] = +[#3 Domain] = 3:2-3:40 + >--------------------------------------< +3| constructor(value: string | number) {} + +[#3 Removal] = 3:0-3:40 + >----------------------------------------< +3| constructor(value: string | number) {} + +[#3 Leading delimiter] = 3:0-3:2 + >--< +3| constructor(value: string | number) {} + +[#3 Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/typescript.core/namedFunction.method.scope b/data/fixtures/scopes/typescript.core/namedFunction.method.scope new file mode 100644 index 0000000000..746533cd46 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/namedFunction.method.scope @@ -0,0 +1,53 @@ +class MyClass { + foo(value: string) + foo(value: number); + foo(value: string | number) {} +} +--- + +[#1 Content] = +[#1 Domain] = 1:2-1:20 + >------------------< +1| foo(value: string) + +[#1 Removal] = 1:0-1:20 + >--------------------< +1| foo(value: string) + +[#1 Leading delimiter] = 1:0-1:2 + >--< +1| foo(value: string) + +[#1 Insertion delimiter] = "\n\n" + + +[#2 Content] = +[#2 Domain] = 2:2-2:21 + >-------------------< +2| foo(value: number); + +[#2 Removal] = 2:0-2:21 + >---------------------< +2| foo(value: number); + +[#2 Leading delimiter] = 2:0-2:2 + >--< +2| foo(value: number); + +[#2 Insertion delimiter] = "\n\n" + + +[#3 Content] = +[#3 Domain] = 3:2-3:32 + >------------------------------< +3| foo(value: string | number) {} + +[#3 Removal] = 3:0-3:32 + >--------------------------------< +3| foo(value: string | number) {} + +[#3 Leading delimiter] = 3:0-3:2 + >--< +3| foo(value: string | number) {} + +[#3 Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/typescript.core/namedFunction.scope b/data/fixtures/scopes/typescript.core/namedFunction.scope new file mode 100644 index 0000000000..a75da32da5 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/namedFunction.scope @@ -0,0 +1,30 @@ +function foo(value: string) +function foo(value: number); +function foo(value: string | number) {} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-0:27 + >---------------------------< +0| function foo(value: string) + +[#1 Insertion delimiter] = "\n\n" + + +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:0-1:28 + >----------------------------< +1| function foo(value: number); + +[#2 Insertion delimiter] = "\n\n" + + +[#3 Content] = +[#3 Removal] = +[#3 Domain] = 2:0-2:39 + >---------------------------------------< +2| function foo(value: string | number) {} + +[#3 Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/typescript.core/statement.scope b/data/fixtures/scopes/typescript.core/statement.scope new file mode 100644 index 0000000000..df8feb1596 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/statement.scope @@ -0,0 +1,31 @@ +interface Aaa { + bbb(): void; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >--------------- +0| interface Aaa { +1| bbb(): void; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:16 + >------------< +1| bbb(): void; + +[#2 Removal] = 1:0-1:16 + >----------------< +1| bbb(): void; + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| bbb(): void; + +[#2 Insertion delimiter] = "\n" diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index 88e2871e86..912dfe3eb8 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -4,6 +4,14 @@ ;; import javascript.core.scm +;;!! class Aaa { bbb(); } +;;! ^^^^^^ +(_ + (method_signature) @statement.start + . + ";"? @statement.end +) + ;;!! function aaa(bbb = "ddd") {} ;;! ^^^-------- (required_parameter @@ -41,6 +49,12 @@ ;; Define these here because these node types don't exist in javascript. (_ [ + ;;!! function foo(); + ;;! ^^^^^^^^^^^^^^^ + (function_signature + name: (_) @functionName @name + ) + ;;!! class Foo { foo() {} } ;;! ^^^^^^^^ ;;!! interface Foo { foo(): void; }