fourslash: Add 'goToMarkerOrRange' helper (#28057)
This commit is contained in:
parent
d3d4f83f89
commit
1930f8a790
|
@ -1181,12 +1181,7 @@ namespace FourSlash {
|
|||
}));
|
||||
|
||||
for (const start of toArray<string | Range>(starts)) {
|
||||
if (typeof start === "string") {
|
||||
this.goToMarker(start);
|
||||
}
|
||||
else {
|
||||
this.goToRangeStart(start);
|
||||
}
|
||||
this.goToMarkerOrRange(start);
|
||||
const fullActual = ts.map<ts.ReferencedSymbol, ReferenceGroupJson>(this.findReferencesAtCaret(), ({ definition, references }, i) => {
|
||||
const text = definition.displayParts.map(d => d.text).join("");
|
||||
return {
|
||||
|
@ -1203,15 +1198,7 @@ namespace FourSlash {
|
|||
}
|
||||
|
||||
public verifyNoReferences(markerNameOrRange?: string | Range) {
|
||||
if (markerNameOrRange) {
|
||||
if (ts.isString(markerNameOrRange)) {
|
||||
this.goToMarker(markerNameOrRange);
|
||||
}
|
||||
else {
|
||||
this.goToRangeStart(markerNameOrRange);
|
||||
}
|
||||
}
|
||||
|
||||
if (markerNameOrRange) this.goToMarkerOrRange(markerNameOrRange);
|
||||
const refs = this.getReferencesAtCaret();
|
||||
if (refs && refs.length) {
|
||||
this.raiseError(`Expected getReferences to fail, but saw references: ${stringify(refs)}`);
|
||||
|
@ -2053,6 +2040,14 @@ Actual: ${stringify(fullActual)}`);
|
|||
this.goToPosition(len);
|
||||
}
|
||||
|
||||
private goToMarkerOrRange(markerOrRange: string | Range) {
|
||||
if (typeof markerOrRange === "string") {
|
||||
this.goToMarker(markerOrRange);
|
||||
} else {
|
||||
this.goToRangeStart(markerOrRange);
|
||||
}
|
||||
}
|
||||
|
||||
public goToRangeStart({ fileName, pos }: Range) {
|
||||
this.openFile(fileName);
|
||||
this.goToPosition(pos);
|
||||
|
|
Loading…
Reference in a new issue