Merge pull request #19175 from armanio123/AddDefinitionAndBoundSpan
Added DefinitionAndBoundSpan command
This commit is contained in:
commit
cf2bdf8250
|
@ -616,19 +616,23 @@ namespace FourSlash {
|
|||
}
|
||||
|
||||
public verifyGoToDefinition(arg0: any, endMarkerNames?: string | string[]) {
|
||||
this.verifyGoToX(arg0, endMarkerNames, () => this.getGoToDefinition());
|
||||
this.verifyGoToX(arg0, endMarkerNames, () => this.getGoToDefinitionAndBoundSpan());
|
||||
}
|
||||
|
||||
private getGoToDefinition(): ts.DefinitionInfo[] {
|
||||
return this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
}
|
||||
|
||||
private getGoToDefinitionAndBoundSpan(): ts.DefinitionInfoAndBoundSpan {
|
||||
return this.languageService.getDefinitionAndBoundSpan(this.activeFile.fileName, this.currentCaretPosition);
|
||||
}
|
||||
|
||||
public verifyGoToType(arg0: any, endMarkerNames?: string | string[]) {
|
||||
this.verifyGoToX(arg0, endMarkerNames, () =>
|
||||
this.languageService.getTypeDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition));
|
||||
}
|
||||
|
||||
private verifyGoToX(arg0: any, endMarkerNames: string | string[] | undefined, getDefs: () => ts.DefinitionInfo[] | undefined) {
|
||||
private verifyGoToX(arg0: any, endMarkerNames: string | string[] | undefined, getDefs: () => ts.DefinitionInfo[] | ts.DefinitionInfoAndBoundSpan | undefined) {
|
||||
if (endMarkerNames) {
|
||||
this.verifyGoToXPlain(arg0, endMarkerNames, getDefs);
|
||||
}
|
||||
|
@ -648,7 +652,7 @@ namespace FourSlash {
|
|||
}
|
||||
}
|
||||
|
||||
private verifyGoToXPlain(startMarkerNames: string | string[], endMarkerNames: string | string[], getDefs: () => ts.DefinitionInfo[] | undefined) {
|
||||
private verifyGoToXPlain(startMarkerNames: string | string[], endMarkerNames: string | string[], getDefs: () => ts.DefinitionInfo[] | ts.DefinitionInfoAndBoundSpan | undefined) {
|
||||
for (const start of toArray(startMarkerNames)) {
|
||||
this.verifyGoToXSingle(start, endMarkerNames, getDefs);
|
||||
}
|
||||
|
@ -660,26 +664,57 @@ namespace FourSlash {
|
|||
}
|
||||
}
|
||||
|
||||
private verifyGoToXSingle(startMarkerName: string, endMarkerNames: string | string[], getDefs: () => ts.DefinitionInfo[] | undefined) {
|
||||
private verifyGoToXSingle(startMarkerName: string, endMarkerNames: string | string[], getDefs: () => ts.DefinitionInfo[] | ts.DefinitionInfoAndBoundSpan | undefined) {
|
||||
this.goToMarker(startMarkerName);
|
||||
this.verifyGoToXWorker(toArray(endMarkerNames), getDefs);
|
||||
this.verifyGoToXWorker(toArray(endMarkerNames), getDefs, startMarkerName);
|
||||
}
|
||||
|
||||
private verifyGoToXWorker(endMarkers: string[], getDefs: () => ts.DefinitionInfo[] | undefined) {
|
||||
const definitions = getDefs() || [];
|
||||
private verifyGoToXWorker(endMarkers: string[], getDefs: () => ts.DefinitionInfo[] | ts.DefinitionInfoAndBoundSpan | undefined, startMarkerName?: string) {
|
||||
const defs = getDefs();
|
||||
let definitions: ts.DefinitionInfo[] | ReadonlyArray<ts.DefinitionInfo>;
|
||||
let testName: string;
|
||||
|
||||
if (!defs || Array.isArray(defs)) {
|
||||
definitions = defs as ts.DefinitionInfo[] || [];
|
||||
testName = "goToDefinitions";
|
||||
}
|
||||
else {
|
||||
this.verifyDefinitionTextSpan(defs, startMarkerName);
|
||||
|
||||
definitions = defs.definitions;
|
||||
testName = "goToDefinitionsAndBoundSpan";
|
||||
}
|
||||
|
||||
if (endMarkers.length !== definitions.length) {
|
||||
this.raiseError(`goToDefinitions failed - expected to find ${endMarkers.length} definitions but got ${definitions.length}`);
|
||||
this.raiseError(`${testName} failed - expected to find ${endMarkers.length} definitions but got ${definitions.length}`);
|
||||
}
|
||||
|
||||
ts.zipWith(endMarkers, definitions, (endMarker, definition, i) => {
|
||||
const marker = this.getMarkerByName(endMarker);
|
||||
if (marker.fileName !== definition.fileName || marker.position !== definition.textSpan.start) {
|
||||
this.raiseError(`goToDefinition failed for definition ${endMarker} (${i}): expected ${marker.fileName} at ${marker.position}, got ${definition.fileName} at ${definition.textSpan.start}`);
|
||||
this.raiseError(`${testName} failed for definition ${endMarker} (${i}): expected ${marker.fileName} at ${marker.position}, got ${definition.fileName} at ${definition.textSpan.start}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private verifyDefinitionTextSpan(defs: ts.DefinitionInfoAndBoundSpan, startMarkerName: string) {
|
||||
const range = this.testData.ranges.find(range => this.markerName(range.marker) === startMarkerName);
|
||||
|
||||
if (!range && !defs.textSpan) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!range) {
|
||||
this.raiseError(`goToDefinitionsAndBoundSpan failed - found a TextSpan ${JSON.stringify(defs.textSpan)} when it wasn't expected.`);
|
||||
}
|
||||
else if (defs.textSpan.start !== range.start || defs.textSpan.length !== range.end - range.start) {
|
||||
const expected: ts.TextSpan = {
|
||||
start: range.start, length: range.end - range.start
|
||||
};
|
||||
this.raiseError(`goToDefinitionsAndBoundSpan failed - expected to find TextSpan ${JSON.stringify(expected)} but got ${JSON.stringify(defs.textSpan)}`);
|
||||
}
|
||||
}
|
||||
|
||||
public verifyGetEmitOutputForCurrentFile(expected: string): void {
|
||||
const emit = this.languageService.getEmitOutput(this.activeFile.fileName);
|
||||
if (emit.outputFiles.length !== 1) {
|
||||
|
@ -3933,6 +3968,7 @@ namespace FourSlashInterface {
|
|||
}
|
||||
|
||||
public goToDefinition(startMarkerName: string | string[], endMarkerName: string | string[]): void;
|
||||
public goToDefinition(startMarkerName: string | string[], endMarkerName: string | string[], range: FourSlash.Range): void;
|
||||
public goToDefinition(startsAndEnds: [string | string[], string | string[]][]): void;
|
||||
public goToDefinition(startsAndEnds: { [startMarkerName: string]: string | string[] }): void;
|
||||
public goToDefinition(arg0: any, endMarkerName?: string | string[]) {
|
||||
|
|
|
@ -443,6 +443,9 @@ namespace Harness.LanguageService {
|
|||
getDefinitionAtPosition(fileName: string, position: number): ts.DefinitionInfo[] {
|
||||
return unwrapJSONCallResult(this.shim.getDefinitionAtPosition(fileName, position));
|
||||
}
|
||||
getDefinitionAndBoundSpan(fileName: string, position: number): ts.DefinitionInfoAndBoundSpan {
|
||||
return unwrapJSONCallResult(this.shim.getDefinitionAndBoundSpan(fileName, position));
|
||||
}
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): ts.DefinitionInfo[] {
|
||||
return unwrapJSONCallResult(this.shim.getTypeDefinitionAtPosition(fileName, position));
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace ts.server {
|
|||
body: undefined
|
||||
});
|
||||
});
|
||||
it ("should handle literal types in request", () => {
|
||||
it("should handle literal types in request", () => {
|
||||
const configureRequest: protocol.ConfigureRequest = {
|
||||
command: CommandNames.Configure,
|
||||
seq: 0,
|
||||
|
@ -186,6 +186,8 @@ namespace ts.server {
|
|||
CommandNames.Configure,
|
||||
CommandNames.Definition,
|
||||
CommandNames.DefinitionFull,
|
||||
CommandNames.DefinitionAndBoundSpan,
|
||||
CommandNames.DefinitionAndBoundSpanFull,
|
||||
CommandNames.Implementation,
|
||||
CommandNames.ImplementationFull,
|
||||
CommandNames.Exit,
|
||||
|
@ -352,7 +354,7 @@ namespace ts.server {
|
|||
session.addProtocolHandler(command, () => resp);
|
||||
|
||||
expect(() => session.addProtocolHandler(command, () => resp))
|
||||
.to.throw(`Protocol handler already exists for command "${command}"`);
|
||||
.to.throw(`Protocol handler already exists for command "${command}"`);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -270,6 +270,25 @@ namespace ts.server {
|
|||
}));
|
||||
}
|
||||
|
||||
getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan {
|
||||
const args: protocol.FileLocationRequestArgs = this.createFileLocationRequestArgs(fileName, position);
|
||||
|
||||
const request = this.processRequest<protocol.DefinitionRequest>(CommandNames.DefinitionAndBoundSpan, args);
|
||||
const response = this.processResponse<protocol.DefinitionInfoAndBoundSpanReponse>(request);
|
||||
|
||||
return {
|
||||
definitions: response.body.definitions.map(entry => ({
|
||||
containerKind: ScriptElementKind.unknown,
|
||||
containerName: "",
|
||||
fileName: entry.file,
|
||||
textSpan: this.decodeSpan(entry),
|
||||
kind: ScriptElementKind.unknown,
|
||||
name: ""
|
||||
})),
|
||||
textSpan: this.decodeSpan(response.body.textSpan, request.arguments.file)
|
||||
};
|
||||
}
|
||||
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] {
|
||||
const args: protocol.FileLocationRequestArgs = this.createFileLocationRequestArgs(fileName, position);
|
||||
|
||||
|
@ -324,7 +343,7 @@ namespace ts.server {
|
|||
}
|
||||
|
||||
getSyntacticDiagnostics(file: string): Diagnostic[] {
|
||||
const args: protocol.SyntacticDiagnosticsSyncRequestArgs = { file, includeLinePosition: true };
|
||||
const args: protocol.SyntacticDiagnosticsSyncRequestArgs = { file, includeLinePosition: true };
|
||||
|
||||
const request = this.processRequest<protocol.SyntacticDiagnosticsSyncRequest>(CommandNames.SyntacticDiagnosticsSync, args);
|
||||
const response = this.processResponse<protocol.SyntacticDiagnosticsSyncResponse>(request);
|
||||
|
|
|
@ -21,6 +21,9 @@ namespace ts.server.protocol {
|
|||
Definition = "definition",
|
||||
/* @internal */
|
||||
DefinitionFull = "definition-full",
|
||||
DefinitionAndBoundSpan = "definitionAndBoundSpan",
|
||||
/* @internal */
|
||||
DefinitionAndBoundSpanFull = "definitionAndBoundSpan-full",
|
||||
Implementation = "implementation",
|
||||
/* @internal */
|
||||
ImplementationFull = "implementation-full",
|
||||
|
@ -708,6 +711,11 @@ namespace ts.server.protocol {
|
|||
file: string;
|
||||
}
|
||||
|
||||
export interface DefinitionInfoAndBoundSpan {
|
||||
definitions: ReadonlyArray<FileSpan>;
|
||||
textSpan: TextSpan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Definition response message. Gives text range for definition.
|
||||
*/
|
||||
|
@ -715,6 +723,10 @@ namespace ts.server.protocol {
|
|||
body?: FileSpan[];
|
||||
}
|
||||
|
||||
export interface DefinitionInfoAndBoundSpanReponse extends Response {
|
||||
body?: DefinitionInfoAndBoundSpan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Definition response message. Gives text range for definition.
|
||||
*/
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace ts.server {
|
|||
private timerHandle: any;
|
||||
private immediateId: number | undefined;
|
||||
|
||||
constructor(private readonly operationHost: MultistepOperationHost) {}
|
||||
constructor(private readonly operationHost: MultistepOperationHost) { }
|
||||
|
||||
public startNew(action: (next: NextStep) => void) {
|
||||
this.complete();
|
||||
|
@ -587,7 +587,7 @@ namespace ts.server {
|
|||
|
||||
private getDiagnosticsWorker(
|
||||
args: protocol.FileRequestArgs, isSemantic: boolean, selector: (project: Project, file: string) => ReadonlyArray<Diagnostic>, includeLinePosition: boolean
|
||||
): ReadonlyArray<protocol.DiagnosticWithLinePosition> | ReadonlyArray<protocol.Diagnostic> {
|
||||
): ReadonlyArray<protocol.DiagnosticWithLinePosition> | ReadonlyArray<protocol.Diagnostic> {
|
||||
const { project, file } = this.getFileAndProject(args);
|
||||
if (isSemantic && isDeclarationFileInJSOnlyNonConfiguredProject(project, file)) {
|
||||
return emptyArray;
|
||||
|
@ -609,20 +609,51 @@ namespace ts.server {
|
|||
}
|
||||
|
||||
if (simplifiedResult) {
|
||||
return definitions.map(def => {
|
||||
const defScriptInfo = project.getScriptInfo(def.fileName);
|
||||
return {
|
||||
file: def.fileName,
|
||||
start: defScriptInfo.positionToLineOffset(def.textSpan.start),
|
||||
end: defScriptInfo.positionToLineOffset(textSpanEnd(def.textSpan))
|
||||
};
|
||||
});
|
||||
return this.mapDefinitionInfo(definitions, project);
|
||||
}
|
||||
else {
|
||||
return definitions;
|
||||
}
|
||||
}
|
||||
|
||||
private getDefinitionAndBoundSpan(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): protocol.DefinitionInfoAndBoundSpan | DefinitionInfoAndBoundSpan {
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
const position = this.getPositionInFile(args, file);
|
||||
const scriptInfo = project.getScriptInfo(file);
|
||||
|
||||
const definitionAndBoundSpan = project.getLanguageService().getDefinitionAndBoundSpan(file, position);
|
||||
|
||||
if (!definitionAndBoundSpan || !definitionAndBoundSpan.definitions) {
|
||||
return {
|
||||
definitions: emptyArray,
|
||||
textSpan: undefined
|
||||
};
|
||||
}
|
||||
|
||||
if (simplifiedResult) {
|
||||
return {
|
||||
definitions: this.mapDefinitionInfo(definitionAndBoundSpan.definitions, project),
|
||||
textSpan: this.toLocationTextSpan(definitionAndBoundSpan.textSpan, scriptInfo)
|
||||
};
|
||||
}
|
||||
|
||||
return definitionAndBoundSpan;
|
||||
}
|
||||
|
||||
private mapDefinitionInfo(definitions: ReadonlyArray<DefinitionInfo>, project: Project): ReadonlyArray<protocol.FileSpan> {
|
||||
return definitions.map(def => this.toFileSpan(def.fileName, def.textSpan, project));
|
||||
}
|
||||
|
||||
private toFileSpan(fileName: string, textSpan: TextSpan, project: Project): protocol.FileSpan {
|
||||
const scriptInfo = project.getScriptInfo(fileName);
|
||||
|
||||
return {
|
||||
file: fileName,
|
||||
start: scriptInfo.positionToLineOffset(textSpan.start),
|
||||
end: scriptInfo.positionToLineOffset(textSpanEnd(textSpan))
|
||||
};
|
||||
}
|
||||
|
||||
private getTypeDefinition(args: protocol.FileLocationRequestArgs): ReadonlyArray<protocol.FileSpan> {
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
const position = this.getPositionInFile(args, file);
|
||||
|
@ -632,14 +663,7 @@ namespace ts.server {
|
|||
return emptyArray;
|
||||
}
|
||||
|
||||
return definitions.map(def => {
|
||||
const defScriptInfo = project.getScriptInfo(def.fileName);
|
||||
return {
|
||||
file: def.fileName,
|
||||
start: defScriptInfo.positionToLineOffset(def.textSpan.start),
|
||||
end: defScriptInfo.positionToLineOffset(textSpanEnd(def.textSpan))
|
||||
};
|
||||
});
|
||||
return this.mapDefinitionInfo(definitions, project);
|
||||
}
|
||||
|
||||
private getImplementation(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): ReadonlyArray<protocol.FileSpan> | ReadonlyArray<ImplementationLocation> {
|
||||
|
@ -650,14 +674,7 @@ namespace ts.server {
|
|||
return emptyArray;
|
||||
}
|
||||
if (simplifiedResult) {
|
||||
return implementations.map(({ fileName, textSpan }) => {
|
||||
const scriptInfo = project.getScriptInfo(fileName);
|
||||
return {
|
||||
file: fileName,
|
||||
start: scriptInfo.positionToLineOffset(textSpan.start),
|
||||
end: scriptInfo.positionToLineOffset(textSpanEnd(textSpan))
|
||||
};
|
||||
});
|
||||
return implementations.map(({ fileName, textSpan }) => this.toFileSpan(fileName, textSpan, project));
|
||||
}
|
||||
else {
|
||||
return implementations;
|
||||
|
@ -666,6 +683,7 @@ namespace ts.server {
|
|||
|
||||
private getOccurrences(args: protocol.FileLocationRequestArgs): ReadonlyArray<protocol.OccurrencesResponseItem> {
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
|
||||
const position = this.getPositionInFile(args, file);
|
||||
|
||||
const occurrences = project.getLanguageService().getOccurrencesAtPosition(file, position);
|
||||
|
@ -677,11 +695,9 @@ namespace ts.server {
|
|||
return occurrences.map(occurrence => {
|
||||
const { fileName, isWriteAccess, textSpan, isInString } = occurrence;
|
||||
const scriptInfo = project.getScriptInfo(fileName);
|
||||
const start = scriptInfo.positionToLineOffset(textSpan.start);
|
||||
const end = scriptInfo.positionToLineOffset(textSpanEnd(textSpan));
|
||||
const result: protocol.OccurrencesResponseItem = {
|
||||
start,
|
||||
end,
|
||||
start: scriptInfo.positionToLineOffset(textSpan.start),
|
||||
end: scriptInfo.positionToLineOffset(textSpanEnd(textSpan)),
|
||||
file: fileName,
|
||||
isWriteAccess,
|
||||
};
|
||||
|
@ -1189,7 +1205,7 @@ namespace ts.server {
|
|||
return mapDefined<CompletionEntry, protocol.CompletionEntry>(completions && completions.entries, entry => {
|
||||
if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) {
|
||||
const { name, kind, kindModifiers, sortText, replacementSpan, hasAction, source } = entry;
|
||||
const convertedSpan = replacementSpan ? this.decorateSpan(replacementSpan, scriptInfo) : undefined;
|
||||
const convertedSpan = replacementSpan ? this.toLocationTextSpan(replacementSpan, scriptInfo) : undefined;
|
||||
// Use `hasAction || undefined` to avoid serializing `false`.
|
||||
return { name, kind, kindModifiers, sortText, replacementSpan: convertedSpan, hasAction: hasAction || undefined, source };
|
||||
}
|
||||
|
@ -1337,13 +1353,13 @@ namespace ts.server {
|
|||
this.projectService.closeClientFile(file);
|
||||
}
|
||||
|
||||
private decorateNavigationBarItems(items: NavigationBarItem[], scriptInfo: ScriptInfo): protocol.NavigationBarItem[] {
|
||||
private mapLocationNavigationBarItems(items: NavigationBarItem[], scriptInfo: ScriptInfo): protocol.NavigationBarItem[] {
|
||||
return map(items, item => ({
|
||||
text: item.text,
|
||||
kind: item.kind,
|
||||
kindModifiers: item.kindModifiers,
|
||||
spans: item.spans.map(span => this.decorateSpan(span, scriptInfo)),
|
||||
childItems: this.decorateNavigationBarItems(item.childItems, scriptInfo),
|
||||
spans: item.spans.map(span => this.toLocationTextSpan(span, scriptInfo)),
|
||||
childItems: this.mapLocationNavigationBarItems(item.childItems, scriptInfo),
|
||||
indent: item.indent
|
||||
}));
|
||||
}
|
||||
|
@ -1354,21 +1370,21 @@ namespace ts.server {
|
|||
return !items
|
||||
? undefined
|
||||
: simplifiedResult
|
||||
? this.decorateNavigationBarItems(items, this.projectService.getScriptInfoForNormalizedPath(file))
|
||||
? this.mapLocationNavigationBarItems(items, this.projectService.getScriptInfoForNormalizedPath(file))
|
||||
: items;
|
||||
}
|
||||
|
||||
private decorateNavigationTree(tree: NavigationTree, scriptInfo: ScriptInfo): protocol.NavigationTree {
|
||||
private toLocationNavigationTree(tree: NavigationTree, scriptInfo: ScriptInfo): protocol.NavigationTree {
|
||||
return {
|
||||
text: tree.text,
|
||||
kind: tree.kind,
|
||||
kindModifiers: tree.kindModifiers,
|
||||
spans: tree.spans.map(span => this.decorateSpan(span, scriptInfo)),
|
||||
childItems: map(tree.childItems, item => this.decorateNavigationTree(item, scriptInfo))
|
||||
spans: tree.spans.map(span => this.toLocationTextSpan(span, scriptInfo)),
|
||||
childItems: map(tree.childItems, item => this.toLocationNavigationTree(item, scriptInfo))
|
||||
};
|
||||
}
|
||||
|
||||
private decorateSpan(span: TextSpan, scriptInfo: ScriptInfo): protocol.TextSpan {
|
||||
private toLocationTextSpan(span: TextSpan, scriptInfo: ScriptInfo): protocol.TextSpan {
|
||||
return {
|
||||
start: scriptInfo.positionToLineOffset(span.start),
|
||||
end: scriptInfo.positionToLineOffset(textSpanEnd(span))
|
||||
|
@ -1381,7 +1397,7 @@ namespace ts.server {
|
|||
return !tree
|
||||
? undefined
|
||||
: simplifiedResult
|
||||
? this.decorateNavigationTree(tree, this.projectService.getScriptInfoForNormalizedPath(file))
|
||||
? this.toLocationNavigationTree(tree, this.projectService.getScriptInfoForNormalizedPath(file))
|
||||
: tree;
|
||||
}
|
||||
|
||||
|
@ -1400,14 +1416,12 @@ namespace ts.server {
|
|||
|
||||
return navItems.map((navItem) => {
|
||||
const scriptInfo = project.getScriptInfo(navItem.fileName);
|
||||
const start = scriptInfo.positionToLineOffset(navItem.textSpan.start);
|
||||
const end = scriptInfo.positionToLineOffset(textSpanEnd(navItem.textSpan));
|
||||
const bakedItem: protocol.NavtoItem = {
|
||||
name: navItem.name,
|
||||
kind: navItem.kind,
|
||||
file: navItem.fileName,
|
||||
start,
|
||||
end,
|
||||
start: scriptInfo.positionToLineOffset(navItem.textSpan.start),
|
||||
end: scriptInfo.positionToLineOffset(textSpanEnd(navItem.textSpan))
|
||||
};
|
||||
if (navItem.kindModifiers && (navItem.kindModifiers !== "")) {
|
||||
bakedItem.kindModifiers = navItem.kindModifiers;
|
||||
|
@ -1594,7 +1608,7 @@ namespace ts.server {
|
|||
fileName: change.fileName,
|
||||
textChanges: change.textChanges.map(textChange => this.convertTextChangeToCodeEdit(textChange, scriptInfo))
|
||||
}));
|
||||
return { description, changes, commands };
|
||||
return { description, changes, commands };
|
||||
}
|
||||
|
||||
private mapTextChangesToCodeEdits(project: Project, textChanges: FileTextChanges): protocol.FileCodeEdits {
|
||||
|
@ -1622,7 +1636,7 @@ namespace ts.server {
|
|||
return !spans
|
||||
? undefined
|
||||
: simplifiedResult
|
||||
? spans.map(span => this.decorateSpan(span, scriptInfo))
|
||||
? spans.map(span => this.toLocationTextSpan(span, scriptInfo))
|
||||
: spans;
|
||||
}
|
||||
|
||||
|
@ -1738,6 +1752,12 @@ namespace ts.server {
|
|||
[CommandNames.DefinitionFull]: (request: protocol.DefinitionRequest) => {
|
||||
return this.requiredResponse(this.getDefinition(request.arguments, /*simplifiedResult*/ false));
|
||||
},
|
||||
[CommandNames.DefinitionAndBoundSpan]: (request: protocol.DefinitionRequest) => {
|
||||
return this.requiredResponse(this.getDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ true));
|
||||
},
|
||||
[CommandNames.DefinitionAndBoundSpanFull]: (request: protocol.DefinitionRequest) => {
|
||||
return this.requiredResponse(this.getDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ false));
|
||||
},
|
||||
[CommandNames.TypeDefinition]: (request: protocol.FileLocationRequest) => {
|
||||
return this.requiredResponse(this.getTypeDefinition(request.arguments));
|
||||
},
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace ts.GoToDefinition {
|
|||
// }
|
||||
// bar<Test>(({pr/*goto*/op1})=>{});
|
||||
if (isPropertyName(node) && isBindingElement(node.parent) && isObjectBindingPattern(node.parent.parent) &&
|
||||
(node === (node.parent.propertyName || node.parent.name))) {
|
||||
(node === (node.parent.propertyName || node.parent.name))) {
|
||||
const type = typeChecker.getTypeAtLocation(node.parent.parent);
|
||||
if (type) {
|
||||
const propSymbols = getPropertySymbolsFromType(type, node);
|
||||
|
@ -149,6 +149,28 @@ namespace ts.GoToDefinition {
|
|||
return getDefinitionFromSymbol(typeChecker, type.symbol, node);
|
||||
}
|
||||
|
||||
export function getDefinitionAndBoundSpan(program: Program, sourceFile: SourceFile, position: number): DefinitionInfoAndBoundSpan {
|
||||
const definitions = getDefinitionAtPosition(program, sourceFile, position);
|
||||
|
||||
if (!definitions || definitions.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Check if position is on triple slash reference.
|
||||
const comment = findReferenceInPosition(sourceFile.referencedFiles, position) || findReferenceInPosition(sourceFile.typeReferenceDirectives, position);
|
||||
if (comment) {
|
||||
return {
|
||||
definitions,
|
||||
textSpan: createTextSpanFromBounds(comment.pos, comment.end)
|
||||
};
|
||||
}
|
||||
|
||||
const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
const textSpan = createTextSpan(node.getStart(), node.getWidth());
|
||||
|
||||
return { definitions, textSpan };
|
||||
}
|
||||
|
||||
// Go to the original declaration for cases:
|
||||
//
|
||||
// (1) when the aliased symbol was declared in the location(parent).
|
||||
|
|
|
@ -724,9 +724,9 @@ namespace ts {
|
|||
|
||||
case SyntaxKind.BinaryExpression:
|
||||
if (getSpecialPropertyAssignmentKind(node as BinaryExpression) !== SpecialPropertyAssignmentKind.None) {
|
||||
addDeclaration(node as BinaryExpression);
|
||||
addDeclaration(node as BinaryExpression);
|
||||
}
|
||||
// falls through
|
||||
// falls through
|
||||
|
||||
default:
|
||||
forEachChild(node, visit);
|
||||
|
@ -1428,6 +1428,11 @@ namespace ts {
|
|||
return GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);
|
||||
}
|
||||
|
||||
function getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan {
|
||||
synchronizeHostData();
|
||||
return GoToDefinition.getDefinitionAndBoundSpan(program, getValidSourceFile(fileName), position);
|
||||
}
|
||||
|
||||
function getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] {
|
||||
synchronizeHostData();
|
||||
return GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position);
|
||||
|
@ -2040,6 +2045,7 @@ namespace ts {
|
|||
getSignatureHelpItems,
|
||||
getQuickInfoAtPosition,
|
||||
getDefinitionAtPosition,
|
||||
getDefinitionAndBoundSpan,
|
||||
getImplementationAtPosition,
|
||||
getTypeDefinitionAtPosition,
|
||||
getReferencesAtPosition,
|
||||
|
|
|
@ -170,6 +170,8 @@ namespace ts {
|
|||
*/
|
||||
getDefinitionAtPosition(fileName: string, position: number): string;
|
||||
|
||||
getDefinitionAndBoundSpan(fileName: string, position: number): string;
|
||||
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { fileName: string; textSpan: { start: number; length: number}; kind: string; name: string; containerKind: string; containerName: string }
|
||||
|
@ -772,6 +774,17 @@ namespace ts {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the definition location and file for the symbol
|
||||
* at the requested position.
|
||||
*/
|
||||
public getDefinitionAndBoundSpan(fileName: string, position: number): string {
|
||||
return this.forwardJSONCall(
|
||||
`getDefinitionAndBoundSpan('${fileName}', ${position})`,
|
||||
() => this.languageService.getDefinitionAndBoundSpan(fileName, position)
|
||||
);
|
||||
}
|
||||
|
||||
/// GOTO Type
|
||||
|
||||
/**
|
||||
|
|
|
@ -259,6 +259,7 @@ namespace ts {
|
|||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
|
||||
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan;
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getImplementationAtPosition(fileName: string, position: number): ImplementationLocation[];
|
||||
|
||||
|
@ -581,6 +582,11 @@ namespace ts {
|
|||
containerName: string;
|
||||
}
|
||||
|
||||
export interface DefinitionInfoAndBoundSpan {
|
||||
definitions: ReadonlyArray<DefinitionInfo>;
|
||||
textSpan: TextSpan;
|
||||
}
|
||||
|
||||
export interface ReferencedSymbolDefinitionInfo extends DefinitionInfo {
|
||||
displayParts: SymbolDisplayPart[];
|
||||
}
|
||||
|
|
|
@ -3947,6 +3947,7 @@ declare namespace ts {
|
|||
getRenameInfo(fileName: string, position: number): RenameInfo;
|
||||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan;
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getImplementationAtPosition(fileName: string, position: number): ImplementationLocation[];
|
||||
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
|
@ -4210,6 +4211,10 @@ declare namespace ts {
|
|||
containerKind: ScriptElementKind;
|
||||
containerName: string;
|
||||
}
|
||||
interface DefinitionInfoAndBoundSpan {
|
||||
definitions: ReadonlyArray<DefinitionInfo>;
|
||||
textSpan: TextSpan;
|
||||
}
|
||||
interface ReferencedSymbolDefinitionInfo extends DefinitionInfo {
|
||||
displayParts: SymbolDisplayPart[];
|
||||
}
|
||||
|
@ -4845,6 +4850,7 @@ declare namespace ts.server.protocol {
|
|||
CompileOnSaveEmitFile = "compileOnSaveEmitFile",
|
||||
Configure = "configure",
|
||||
Definition = "definition",
|
||||
DefinitionAndBoundSpan = "definitionAndBoundSpan",
|
||||
Implementation = "implementation",
|
||||
Exit = "exit",
|
||||
Format = "format",
|
||||
|
@ -5364,12 +5370,19 @@ declare namespace ts.server.protocol {
|
|||
*/
|
||||
file: string;
|
||||
}
|
||||
interface DefinitionInfoAndBoundSpan {
|
||||
definitions: ReadonlyArray<FileSpan>;
|
||||
textSpan: TextSpan;
|
||||
}
|
||||
/**
|
||||
* Definition response message. Gives text range for definition.
|
||||
*/
|
||||
interface DefinitionResponse extends Response {
|
||||
body?: FileSpan[];
|
||||
}
|
||||
interface DefinitionInfoAndBoundSpanReponse extends Response {
|
||||
body?: DefinitionInfoAndBoundSpan;
|
||||
}
|
||||
/**
|
||||
* Definition response message. Gives text range for definition.
|
||||
*/
|
||||
|
@ -6945,6 +6958,9 @@ declare namespace ts.server {
|
|||
private convertToDiagnosticsWithLinePosition(diagnostics, scriptInfo);
|
||||
private getDiagnosticsWorker(args, isSemantic, selector, includeLinePosition);
|
||||
private getDefinition(args, simplifiedResult);
|
||||
private getDefinitionAndBoundSpan(args, simplifiedResult);
|
||||
private mapDefinitionInfo(definitions, project);
|
||||
private toFileSpan(fileName, textSpan, project);
|
||||
private getTypeDefinition(args);
|
||||
private getImplementation(args, simplifiedResult);
|
||||
private getOccurrences(args);
|
||||
|
@ -6994,10 +7010,10 @@ declare namespace ts.server {
|
|||
private reload(args, reqSeq);
|
||||
private saveToTmp(fileName, tempFileName);
|
||||
private closeClientFile(fileName);
|
||||
private decorateNavigationBarItems(items, scriptInfo);
|
||||
private mapLocationNavigationBarItems(items, scriptInfo);
|
||||
private getNavigationBarItems(args, simplifiedResult);
|
||||
private decorateNavigationTree(tree, scriptInfo);
|
||||
private decorateSpan(span, scriptInfo);
|
||||
private toLocationNavigationTree(tree, scriptInfo);
|
||||
private toLocationTextSpan(span, scriptInfo);
|
||||
private getNavigationTree(args, simplifiedResult);
|
||||
private getNavigateToItems(args, simplifiedResult);
|
||||
private getSupportedCodeFixes();
|
||||
|
|
|
@ -3947,6 +3947,7 @@ declare namespace ts {
|
|||
getRenameInfo(fileName: string, position: number): RenameInfo;
|
||||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan;
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getImplementationAtPosition(fileName: string, position: number): ImplementationLocation[];
|
||||
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
|
@ -4210,6 +4211,10 @@ declare namespace ts {
|
|||
containerKind: ScriptElementKind;
|
||||
containerName: string;
|
||||
}
|
||||
interface DefinitionInfoAndBoundSpan {
|
||||
definitions: ReadonlyArray<DefinitionInfo>;
|
||||
textSpan: TextSpan;
|
||||
}
|
||||
interface ReferencedSymbolDefinitionInfo extends DefinitionInfo {
|
||||
displayParts: SymbolDisplayPart[];
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
// @Filename: user.ts
|
||||
///////<reference path="declarations.d.ts"/>
|
||||
////import /*importFoo*/foo, {bar} from "jquery";
|
||||
////import * as /*importBaz*/baz from "jquery";
|
||||
////import /*importBang*/bang = require("jquery");
|
||||
////foo/*useFoo*/(bar/*useBar*/, baz/*useBaz*/, bang/*useBang*/);
|
||||
////import [|/*importFoo*/foo|], {bar} from "jquery";
|
||||
////import * as [|/*importBaz*/baz|] from "jquery";
|
||||
////import [|/*importBang*/bang|] = require("jquery");
|
||||
////[|foo/*useFoo*/|]([|bar/*useBar*/|], [|baz/*useBaz*/|], [|bang/*useBang*/|]);
|
||||
|
||||
verify.quickInfoAt("useFoo", "import foo");
|
||||
verify.goToDefinition({
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: b.ts
|
||||
////import n = require('./a/*1*/');
|
||||
////import n = require([|'./a/*1*/'|]);
|
||||
////var x = new n.Foo();
|
||||
|
||||
// @Filename: a.ts
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//// secondMember,
|
||||
//// thirdMember
|
||||
////}
|
||||
////var enumMember = e./*1*/thirdMember;
|
||||
////var enumMember = e.[|/*1*/thirdMember|];
|
||||
|
||||
goTo.marker("1");
|
||||
verify.goToDefinitionName("thirdMember", "e");
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// @noImplicitReferences: true
|
||||
|
||||
// @Filename: /node_modules/a/index.d.ts
|
||||
////import /*useAX*/[|{| "isWriteAccess": true, "isDefinition": true |}X|] from "x";
|
||||
////import [|{| "name": "useAX", "isWriteAccess": true, "isDefinition": true |}X|] from "x";
|
||||
////export function a(x: [|X|]): void;
|
||||
|
||||
// @Filename: /node_modules/a/node_modules/x/index.d.ts
|
||||
|
@ -14,7 +14,7 @@
|
|||
////{ "name": "x", "version": "1.2.3" }
|
||||
|
||||
// @Filename: /node_modules/b/index.d.ts
|
||||
////import /*useBX*/[|{| "isWriteAccess": true, "isDefinition": true |}X|] from "x";
|
||||
////import [|{| "name": "useBX", "isWriteAccess": true, "isDefinition": true |}X|] from "x";
|
||||
////export const b: [|X|];
|
||||
|
||||
// @Filename: /node_modules/b/node_modules/x/index.d.ts
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
// @Filename: b.ts
|
||||
////import [|{| "isWriteAccess": true, "isDefinition": true |}g|] from "./a";
|
||||
/////*ref*/[|g|]();
|
||||
////[|/*ref*/g|]();
|
||||
|
||||
// @Filename: c.ts
|
||||
////import { f } from "./a";
|
||||
|
|
|
@ -221,6 +221,7 @@ declare namespace FourSlashInterface {
|
|||
* `verify.goToDefinition("a", ["b", "bb"]);` verifies that "a" has multiple definitions available.
|
||||
*/
|
||||
goToDefinition(startMarkerNames: string | string[], endMarkerNames: string | string[]): void;
|
||||
goToDefinition(startMarkerNames: string | string[], endMarkerNames: string | string[], range: Range): void;
|
||||
/** Performs `goToDefinition` for each pair. */
|
||||
goToDefinition(startsAndEnds: [string | string[], string | string[]][]): void;
|
||||
/** Performs `goToDefinition` on each key and value. */
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
//@Filename: c.ts
|
||||
/////// <reference path="a.ts" />
|
||||
/////// <reference path="b.ts" />
|
||||
/////*use*/x++;
|
||||
////[|/*use*/x|]++;
|
||||
|
||||
verify.goToDefinition("use", ["def1", "def2"]);
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
////}
|
||||
////
|
||||
////// Type position
|
||||
////var t1: /*alias1Type*/alias1.IFoo;
|
||||
////var t2: Module./*alias2Type*/alias2.IFoo;
|
||||
////var t1: [|/*alias1Type*/alias1|].IFoo;
|
||||
////var t2: Module.[|/*alias2Type*/alias2|].IFoo;
|
||||
////
|
||||
////// Value posistion
|
||||
////var v1 = new /*alias1Value*/alias1.Foo();
|
||||
////var v2 = new Module./*alias2Value*/alias2.Foo();
|
||||
////var v1 = new [|/*alias1Value*/alias1|].Foo();
|
||||
////var v2 = new Module.[|/*alias2Value*/alias2|].Foo();
|
||||
|
||||
|
||||
// @Filename: a.ts
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
////}
|
||||
////
|
||||
////var o = 0;
|
||||
////o./*reference1*/myObjectMethod();
|
||||
////o["/*reference2*/myObjectMethod"]();
|
||||
////o.[|/*reference1*/myObjectMethod|]();
|
||||
////o[[|"/*reference2*/myObjectMethod"|]]();
|
||||
|
||||
verify.goToDefinition(["reference1", "reference2"], "definition");
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
////var x = class C {
|
||||
//// /*definition*/constructor() {
|
||||
//// var other = new /*usage*/C;
|
||||
//// var other = new [|/*usage*/C|];
|
||||
//// }
|
||||
////}
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
//// }
|
||||
////}
|
||||
////
|
||||
////var x = new /*usage*/Foo();
|
||||
////var x = new [|/*usage*/Foo|]();
|
||||
|
||||
verify.goToDefinition("usage", "definition");
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////class ConstructorOverload {
|
||||
//// /*constructorOverload1*/constructor();
|
||||
//// [|/*constructorOverload1*/constructor|]();
|
||||
//// /*constructorOverload2*/constructor(foo: string);
|
||||
//// /*constructorDefinition*/constructor(foo: any) { }
|
||||
////}
|
||||
////
|
||||
////var constructorOverload = new /*constructorOverloadReference1*/ConstructorOverload();
|
||||
////var constructorOverload = new /*constructorOverloadReference2*/ConstructorOverload("foo");
|
||||
////var constructorOverload = new [|/*constructorOverloadReference1*/ConstructorOverload|]();
|
||||
////var constructorOverload = new [|/*constructorOverloadReference2*/ConstructorOverload|]("foo");
|
||||
|
||||
verify.goToDefinition({
|
||||
constructorOverloadReference1: "constructorOverload1",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: b.ts
|
||||
////@/*decoratorUse*/decorator
|
||||
////@[|/*decoratorUse*/decorator|]
|
||||
////class C {
|
||||
//// @decora/*decoratorFactoryUse*/torFactory(a, "22", true)
|
||||
//// @[|decora/*decoratorFactoryUse*/torFactory|](a, "22", true)
|
||||
//// method() {}
|
||||
////}
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
////
|
||||
////declare const s: symbol;
|
||||
////class C {
|
||||
//// @/*useDecString*/dec f() {}
|
||||
//// @/*useDecSymbol*/dec [s]() {}
|
||||
//// @[|/*useDecString*/dec|] f() {}
|
||||
//// @[|/*useDecSymbol*/dec|] [s]() {}
|
||||
////}
|
||||
|
||||
verify.goToDefinition({
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
// @Filename: foo.ts
|
||||
//// /*Destination*/export function foo() { return "foo"; }
|
||||
|
||||
//// import("./f/*1*/oo")
|
||||
//// var x = import("./fo/*2*/o")
|
||||
//// import([|"./f/*1*/oo"|])
|
||||
//// var x = import([|"./fo/*2*/o"|])
|
||||
|
||||
verify.goToDefinition("1", "Destination");
|
||||
verify.goToDefinition("2", "Destination");
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
//// var x = import("./foo");
|
||||
//// x.then(foo => {
|
||||
//// foo.b/*1*/ar();
|
||||
//// foo.[|b/*1*/ar|]();
|
||||
//// })
|
||||
|
||||
verify.goToDefinition("1", "Destination");
|
|
@ -3,6 +3,6 @@
|
|||
// @Filename: foo.ts
|
||||
//// export function /*Destination*/bar() { return "bar"; }
|
||||
|
||||
//// import('./foo').then(({ ba/*1*/r }) => undefined);
|
||||
//// import('./foo').then(({ [|ba/*1*/r|] }) => undefined);
|
||||
|
||||
verify.goToDefinition("1", "Destination");
|
|
@ -3,6 +3,6 @@
|
|||
// @Filename: foo.ts
|
||||
//// export function /*Destination*/bar() { return "bar"; }
|
||||
|
||||
//// import('./foo').then(({ ba/*1*/r }) => undefined);
|
||||
//// import('./foo').then(({ [|ba/*1*/r|] }) => undefined);
|
||||
|
||||
verify.goToDefinition("1", "Destination");
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: b.ts
|
||||
////import n = require('./a/*1*/');
|
||||
////import n = require([|'./a/*1*/'|]);
|
||||
////var x = new n.Foo();
|
||||
|
||||
// @Filename: a.ts
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: b.ts
|
||||
////import n = require('./a/*1*/');
|
||||
////import n = require([|'./a/*1*/'|]);
|
||||
////var x = new n.Foo();
|
||||
|
||||
// @Filename: a.ts
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: b.ts
|
||||
////import n = require('e/*1*/');
|
||||
////import n = require([|'e/*1*/'|]);
|
||||
////var x = new n.Foo();
|
||||
|
||||
// @Filename: a.ts
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: a.ts
|
||||
////declare module /*2*/"external/*1*/" {
|
||||
////declare module /*2*/[|"external/*1*/"|] {
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: b.ts
|
||||
////import * from 'e/*1*/';
|
||||
////import * from [|'e/*1*/'|];
|
||||
|
||||
// @Filename: a.ts
|
||||
////declare module /*2*/"e" {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: b.ts
|
||||
////import {Foo, Bar} from 'e/*1*/';
|
||||
////import {Foo, Bar} from [|'e/*1*/'|];
|
||||
|
||||
// @Filename: a.ts
|
||||
////declare module /*2*/"e" {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: b.ts
|
||||
////export {Foo, Bar} from 'e/*1*/';
|
||||
////export {Foo, Bar} from [|'e/*1*/'|];
|
||||
|
||||
// @Filename: a.ts
|
||||
////declare module /*2*/"e" {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: b.ts
|
||||
////export * from 'e/*1*/';
|
||||
////export * from [|'e/*1*/'|];
|
||||
|
||||
// @Filename: a.ts
|
||||
////declare module /*2*/"e" {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////function /*functionOverload1*/functionOverload(value: number);
|
||||
////function [|/*functionOverload1*/functionOverload|](value: number);
|
||||
////function /*functionOverload2*/functionOverload(value: string);
|
||||
////function /*functionOverloadDefinition*/functionOverload() {}
|
||||
////
|
||||
/////*functionOverloadReference1*/functionOverload(123);
|
||||
/////*functionOverloadReference2*/functionOverload("123");
|
||||
/////*brokenOverload*/functionOverload({});
|
||||
////[|/*functionOverloadReference1*/functionOverload|](123);
|
||||
////[|/*functionOverloadReference2*/functionOverload|]("123");
|
||||
////[|/*brokenOverload*/functionOverload|]({});
|
||||
|
||||
verify.goToDefinition({
|
||||
functionOverloadReference1: "functionOverload1",
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
////class clsInOverload {
|
||||
//// static fnOverload();
|
||||
//// static /*staticFunctionOverload*/fnOverload(foo: string);
|
||||
//// static [|/*staticFunctionOverload*/fnOverload|](foo: string);
|
||||
//// static /*staticFunctionOverloadDefinition*/fnOverload(foo: any) { }
|
||||
//// public /*functionOverload*/fnOverload(): any;
|
||||
//// public [|/*functionOverload*/fnOverload|](): any;
|
||||
//// public fnOverload(foo: string);
|
||||
//// public /*functionOverloadDefinition*/fnOverload(foo: any) { return "foo" }
|
||||
////
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: b.ts
|
||||
////export {/*classAliasDefinition*/Class} from "./a";
|
||||
////export {[|/*classAliasDefinition*/Class|]} from "./a";
|
||||
|
||||
|
||||
// @Filename: a.ts
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: b.ts
|
||||
////import {/*classAliasDefinition*/Class} from "./a";
|
||||
////import {[|/*classAliasDefinition*/Class|]} from "./a";
|
||||
|
||||
|
||||
// @Filename: a.ts
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: e.ts
|
||||
//// import {M, /*classAliasDefinition*/C, I} from "./d";
|
||||
//// var c = new /*classReference*/C();
|
||||
//// import {M, [|/*classAliasDefinition*/C|], I} from "./d";
|
||||
//// var c = new [|/*classReference*/C|]();
|
||||
|
||||
|
||||
// @Filename: d.ts
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: b.ts
|
||||
////import {Class as /*classAliasDefinition*/ClassAlias} from "./a";
|
||||
////import {Class as [|/*classAliasDefinition*/ClassAlias|]} from "./a";
|
||||
|
||||
|
||||
// @Filename: a.ts
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: b.ts
|
||||
////export {Class as /*classAliasDefinition*/ClassAlias} from "./a";
|
||||
////export {Class as [|/*classAliasDefinition*/ClassAlias|]} from "./a";
|
||||
|
||||
|
||||
// @Filename: a.ts
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: b.ts
|
||||
////import /*moduleAliasDefinition*/alias = require("./a");
|
||||
////import [|/*moduleAliasDefinition*/alias|] = require("./a");
|
||||
|
||||
|
||||
// @Filename: a.ts
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: b.ts
|
||||
////import /*classAliasDefinition*/defaultExport from "./a";
|
||||
////import [|/*classAliasDefinition*/defaultExport|] from "./a";
|
||||
|
||||
|
||||
// @Filename: a.ts
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
////import f, { x } from "./a";
|
||||
////import * as /*aDef*/a from "./a";
|
||||
////import b = require("./b");
|
||||
/////*fUse*/f;
|
||||
/////*xUse*/x;
|
||||
/////*aUse*/a;
|
||||
/////*bUse*/b;
|
||||
////[|/*fUse*/f|];
|
||||
////[|/*xUse*/x|];
|
||||
////[|/*aUse*/a|];
|
||||
////[|/*bUse*/b|];
|
||||
|
||||
verify.goToDefinition({
|
||||
aUse: "aDef", // Namespace import isn't "skipped"
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
////enum /*enumDefinition*/Enum { value1, value2 };
|
||||
////
|
||||
////class /*selfDefinition*/Bar {
|
||||
//// public _interface: IFo/*interfaceReference*/o = new Fo/*classReferenceInInitializer*/o();
|
||||
//// public _class: Fo/*classReference*/o = new Foo();
|
||||
//// public _list: IF/*interfaceReferenceInList*/oo[]=[];
|
||||
//// public _enum: E/*enumReference*/num = En/*enumReferenceInInitializer*/um.value1;
|
||||
//// public _self: Ba/*selfReference*/r;
|
||||
//// public _interface: [|IFo/*interfaceReference*/o|] = new [|Fo/*classReferenceInInitializer*/o|]();
|
||||
//// public _class: [|Fo/*classReference*/o|] = new Foo();
|
||||
//// public _list: [|IF/*interfaceReferenceInList*/oo|][]=[];
|
||||
//// public _enum: [|E/*enumReference*/num|] = [|En/*enumReferenceInInitializer*/um|].value1;
|
||||
//// public _self: [|Ba/*selfReference*/r|];
|
||||
////
|
||||
//// constructor(public _inConstructor: IFo/*interfaceReferenceInConstructor*/o) {
|
||||
//// constructor(public _inConstructor: [|IFo/*interfaceReferenceInConstructor*/o|]) {
|
||||
//// }
|
||||
////}
|
||||
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
/////*2*/module.exports = {};
|
||||
|
||||
// @Filename: bar.js
|
||||
////var x = require(/*1*/"./foo");
|
||||
////var x = require([|/*1*/"./foo"|]);
|
||||
|
||||
verify.goToDefinition("1", "2");
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
/////*label1Definition*/label1: while (true) {
|
||||
//// /*label2Definition*/label2: while (true) {
|
||||
//// break /*1*/label1;
|
||||
//// continue /*2*/label2;
|
||||
//// () => { break /*3*/label1; }
|
||||
//// break [|/*1*/label1|];
|
||||
//// continue [|/*2*/label2|];
|
||||
//// () => { break [|/*3*/label1|]; }
|
||||
//// continue /*4*/unknownLabel;
|
||||
//// }
|
||||
////}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////class MethodOverload {
|
||||
//// static /*staticMethodOverload1*/method();
|
||||
//// static [|/*staticMethodOverload1*/method|]();
|
||||
//// static /*staticMethodOverload2*/method(foo: string);
|
||||
//// static /*staticMethodDefinition*/method(foo?: any) { }
|
||||
//// public /*instanceMethodOverload1*/method(): any;
|
||||
//// public [|/*instanceMethodOverload1*/method|](): any;
|
||||
//// public /*instanceMethodOverload2*/method(foo: string);
|
||||
//// public /*instanceMethodDefinition*/method(foo?: any) { return "foo" }
|
||||
////}
|
||||
|
||||
////// static method
|
||||
////MethodOverload./*staticMethodReference1*/method();
|
||||
////MethodOverload./*staticMethodReference2*/method("123");
|
||||
////MethodOverload.[|/*staticMethodReference1*/method|]();
|
||||
////MethodOverload.[|/*staticMethodReference2*/method|]("123");
|
||||
|
||||
////// instance method
|
||||
////var methodOverload = new MethodOverload();
|
||||
////methodOverload./*instanceMethodReference1*/method();
|
||||
////methodOverload./*instanceMethodReference2*/method("456");
|
||||
////methodOverload.[|/*instanceMethodReference1*/method|]();
|
||||
////methodOverload.[|/*instanceMethodReference2*/method|]("456");
|
||||
|
||||
verify.goToDefinition({
|
||||
staticMethodReference1: "staticMethodOverload1",
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
//// instance3: number;
|
||||
////}
|
||||
////
|
||||
////var ifoo: IFo/*interfaceReference*/o;
|
||||
////var ifoo: [|IFo/*interfaceReference*/o|];
|
||||
|
||||
verify.goToDefinition("interfaceReference", ["interfaceDefinition1", "interfaceDefinition2", "interfaceDefinition3"]);
|
||||
|
||||
|
@ -29,6 +29,6 @@ verify.goToDefinition("interfaceReference", ["interfaceDefinition1", "interfaceD
|
|||
////}
|
||||
|
||||
// @Filename: e.ts
|
||||
////Modul/*moduleReference*/e;
|
||||
////[|Modul/*moduleReference*/e|];
|
||||
|
||||
verify.goToDefinition("moduleReference", ["moduleDefinition1", "moduleDefinition2"]);
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var { /*use*/property1: prop1 } = foo;
|
||||
////var { [|/*use*/property1|]: prop1 } = foo;
|
||||
|
||||
verify.goToDefinition("use", "def");
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
//// }
|
||||
//// function foo(arg: PropsBag) {}
|
||||
//// foo({
|
||||
//// pr/*p1*/opx: 10
|
||||
//// [|pr/*p1*/opx|]: 10
|
||||
//// })
|
||||
//// function bar(firstarg: boolean, secondarg: PropsBag) {}
|
||||
//// bar(true, {
|
||||
//// pr/*p2*/opx: 10
|
||||
//// [|pr/*p2*/opx|]: 10
|
||||
//// })
|
||||
|
||||
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
////let a1: A1;
|
||||
////let a2: A2;
|
||||
////let a12 = { ...a1, ...a2 };
|
||||
////a12.a/*3*/;
|
||||
////a12.[|a/*3*/|];
|
||||
verify.goToDefinition('3', [ '1', '2' ]);
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
//// export function f(value: number | string) {}
|
||||
//// }
|
||||
////}
|
||||
////A.B./*2*/f("");
|
||||
////A.B.[|/*2*/f|]("");
|
||||
|
||||
verify.goToDefinition("2", "1");
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//// x: number;
|
||||
//// }
|
||||
////
|
||||
//// var x: /*Part2Use*/IA;
|
||||
//// var x: [|/*Part2Use*/IA|];
|
||||
////}
|
||||
|
||||
verify.goToDefinition("Part2Use", ["Part1Definition", "Part2Definition"]);
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
////}
|
||||
////let t: Gen;
|
||||
////var { x, ...rest } = t;
|
||||
////rest./*2*/parent;
|
||||
////rest.[|/*2*/parent|];
|
||||
const ranges = test.ranges();
|
||||
verify.goToDefinition('2', [ '1' ]);
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
//// var /*valueDeclaration1*/name = "hello";
|
||||
//// var /*valueDeclaration2*/id = 100000;
|
||||
//// declare var /*valueDeclaration3*/id;
|
||||
//// var obj = {/*valueDefinition1*/name, /*valueDefinition2*/id};
|
||||
//// obj./*valueReference1*/name;
|
||||
//// obj./*valueReference2*/id;
|
||||
//// var obj = {[|/*valueDefinition1*/name|], [|/*valueDefinition2*/id|]};
|
||||
//// obj.[|/*valueReference1*/name|];
|
||||
//// obj.[|/*valueReference2*/id|];
|
||||
|
||||
verify.goToDefinition({
|
||||
valueDefinition1: "valueDeclaration1",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////let x = {
|
||||
//// f/*1*/oo
|
||||
//// [|f/*1*/oo|]
|
||||
////}
|
||||
|
||||
verify.goToDefinition("1", []);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////var /*varDef*/x = {
|
||||
//// /*varProp*/x
|
||||
//// [|/*varProp*/x|]
|
||||
////}
|
||||
////let /*letDef*/y = {
|
||||
//// /*letProp*/y
|
||||
//// [|/*letProp*/y|]
|
||||
////}
|
||||
|
||||
verify.goToDefinition({
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
////class /*2*/c { }
|
||||
|
||||
// @Filename: Consumption.ts
|
||||
//// var n = new /*1*/c();
|
||||
//// var n = new c/*3*/();
|
||||
//// var n = new [|/*1*/c|]();
|
||||
//// var n = new [|c/*3*/|]();
|
||||
|
||||
verify.goToDefinition(["1", "3"], "2");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
//// //MyFile Comments
|
||||
//// //more comments
|
||||
//// /// <reference path="so/*unknownFile*/mePath.ts" />
|
||||
//// /// <reference path="b/*knownFile*/.ts" />
|
||||
//// /// <reference path="[|b/*knownFile*/.ts|]" />
|
||||
////
|
||||
//// class clsInOverload {
|
||||
//// static fnOverload();
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
////function /*defFBool*/f(strs: TemplateStringsArray, x: boolean): void;
|
||||
////function f(strs: TemplateStringsArray, x: number | boolean) {}
|
||||
////
|
||||
/////*useFNumber*/f`${0}`;
|
||||
/////*useFBool*/f`${false}`;
|
||||
////[|/*useFNumber*/f|]`${0}`;
|
||||
////[|/*useFBool*/f|]`${false}`;
|
||||
|
||||
verify.goToDefinition({
|
||||
useFNumber: "defFNumber",
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////function f(/*fnDecl*/this: number) {
|
||||
//// return /*fnUse*/this;
|
||||
//// return [|/*fnUse*/this|];
|
||||
////}
|
||||
////class /*cls*/C {
|
||||
//// constructor() { return /*clsUse*/this; }
|
||||
//// get self(/*getterDecl*/this: number) { return /*getterUse*/this; }
|
||||
//// constructor() { return [|/*clsUse*/this|]; }
|
||||
//// get self(/*getterDecl*/this: number) { return [|/*getterUse*/this|]; }
|
||||
////}
|
||||
|
||||
verify.goToDefinition({
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class /*classDeclaration*/A {}
|
||||
//// function f(/*parameterDeclaration*/parameter: any): /*parameterName*/parameter is /*typeReference*/A {
|
||||
//// function f(/*parameterDeclaration*/parameter: any): [|/*parameterName*/parameter|] is [|/*typeReference*/A|] {
|
||||
//// return typeof parameter === "string";
|
||||
//// }
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/////*0*/declare let $: {x: number};
|
||||
|
||||
// @Filename: src/app.ts
|
||||
//// /// <reference types="lib/*1*/"/>
|
||||
//// /// <reference types="[|lib/*1*/|]"/>
|
||||
//// $.x;
|
||||
|
||||
verify.goToDefinition("1", "0");
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
////
|
||||
////var x : One | Two;
|
||||
////
|
||||
////x./*propertyReference*/commonProperty;
|
||||
////x.[|/*propertyReference*/commonProperty|];
|
||||
////x./*3*/commonFunction;
|
||||
|
||||
verify.goToDefinition("propertyReference", ["propertyDefinition1", "propertyDefinition2"]);
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
////
|
||||
////var x : One | Two;
|
||||
////
|
||||
////x.common./*propertyReference*/a;
|
||||
////x.common.[|/*propertyReference*/a|];
|
||||
|
||||
verify.goToDefinition("propertyReference", ["propertyDefinition2", "propertyDefinition1"]);
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
////var strings: string[];
|
||||
////var numbers: number[];
|
||||
////
|
||||
////var x = (strings || numbers)./*usage*/specialPop()
|
||||
////var x = (strings || numbers).[|/*usage*/specialPop|]()
|
||||
|
||||
verify.goToDefinition("usage", "definition");
|
||||
|
|
|
@ -16,6 +16,6 @@
|
|||
////var magnitude: Magnitude;
|
||||
////var snapcrackle: SnapCrackle;
|
||||
////
|
||||
////var x = (snapcrackle || magnitude || art)./*usage*/pop;
|
||||
////var x = (snapcrackle || magnitude || art).[|/*usage*/pop|];
|
||||
|
||||
verify.goToDefinition("usage", ["def1", "def2", "def3"]);
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
////class /*B*/B extends A {}
|
||||
////class C extends B {
|
||||
//// constructor() {
|
||||
//// /*super*/super();
|
||||
//// [|/*super*/super|]();
|
||||
//// }
|
||||
//// method() {
|
||||
//// /*superExpression*/super.x();
|
||||
//// [|/*superExpression*/super|].x();
|
||||
//// }
|
||||
////}
|
||||
////class D {
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
|
||||
// @Filename: /a.ts
|
||||
////import { /*def*/f } from "foo";
|
||||
/////*use*/f();
|
||||
////[|/*use*/f|]();
|
||||
|
||||
verify.goToDefinition("use", "def");
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
// @Filename: b.ts
|
||||
//// import /*3*/n = require('a');
|
||||
//// var x = new /*1*/n.Foo();
|
||||
//// var x = new [|/*1*/n|].Foo();
|
||||
|
||||
// Won't-fixed: Should go to '2' instead
|
||||
verify.goToDefinition("1", "3");
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
//// interface Test {
|
||||
//// /*destination*/prop2: number
|
||||
//// }
|
||||
//// bar<Test>(({pr/*goto*/op2})=>{});
|
||||
//// bar<Test>(({[|pr/*goto*/op2|]})=>{});
|
||||
|
||||
verify.goToDefinition("goto", "destination");
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// var p0 = ({a/*1*/a}) => {console.log(aa)};
|
||||
//// function f2({ a/*a1*/1, b/*b1*/1 }: { /*a1_dest*/a1: number, /*b1_dest*/b1: number } = { a1: 0, b1: 0 }) {}
|
||||
//// function f2({ [|a/*a1*/1|], [|b/*b1*/1|] }: { /*a1_dest*/a1: number, /*b1_dest*/b1: number } = { a1: 0, b1: 0 }) {}
|
||||
|
||||
verify.goToDefinition("1", []);
|
||||
verify.goToDefinition("a1", "a1_dest");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
//// function foo() {
|
||||
//// return {/*refB*/B: B};
|
||||
//// }
|
||||
//// class C extends (foo())./*B*/B {}
|
||||
//// class C1 extends foo()./*B1*/B {}
|
||||
//// class C extends (foo()).[|/*B*/B|] {}
|
||||
//// class C1 extends foo().[|/*B1*/B|] {}
|
||||
|
||||
verify.goToDefinition([["B", "refB"], ["B1", "refB"]]);
|
|
@ -12,8 +12,8 @@
|
|||
//// method() { return this.alpha; }
|
||||
//// }
|
||||
//// var x = new Foo();
|
||||
//// x.alpha/*src1*/;
|
||||
//// x.beta/*src2*/;
|
||||
//// x.[|alpha/*src1*/|];
|
||||
//// x.[|beta/*src2*/|];
|
||||
|
||||
verify.goToDefinition({
|
||||
src1: "dst1",
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//// */
|
||||
|
||||
/////**
|
||||
//// * @type {/*use*/[|Product|]}
|
||||
//// * @type {[|/*use*/Product|]}
|
||||
//// */
|
||||
////const product = null;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
// @Filename: b.ts
|
||||
////import n = require('./a/*1*/');
|
||||
////import n = require([|'./a/*1*/'|]);
|
||||
////var x = new n.Foo();
|
||||
|
||||
// @Filename: a.ts
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
//// */
|
||||
////
|
||||
//// /** @type {Person} */
|
||||
//// var person; person.personName/*3*/
|
||||
//// var person; person.[|personName/*3*/|]
|
||||
////
|
||||
//// /** @type {Animal} */
|
||||
//// var animal; animal.animalName/*4*/
|
||||
//// var animal; animal.[|animalName/*4*/|]
|
||||
|
||||
verify.goToDefinition({
|
||||
3: "1",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/////*0*/declare let $: {x: number};
|
||||
|
||||
// @Filename: src/app.ts
|
||||
//// /// <reference types="lib/*1*/"/>
|
||||
//// /// <reference types="[|lib/*1*/|]"/>
|
||||
//// $.x;
|
||||
|
||||
verify.goToDefinition("1", "0");
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/////*0*/declare let $: {x: number};
|
||||
|
||||
// @Filename: src/app.ts
|
||||
//// /// <reference types="lib/*1*/"/>
|
||||
//// /// <reference types="[|lib/*1*/|]"/>
|
||||
//// $.x;
|
||||
|
||||
verify.goToDefinition("1", "0");
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
//// /*pt*/foo: string;
|
||||
//// }
|
||||
//// }
|
||||
//// var x = <My/*c*/Class />;
|
||||
//// var y = <MyClass f/*p*/oo= 'hello' />;
|
||||
//// var z = <MyCl/*w*/ass wrong= 'hello' />;
|
||||
//// var x = <[|My/*c*/Class|] />;
|
||||
//// var y = <MyClass [|f/*p*/oo|]= 'hello' />;
|
||||
//// var z = <[|MyCl/*w*/ass|] wrong= 'hello' />;
|
||||
|
||||
verify.goToDefinition({
|
||||
c: "ct",
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
//// /*st*/span: { n: string; };
|
||||
//// }
|
||||
//// }
|
||||
//// var x = <di/*ds*/v />;
|
||||
//// var y = <s/*ss*/pan />;
|
||||
//// var z = <div na/*ps*/me='hello' />;
|
||||
//// var x = <[|di/*ds*/v|] />;
|
||||
//// var y = <[|s/*ss*/pan|] />;
|
||||
//// var z = <div [|na/*ps*/me|]='hello' />;
|
||||
|
||||
verify.goToDefinition({
|
||||
ds: "dt",
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
//// /*pt2*/optional?: boolean
|
||||
//// }
|
||||
//// declare function /*opt*/Opt(attributes: OptionPropBag): JSX.Element;
|
||||
//// let opt = <O/*one*/pt />;
|
||||
//// let opt1 = <Op/*two*/t pr/*p1*/opx={100} />;
|
||||
//// let opt2 = <Op/*three*/t propx={100} opt/*p2*/ional />;
|
||||
//// let opt3 = <Op/*four*/t wr/*p3*/ong />;
|
||||
//// let opt = <[|O/*one*/pt|] />;
|
||||
//// let opt1 = <[|Op/*two*/t|] [|pr/*p1*/opx|]={100} />;
|
||||
//// let opt2 = <[|Op/*three*/t|] propx={100} [|opt/*p2*/ional|] />;
|
||||
//// let opt3 = <[|Op/*four*/t|] wr/*p3*/ong />;
|
||||
|
||||
verify.goToDefinition({
|
||||
one: "opt",
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
//// declare function /*firstSource*/MainButton(buttonProps: ButtonProps): JSX.Element;
|
||||
//// declare function /*secondSource*/MainButton(linkProps: LinkProps): JSX.Element;
|
||||
//// declare function /*thirdSource*/MainButton(props: ButtonProps | LinkProps): JSX.Element;
|
||||
//// let opt = <Main/*firstTarget*/Button />;
|
||||
//// let opt = <Main/*secondTarget*/Button children="chidlren" />;
|
||||
//// let opt = <Main/*thirdTarget*/Button onClick={()=>{}} />;
|
||||
//// let opt = <Main/*fourthTarget*/Button onClick={()=>{}} ignore-prop />;
|
||||
//// let opt = <Main/*fivethTarget*/Button goTo="goTo" />;
|
||||
//// let opt = <Main/*sixthTarget*/Button wrong />;
|
||||
//// let opt = <[|Main/*firstTarget*/Button|] />;
|
||||
//// let opt = <[|Main/*secondTarget*/Button|] children="chidlren" />;
|
||||
//// let opt = <[|Main/*thirdTarget*/Button|] onClick={()=>{}} />;
|
||||
//// let opt = <[|Main/*fourthTarget*/Button|] onClick={()=>{}} ignore-prop />;
|
||||
//// let opt = <[|Main/*fivethTarget*/Button|] goTo="goTo" />;
|
||||
//// let opt = <[|Main/*sixthTarget*/Button|] wrong />;
|
||||
|
||||
verify.goToDefinition({
|
||||
firstTarget: "thirdSource",
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
//// }
|
||||
|
||||
//// var SFCComp = SFC1 || SFC2;
|
||||
//// <SFC/*one*/Comp x />
|
||||
//// <[|SFC/*one*/Comp|] x />
|
||||
|
||||
verify.goToDefinition({
|
||||
"one": "pt1"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
//// var /*pt1*/RCComp = RC1 || RC2;
|
||||
|
||||
//// <RC/*one*/Comp />
|
||||
//// <[|RC/*one*/Comp|] />
|
||||
|
||||
verify.goToDefinition({
|
||||
"one": "pt1"
|
||||
|
|
Loading…
Reference in a new issue