Skip to content

Commit 178e8f7

Browse files
committed
Add test for quickInfo
1 parent 11e2460 commit 178e8f7

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

‎src/server/client.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,11 @@ module ts.server {
152152
}
153153

154154
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo {
155+
var lineCol = this.positionToOneBasedLineCol(fileName, position);
155156
var args: ServerProtocol.CodeLocationRequestArgs = {
156157
file: fileName,
157-
line: 0,
158-
col: 1
158+
line: lineCol.line,
159+
col: lineCol.col
159160
};
160161

161162
var request = this.processRequest<ServerProtocol.QuickInfoRequest>(CommandNames.Quickinfo, args);
@@ -168,10 +169,8 @@ module ts.server {
168169
kind: response.body.kind,
169170
kindModifiers: response.body.kindModifiers,
170171
textSpan: ts.createTextSpanFromBounds(start, end),
171-
displayParts: undefined,
172-
documentation: undefined,
173-
documentationString: response.body.documentation,
174-
displayString: response.body.displayString
172+
displayParts: [{ kind: "text", text: response.body.displayString }],
173+
documentation: [{ kind: "text", text: response.body.documentation }]
175174
};
176175
}
177176

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
////interface One {
4+
//// commonProperty: number;
5+
//// commonFunction(): number;
6+
////}
7+
////
8+
////interface Two {
9+
//// commonProperty: string
10+
//// commonFunction(): number;
11+
////}
12+
////
13+
////var /*1*/x : One | Two;
14+
////
15+
////x./*2*/commonProperty;
16+
////x./*3*/commonFunction;
17+
18+
19+
goTo.marker("1");
20+
verify.quickInfoIs('(var) x: One | Two');
21+
22+
23+
goTo.marker("2");
24+
verify.quickInfoIs('(property) commonProperty: string | number');
25+
26+
goTo.marker("3");
27+
verify.quickInfoIs('(method) commonFunction(): number');

0 commit comments

Comments
 (0)