Add test for quickInfo

This commit is contained in:
Mohamed Hegazy 2015-02-14 22:28:38 -08:00
parent 11e246036b
commit 178e8f76e6
2 changed files with 32 additions and 6 deletions

View File

@ -152,10 +152,11 @@ module ts.server {
}
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo {
var lineCol = this.positionToOneBasedLineCol(fileName, position);
var args: ServerProtocol.CodeLocationRequestArgs = {
file: fileName,
line: 0,
col: 1
line: lineCol.line,
col: lineCol.col
};
var request = this.processRequest<ServerProtocol.QuickInfoRequest>(CommandNames.Quickinfo, args);
@ -168,10 +169,8 @@ module ts.server {
kind: response.body.kind,
kindModifiers: response.body.kindModifiers,
textSpan: ts.createTextSpanFromBounds(start, end),
displayParts: undefined,
documentation: undefined,
documentationString: response.body.documentation,
displayString: response.body.displayString
displayParts: [{ kind: "text", text: response.body.displayString }],
documentation: [{ kind: "text", text: response.body.documentation }]
};
}

View File

@ -0,0 +1,27 @@
/// <reference path="fourslash.ts"/>
////interface One {
//// commonProperty: number;
//// commonFunction(): number;
////}
////
////interface Two {
//// commonProperty: string
//// commonFunction(): number;
////}
////
////var /*1*/x : One | Two;
////
////x./*2*/commonProperty;
////x./*3*/commonFunction;
goTo.marker("1");
verify.quickInfoIs('(var) x: One | Two');
goTo.marker("2");
verify.quickInfoIs('(property) commonProperty: string | number');
goTo.marker("3");
verify.quickInfoIs('(method) commonFunction(): number');