Skip to content

Commit b0c55b2

Browse files
Hook up quick info shims.
1 parent c394463 commit b0c55b2

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

src/services/services.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ module ts {
495495
getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails;
496496

497497
getTypeAtPosition(fileName: string, position: number): TypeInfo;
498-
getQuickInfo(fileName: string, position: number): QuickInfo;
498+
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
499499

500500
getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TypeScript.TextSpan;
501501

@@ -659,6 +659,20 @@ module ts {
659659
public textSpan: TypeScript.TextSpan,
660660
public displayParts: SymbolDisplayPart[]) {
661661
}
662+
663+
public toJSON() {
664+
return {
665+
kind: this.kind,
666+
kindModifiers: this.kindModifiers,
667+
textSpan: this.textSpan,
668+
displayParts: this.displayParts.forEach(d => {
669+
return {
670+
text: d.text,
671+
kind: SymbolDisplayPartKind[d.kind]
672+
};
673+
})
674+
};
675+
}
662676
}
663677

664678
export class TypeInfo {
@@ -2226,7 +2240,7 @@ module ts {
22262240
}
22272241

22282242
/// QuickInfo
2229-
function getQuickInfo(fileName: string, position: number): QuickInfo {
2243+
function getQuickInfoAtPosition(fileName: string, position: number): QuickInfo {
22302244
synchronizeHostData();
22312245

22322246
fileName = TypeScript.switchToForwardSlashes(fileName);
@@ -4062,7 +4076,7 @@ module ts {
40624076
getCompletionsAtPosition: getCompletionsAtPosition,
40634077
getCompletionEntryDetails: getCompletionEntryDetails,
40644078
getTypeAtPosition: getTypeAtPosition,
4065-
getQuickInfo: getQuickInfo,
4079+
getQuickInfoAtPosition: getQuickInfoAtPosition,
40664080
getSignatureHelpItems: (filename, position): SignatureHelpItems => null,
40674081
getSignatureHelpCurrentArgumentState: (fileName, position, applicableSpanStart): SignatureHelpState => null,
40684082
getDefinitionAtPosition: getDefinitionAtPosition,

src/services/shims.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ module ts {
8787
getCompletionsAtPosition(fileName: string, position: number, isMemberCompletion: boolean): string;
8888
getCompletionEntryDetails(fileName: string, position: number, entryName: string): string;
8989

90+
getQuickInfoAtPosition(fileName: string, position: number): string;
9091
getTypeAtPosition(fileName: string, position: number): string;
92+
9193
getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): string;
9294
getBreakpointStatementAtPosition(fileName: string, position: number): string;
9395

@@ -540,6 +542,16 @@ module ts {
540542
/// QUICKINFO
541543
/// Computes a string representation of the type at the requested position
542544
/// in the active file.
545+
public getQuickInfoAtPosition(fileName: string, position: number): string {
546+
return this.forwardJSONCall(
547+
"getQuickInfoAtPosition('" + fileName + "', " + position + ")",
548+
() => {
549+
var quickInfo = this.languageService.getQuickInfoAtPosition(fileName, position);
550+
return quickInfo;
551+
});
552+
}
553+
554+
543555
public getTypeAtPosition(fileName: string, position: number): string {
544556
return this.forwardJSONCall(
545557
"getTypeAtPosition('" + fileName + "', " + position + ")",

0 commit comments

Comments
 (0)