mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
update fourslash/server too
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
// === /a.ts ===
|
||||
// type Options = "/*FIND ALL REFS*/[|option 1|]" | "option 2";
|
||||
// let myOption: Options = "[|option 1|]";
|
||||
|
||||
[
|
||||
{
|
||||
"definition": {
|
||||
"containerKind": "",
|
||||
"containerName": "",
|
||||
"fileName": "/a.ts",
|
||||
"kind": "var",
|
||||
"name": "option 1",
|
||||
"textSpan": {
|
||||
"start": 16,
|
||||
"length": 8
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "\"option 1\"",
|
||||
"kind": "stringLiteral"
|
||||
}
|
||||
]
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 16,
|
||||
"length": 8
|
||||
},
|
||||
"fileName": "/a.ts",
|
||||
"isWriteAccess": false,
|
||||
"isDefinition": false,
|
||||
"isInString": true
|
||||
},
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 65,
|
||||
"length": 8
|
||||
},
|
||||
"fileName": "/a.ts",
|
||||
"isWriteAccess": false,
|
||||
"isDefinition": false,
|
||||
"isInString": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
// === /a.ts ===
|
||||
// type Options = "[|option 1|]" | "option 2";
|
||||
// let myOption: Options = "/*FIND ALL REFS*/[|option 1|]";
|
||||
|
||||
[
|
||||
{
|
||||
"definition": {
|
||||
"containerKind": "",
|
||||
"containerName": "",
|
||||
"fileName": "/a.ts",
|
||||
"kind": "var",
|
||||
"name": "option 1",
|
||||
"textSpan": {
|
||||
"start": 65,
|
||||
"length": 8
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "\"option 1\"",
|
||||
"kind": "stringLiteral"
|
||||
}
|
||||
]
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 16,
|
||||
"length": 8
|
||||
},
|
||||
"fileName": "/a.ts",
|
||||
"isWriteAccess": false,
|
||||
"isDefinition": false,
|
||||
"isInString": true
|
||||
},
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 65,
|
||||
"length": 8
|
||||
},
|
||||
"fileName": "/a.ts",
|
||||
"isWriteAccess": false,
|
||||
"isDefinition": false,
|
||||
"isInString": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,66 @@
|
||||
// === /referencesForGlobals_1.ts ===
|
||||
// class [|globalClass|] {
|
||||
// public f() { }
|
||||
// }
|
||||
|
||||
// === /referencesForGlobals_2.ts ===
|
||||
// ///<reference path="referencesForGlobals_1.ts" />
|
||||
// var c = /*FIND ALL REFS*/[|globalClass|]();
|
||||
|
||||
[
|
||||
{
|
||||
"definition": {
|
||||
"containerKind": "",
|
||||
"containerName": "",
|
||||
"fileName": "/referencesForGlobals_1.ts",
|
||||
"kind": "class",
|
||||
"name": "class globalClass",
|
||||
"textSpan": {
|
||||
"start": 6,
|
||||
"length": 11
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "class",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "globalClass",
|
||||
"kind": "className"
|
||||
}
|
||||
],
|
||||
"contextSpan": {
|
||||
"start": 0,
|
||||
"length": 40
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 6,
|
||||
"length": 11
|
||||
},
|
||||
"fileName": "/referencesForGlobals_1.ts",
|
||||
"contextSpan": {
|
||||
"start": 0,
|
||||
"length": 40
|
||||
},
|
||||
"isWriteAccess": true,
|
||||
"isDefinition": true
|
||||
},
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 58,
|
||||
"length": 11
|
||||
},
|
||||
"fileName": "/referencesForGlobals_2.ts",
|
||||
"isWriteAccess": false,
|
||||
"isDefinition": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,65 @@
|
||||
// === /referencesForGlobals_1.ts ===
|
||||
// class [|globalClass|] {
|
||||
// public f() { }
|
||||
// }
|
||||
|
||||
// === /referencesForGlobals_2.ts ===
|
||||
// var c = /*FIND ALL REFS*/[|globalClass|]();
|
||||
|
||||
[
|
||||
{
|
||||
"definition": {
|
||||
"containerKind": "",
|
||||
"containerName": "",
|
||||
"fileName": "/referencesForGlobals_1.ts",
|
||||
"kind": "class",
|
||||
"name": "class globalClass",
|
||||
"textSpan": {
|
||||
"start": 6,
|
||||
"length": 11
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "class",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "globalClass",
|
||||
"kind": "className"
|
||||
}
|
||||
],
|
||||
"contextSpan": {
|
||||
"start": 0,
|
||||
"length": 40
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 6,
|
||||
"length": 11
|
||||
},
|
||||
"fileName": "/referencesForGlobals_1.ts",
|
||||
"contextSpan": {
|
||||
"start": 0,
|
||||
"length": 40
|
||||
},
|
||||
"isWriteAccess": true,
|
||||
"isDefinition": true
|
||||
},
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 8,
|
||||
"length": 11
|
||||
},
|
||||
"fileName": "/referencesForGlobals_2.ts",
|
||||
"isWriteAccess": false,
|
||||
"isDefinition": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -1,17 +1,7 @@
|
||||
/// <reference path='../fourslash.ts'/>
|
||||
|
||||
// @Filename: /a.ts
|
||||
////type Options = "[|{| "isInString": true |}option 1|]" | "option 2";
|
||||
////let myOption: Options = "[|{| "isInString": true |}option 1|]";
|
||||
////type Options = "/*0*/option 1" | "option 2";
|
||||
////let myOption: Options = "/*1*/option 1";
|
||||
|
||||
const [r0, r1] = test.ranges();
|
||||
goTo.eachRange(() => {
|
||||
verify.getReferencesForServerTest([
|
||||
{ fileName: "/a.ts", isDefinition: false, isWriteAccess: false, textSpan: toSpan(r0) },
|
||||
{ fileName: "/a.ts", isDefinition: false, isWriteAccess: false, textSpan: toSpan(r1) },
|
||||
]);
|
||||
});
|
||||
|
||||
function toSpan(r: FourSlashInterface.Range) {
|
||||
return { start: r.pos, length: r.end - r.pos };
|
||||
}
|
||||
verify.baselineFindAllReferences('0', '1')
|
||||
|
||||
@@ -3,21 +3,12 @@
|
||||
// Global class reference.
|
||||
|
||||
// @Filename: /referencesForGlobals_1.ts
|
||||
////class [|{| "isWriteAccess": true, "isDefinition": true |}globalClass|] {
|
||||
////class /*0*/globalClass {
|
||||
//// public f() { }
|
||||
////}
|
||||
|
||||
// @Filename: /referencesForGlobals_2.ts
|
||||
///////<reference path="referencesForGlobals_1.ts" />
|
||||
////var c = [|globalClass|]();
|
||||
////var c = /*1*/globalClass();
|
||||
|
||||
const [r0, r1] = test.ranges();
|
||||
goTo.rangeStart(r1);
|
||||
verify.getReferencesForServerTest([
|
||||
{ fileName: "/referencesForGlobals_1.ts", isDefinition: true, isWriteAccess: true, textSpan: toSpan(r0) },
|
||||
{ fileName: "/referencesForGlobals_2.ts", isDefinition: false, isWriteAccess: false, textSpan: toSpan(r1) },
|
||||
]);
|
||||
|
||||
function toSpan(r: FourSlashInterface.Range) {
|
||||
return { start: r.pos, length: r.end - r.pos };
|
||||
}
|
||||
verify.baselineFindAllReferences('1')
|
||||
|
||||
@@ -3,23 +3,14 @@
|
||||
// Global class reference.
|
||||
|
||||
// @Filename: /referencesForGlobals_1.ts
|
||||
////class [|globalClass|] {
|
||||
////class /*0*/globalClass {
|
||||
//// public f() { }
|
||||
////}
|
||||
|
||||
// @Filename: /referencesForGlobals_2.ts
|
||||
////var c = [|globalClass|]();
|
||||
////var c = /*1*/globalClass();
|
||||
|
||||
// @Filename: /tsconfig.json
|
||||
////{ "files": ["referencesForGlobals_1.ts", "referencesForGlobals_2.ts"] }
|
||||
|
||||
const [r0, r1] = test.ranges();
|
||||
goTo.rangeStart(r1);
|
||||
verify.getReferencesForServerTest([
|
||||
{ fileName: "/referencesForGlobals_1.ts", isDefinition: true, isWriteAccess: true, textSpan: toSpan(r0) },
|
||||
{ fileName: "/referencesForGlobals_2.ts", isDefinition: false, isWriteAccess: false, textSpan: toSpan(r1) },
|
||||
]);
|
||||
|
||||
function toSpan(r: FourSlashInterface.Range) {
|
||||
return { start: r.pos, length: r.end - r.pos };
|
||||
}
|
||||
verify.baselineFindAllReferences('1')
|
||||
|
||||
Reference in New Issue
Block a user