From 178e8f76e65f3c0971a1015753d0c6f11ea2e52f Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 14 Feb 2015 22:28:38 -0800 Subject: [PATCH] Add test for quickInfo --- src/server/client.ts | 11 +++++---- tests/cases/fourslash/server/quickinfo.ts | 27 +++++++++++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 tests/cases/fourslash/server/quickinfo.ts diff --git a/src/server/client.ts b/src/server/client.ts index 3295ec76193..599de2d8505 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -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(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 }] }; } diff --git a/tests/cases/fourslash/server/quickinfo.ts b/tests/cases/fourslash/server/quickinfo.ts new file mode 100644 index 00000000000..b5c7dc0a01c --- /dev/null +++ b/tests/cases/fourslash/server/quickinfo.ts @@ -0,0 +1,27 @@ +/// + +////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');