diff --git a/src/services/utilities.ts b/src/services/utilities.ts
index 18f85ceb264..60aa2c7d194 100644
--- a/src/services/utilities.ts
+++ b/src/services/utilities.ts
@@ -806,6 +806,8 @@ namespace ts {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
return getAdjustedLocationForFunction(node as FunctionDeclaration | FunctionExpression);
+ case SyntaxKind.Constructor:
+ return node;
}
}
if (isNamedDeclaration(node)) {
diff --git a/tests/baselines/reference/constructorFindAllReferences1.baseline.jsonc b/tests/baselines/reference/constructorFindAllReferences1.baseline.jsonc
new file mode 100644
index 00000000000..e7bebca38f5
--- /dev/null
+++ b/tests/baselines/reference/constructorFindAllReferences1.baseline.jsonc
@@ -0,0 +1,63 @@
+// === /tests/cases/fourslash/constructorFindAllReferences1.ts ===
+// export class C {
+// /*FIND ALL REFS*/public [|constructor|]() { }
+// public foo() { }
+// }
+//
+// new [|C|]().foo();
+
+[
+ {
+ "definition": {
+ "containerKind": "",
+ "containerName": "",
+ "fileName": "/tests/cases/fourslash/constructorFindAllReferences1.ts",
+ "kind": "class",
+ "name": "class C",
+ "textSpan": {
+ "start": 13,
+ "length": 1
+ },
+ "displayParts": [
+ {
+ "text": "class",
+ "kind": "keyword"
+ },
+ {
+ "text": " ",
+ "kind": "space"
+ },
+ {
+ "text": "C",
+ "kind": "className"
+ }
+ ],
+ "contextSpan": {
+ "start": 0,
+ "length": 68
+ }
+ },
+ "references": [
+ {
+ "textSpan": {
+ "start": 28,
+ "length": 11
+ },
+ "fileName": "/tests/cases/fourslash/constructorFindAllReferences1.ts",
+ "contextSpan": {
+ "start": 21,
+ "length": 24
+ },
+ "isWriteAccess": false
+ },
+ {
+ "textSpan": {
+ "start": 74,
+ "length": 1
+ },
+ "fileName": "/tests/cases/fourslash/constructorFindAllReferences1.ts",
+ "isWriteAccess": false
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/tests/baselines/reference/constructorFindAllReferences2.baseline.jsonc b/tests/baselines/reference/constructorFindAllReferences2.baseline.jsonc
new file mode 100644
index 00000000000..3555381950d
--- /dev/null
+++ b/tests/baselines/reference/constructorFindAllReferences2.baseline.jsonc
@@ -0,0 +1,63 @@
+// === /tests/cases/fourslash/constructorFindAllReferences2.ts ===
+// export class C {
+// /*FIND ALL REFS*/private [|constructor|]() { }
+// public foo() { }
+// }
+//
+// new [|C|]().foo();
+
+[
+ {
+ "definition": {
+ "containerKind": "",
+ "containerName": "",
+ "fileName": "/tests/cases/fourslash/constructorFindAllReferences2.ts",
+ "kind": "class",
+ "name": "class C",
+ "textSpan": {
+ "start": 13,
+ "length": 1
+ },
+ "displayParts": [
+ {
+ "text": "class",
+ "kind": "keyword"
+ },
+ {
+ "text": " ",
+ "kind": "space"
+ },
+ {
+ "text": "C",
+ "kind": "className"
+ }
+ ],
+ "contextSpan": {
+ "start": 0,
+ "length": 69
+ }
+ },
+ "references": [
+ {
+ "textSpan": {
+ "start": 29,
+ "length": 11
+ },
+ "fileName": "/tests/cases/fourslash/constructorFindAllReferences2.ts",
+ "contextSpan": {
+ "start": 21,
+ "length": 25
+ },
+ "isWriteAccess": false
+ },
+ {
+ "textSpan": {
+ "start": 75,
+ "length": 1
+ },
+ "fileName": "/tests/cases/fourslash/constructorFindAllReferences2.ts",
+ "isWriteAccess": false
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/tests/baselines/reference/constructorFindAllReferences3.baseline.jsonc b/tests/baselines/reference/constructorFindAllReferences3.baseline.jsonc
new file mode 100644
index 00000000000..79a200e253d
--- /dev/null
+++ b/tests/baselines/reference/constructorFindAllReferences3.baseline.jsonc
@@ -0,0 +1,65 @@
+// === /tests/cases/fourslash/constructorFindAllReferences3.ts ===
+// export class C {
+// /*FIND ALL REFS*/[|constructor|]() { }
+// public foo() { }
+// }
+//
+// new [|C|]().foo();
+
+[
+ {
+ "definition": {
+ "containerKind": "",
+ "containerName": "",
+ "fileName": "/tests/cases/fourslash/constructorFindAllReferences3.ts",
+ "kind": "class",
+ "name": "class C",
+ "textSpan": {
+ "start": 13,
+ "length": 1
+ },
+ "displayParts": [
+ {
+ "text": "class",
+ "kind": "keyword"
+ },
+ {
+ "text": " ",
+ "kind": "space"
+ },
+ {
+ "text": "C",
+ "kind": "className"
+ }
+ ],
+ "contextSpan": {
+ "start": 0,
+ "length": 61
+ }
+ },
+ "references": [
+ {
+ "textSpan": {
+ "start": 21,
+ "length": 11
+ },
+ "fileName": "/tests/cases/fourslash/constructorFindAllReferences3.ts",
+ "contextSpan": {
+ "start": 21,
+ "length": 17
+ },
+ "isWriteAccess": false,
+ "isDefinition": true
+ },
+ {
+ "textSpan": {
+ "start": 67,
+ "length": 1
+ },
+ "fileName": "/tests/cases/fourslash/constructorFindAllReferences3.ts",
+ "isWriteAccess": false,
+ "isDefinition": false
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/tests/baselines/reference/constructorFindAllReferences4.baseline.jsonc b/tests/baselines/reference/constructorFindAllReferences4.baseline.jsonc
new file mode 100644
index 00000000000..1d899ba5e84
--- /dev/null
+++ b/tests/baselines/reference/constructorFindAllReferences4.baseline.jsonc
@@ -0,0 +1,63 @@
+// === /tests/cases/fourslash/constructorFindAllReferences4.ts ===
+// export class C {
+// /*FIND ALL REFS*/protected [|constructor|]() { }
+// public foo() { }
+// }
+//
+// new [|C|]().foo();
+
+[
+ {
+ "definition": {
+ "containerKind": "",
+ "containerName": "",
+ "fileName": "/tests/cases/fourslash/constructorFindAllReferences4.ts",
+ "kind": "class",
+ "name": "class C",
+ "textSpan": {
+ "start": 13,
+ "length": 1
+ },
+ "displayParts": [
+ {
+ "text": "class",
+ "kind": "keyword"
+ },
+ {
+ "text": " ",
+ "kind": "space"
+ },
+ {
+ "text": "C",
+ "kind": "className"
+ }
+ ],
+ "contextSpan": {
+ "start": 0,
+ "length": 71
+ }
+ },
+ "references": [
+ {
+ "textSpan": {
+ "start": 31,
+ "length": 11
+ },
+ "fileName": "/tests/cases/fourslash/constructorFindAllReferences4.ts",
+ "contextSpan": {
+ "start": 21,
+ "length": 27
+ },
+ "isWriteAccess": false
+ },
+ {
+ "textSpan": {
+ "start": 77,
+ "length": 1
+ },
+ "fileName": "/tests/cases/fourslash/constructorFindAllReferences4.ts",
+ "isWriteAccess": false
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/tests/cases/fourslash/constructorFindAllReferences1.ts b/tests/cases/fourslash/constructorFindAllReferences1.ts
new file mode 100644
index 00000000000..23ede06bdce
--- /dev/null
+++ b/tests/cases/fourslash/constructorFindAllReferences1.ts
@@ -0,0 +1,10 @@
+///
+
+////export class C {
+//// /**/public constructor() { }
+//// public foo() { }
+////}
+////
+////new C().foo();
+
+verify.baselineFindAllReferences("");
diff --git a/tests/cases/fourslash/constructorFindAllReferences2.ts b/tests/cases/fourslash/constructorFindAllReferences2.ts
new file mode 100644
index 00000000000..26b61da9096
--- /dev/null
+++ b/tests/cases/fourslash/constructorFindAllReferences2.ts
@@ -0,0 +1,10 @@
+///
+
+////export class C {
+//// /**/private constructor() { }
+//// public foo() { }
+////}
+////
+////new C().foo();
+
+verify.baselineFindAllReferences("");
diff --git a/tests/cases/fourslash/constructorFindAllReferences3.ts b/tests/cases/fourslash/constructorFindAllReferences3.ts
new file mode 100644
index 00000000000..1888a3c85b9
--- /dev/null
+++ b/tests/cases/fourslash/constructorFindAllReferences3.ts
@@ -0,0 +1,10 @@
+///
+
+////export class C {
+//// /**/constructor() { }
+//// public foo() { }
+////}
+////
+////new C().foo();
+
+verify.baselineFindAllReferences("");
diff --git a/tests/cases/fourslash/constructorFindAllReferences4.ts b/tests/cases/fourslash/constructorFindAllReferences4.ts
new file mode 100644
index 00000000000..8170f330e53
--- /dev/null
+++ b/tests/cases/fourslash/constructorFindAllReferences4.ts
@@ -0,0 +1,10 @@
+///
+
+////export class C {
+//// /**/protected constructor() { }
+//// public foo() { }
+////}
+////
+////new C().foo();
+
+verify.baselineFindAllReferences("");