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

@@ -376,6 +376,7 @@ namespace ts.server {
fileName: fileName,
textSpan: ts.createTextSpanFromBounds(start, end),
isWriteAccess: entry.isWriteAccess,
isDefinition: entry.isDefinition,
};
});
}

View File

@@ -304,6 +304,11 @@ declare namespace ts.server.protocol {
* True if reference is a write location, false otherwise.
*/
isWriteAccess: boolean;
/**
* True if reference is a definition, false otherwise.
*/
isDefinition?: boolean;
}
/**

View File

@@ -379,7 +379,7 @@ namespace ts.server {
start,
end,
file: fileName,
isWriteAccess
isWriteAccess,
};
});
}
@@ -555,7 +555,8 @@ namespace ts.server {
start: start,
lineText: lineText,
end: compilerService.host.positionToLineOffset(ref.fileName, ts.textSpanEnd(ref.textSpan)),
isWriteAccess: ref.isWriteAccess
isWriteAccess: ref.isWriteAccess,
isDefinition: ref.isDefinition
};
});
},