mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Add test for quickInfo
This commit is contained in:
parent
11e246036b
commit
178e8f76e6
@ -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 }]
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
27
tests/cases/fourslash/server/quickinfo.ts
Normal file
27
tests/cases/fourslash/server/quickinfo.ts
Normal 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');
|
||||
Loading…
x
Reference in New Issue
Block a user