Add isDefinition to ReferenceEntry

Clients can now easily tell if the reference is to a definition or a
usage.
This commit is contained in:
Nathan Shively-Sanders
2016-06-13 13:21:47 -07:00
parent 81d1ccfe87
commit 5a7f7469ea
5 changed files with 16 additions and 6 deletions

View File

@@ -1208,6 +1208,7 @@ namespace ts {
textSpan: TextSpan;
fileName: string;
isWriteAccess: boolean;
isDefinition?: boolean;
}
export interface DocumentHighlights {
@@ -6183,7 +6184,8 @@ namespace ts {
references: [{
fileName: sourceFile.fileName,
textSpan: createTextSpan(position, searchText.length),
isWriteAccess: false
isWriteAccess: false,
isDefinition: false
}]
});
}
@@ -6737,7 +6739,8 @@ namespace ts {
return {
fileName: node.getSourceFile().fileName,
textSpan: createTextSpanFromBounds(start, end),
isWriteAccess: isWriteAccess(node)
isWriteAccess: isWriteAccess(node),
isDefinition: isDeclarationName(node)
};
}

View File

@@ -164,7 +164,7 @@ namespace ts {
/**
* Returns a JSON-encoded value of the type:
* { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[]
* { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean, isDefinition?: boolean }[]
*/
getReferencesAtPosition(fileName: string, position: number): string;
@@ -1141,4 +1141,4 @@ namespace TypeScript.Services {
/* @internal */
const toolsVersion = "1.9";
/* tslint:enable:no-unused-variable */
/* tslint:enable:no-unused-variable */