Fourslash server tests
This commit is contained in:
parent
018026ad52
commit
edad317395
|
@ -395,8 +395,12 @@ namespace ts.server {
|
|||
const locations: RenameLocation[] = [];
|
||||
for (const entry of body.locs) {
|
||||
const fileName = entry.file;
|
||||
for (const { start, end, ...prefixSuffixText } of entry.locs) {
|
||||
locations.push({ textSpan: this.decodeSpan({ start, end }, fileName), fileName, ...prefixSuffixText });
|
||||
for (const { start, end, declarationStart, declarationEnd, ...prefixSuffixText } of entry.locs) {
|
||||
const renameLocation: RenameLocation = { textSpan: this.decodeSpan({ start, end }, fileName), fileName, ...prefixSuffixText };
|
||||
if (declarationStart !== undefined) {
|
||||
renameLocation.declarationSpan = this.decodeSpan({ start: declarationStart, end: declarationEnd! }, fileName);
|
||||
}
|
||||
locations.push(renameLocation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
// @Filename: jsDocCallback.js
|
||||
////
|
||||
//// /**
|
||||
//// * @callback [|FooCallback|]
|
||||
//// * [|@callback [|{| "declarationRangeIndex": 0 |}FooCallback|]
|
||||
//// * @param {string} eventName - Rename should work
|
||||
//// */
|
||||
//// |]*/
|
||||
////
|
||||
//// /** @type {/*1*/[|FooCallback|]} */
|
||||
//// var t;
|
||||
|
||||
const ranges = test.ranges();
|
||||
const [rDef, ...ranges] = test.ranges();
|
||||
verify.renameLocations(ranges[0], { findInStrings: false, findInComments: true, ranges });
|
||||
|
|
|
@ -4,11 +4,12 @@
|
|||
// @Filename: jsDocTypedef_form1.js
|
||||
////
|
||||
//// /** @typedef {(string | number)} */
|
||||
//// var [|NumberLike|];
|
||||
//// [|var [|{| "declarationRangeIndex": 0 |}NumberLike|];|]
|
||||
////
|
||||
//// [|NumberLike|] = 10;
|
||||
////
|
||||
//// /** @type {[|NumberLike|]} */
|
||||
//// var numberLike;
|
||||
|
||||
verify.rangesAreRenameLocations({ findInComments: true });
|
||||
const [rDef, ...ranges] = test.ranges();
|
||||
verify.rangesAreRenameLocations({ findInComments: true, ranges });
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
// @allowNonTsExtensions: true
|
||||
// @Filename: jsDocTypedef_form2.js
|
||||
////
|
||||
//// /** @typedef {(string | number)} [|NumberLike|] */
|
||||
//// /** [|@typedef {(string | number)} [|{| "declarationRangeIndex": 0 |}NumberLike|]|] */
|
||||
////
|
||||
//// /** @type {[|NumberLike|]} */
|
||||
//// var numberLike;
|
||||
|
||||
verify.rangesAreRenameLocations({ findInComments: true });
|
||||
const [rDef, ...ranges] = test.ranges();
|
||||
verify.rangesAreRenameLocations({ findInComments: true, ranges });
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
// @Filename: jsDocTypedef_form3.js
|
||||
////
|
||||
//// /**
|
||||
//// * @typedef /*1*/[|Person|]
|
||||
//// * [|@typedef /*1*/[|{| "declarationRangeIndex": 0 |}Person|]
|
||||
//// * @type {Object}
|
||||
//// * @property {number} age
|
||||
//// * @property {string} name
|
||||
//// */
|
||||
//// |]*/
|
||||
////
|
||||
//// /** @type {/*2*/[|Person|]} */
|
||||
//// var person;
|
||||
|
||||
goTo.file('jsDocTypedef_form3.js')
|
||||
verify.rangesAreRenameLocations({ findInComments: true });
|
||||
verify.rangesAreRenameLocations({ findInComments: true, ranges: test.rangesByText().get("Person") });
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
///////<reference path="./Bar.ts" />
|
||||
|
||||
////function [|Bar|]() {
|
||||
////[|function [|{| "declarationRangeIndex": 0 |}Bar|]() {
|
||||
//// // This is a reference to [|Bar|] in a comment.
|
||||
//// "this is a reference to [|Bar|] in a string"
|
||||
////}
|
||||
////}|]
|
||||
|
||||
const ranges = test.ranges();
|
||||
const [rDef, ...ranges] = test.ranges();
|
||||
verify.renameLocations(ranges[0], { findInStrings: true, findInComments: true, ranges });
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
// @Filename: referencesForGlobals_1.ts
|
||||
////var [|globalName|] = 0;
|
||||
////[|var [|{| "declarationRangeIndex": 0 |}globalName|] = 0;|]
|
||||
|
||||
// @Filename: referencesForGlobals_2.ts
|
||||
////var y = [|globalName|];
|
||||
|
@ -9,4 +9,5 @@
|
|||
// @Filename: tsconfig.json
|
||||
////{ "files": ["referencesForGlobals_1.ts", "referencesForGlobals_2.ts"] }
|
||||
|
||||
verify.rangesAreRenameLocations({ findInStrings: true, findInComments: true });
|
||||
const [rDef, ...ranges] = test.ranges();
|
||||
verify.rangesAreRenameLocations({ findInStrings: true, findInComments: true, ranges });
|
||||
|
|
Loading…
Reference in a new issue