From e86519b29457287fcedf6d458a0ac637a857ae5e Mon Sep 17 00:00:00 2001 From: andy-ms Date: Tue, 19 Dec 2017 15:56:16 -0800 Subject: [PATCH 1/2] LanguageServiceShim.getCompletionEntryDetails: Support undefined options --- src/services/shims.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/shims.ts b/src/services/shims.ts index 8000a046831b7..fda698785b35e 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -141,7 +141,7 @@ namespace ts { getEncodedSemanticClassifications(fileName: string, start: number, length: number): string; getCompletionsAtPosition(fileName: string, position: number, options: GetCompletionsAtPositionOptions | undefined): string; - getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/, source: string | undefined): string; + getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/ | undefined, source: string | undefined): string; getQuickInfoAtPosition(fileName: string, position: number): string; @@ -906,11 +906,11 @@ namespace ts { } /** Get a string based representation of a completion list entry details */ - public getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/, source: string | undefined) { + public getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/ | undefined, source: string | undefined) { return this.forwardJSONCall( `getCompletionEntryDetails('${fileName}', ${position}, '${entryName}')`, () => { - const localOptions: ts.FormatCodeOptions = JSON.parse(options); + const localOptions: ts.FormatCodeOptions = options === undefined ? undefined : JSON.parse(options); return this.languageService.getCompletionEntryDetails(fileName, position, entryName, localOptions, source); } ); From bee0ee7e10dc790076e1fd4270f74920c31e3067 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 07:04:28 -0800 Subject: [PATCH 2/2] Fix lint --- src/services/shims.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/services/shims.ts b/src/services/shims.ts index fda698785b35e..34a8bbb10d9a7 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -141,6 +141,7 @@ namespace ts { getEncodedSemanticClassifications(fileName: string, start: number, length: number): string; getCompletionsAtPosition(fileName: string, position: number, options: GetCompletionsAtPositionOptions | undefined): string; + // tslint:disable-next-line type-operator-spacing (false positive) getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/ | undefined, source: string | undefined): string; getQuickInfoAtPosition(fileName: string, position: number): string; @@ -906,6 +907,7 @@ namespace ts { } /** Get a string based representation of a completion list entry details */ + // tslint:disable-next-line type-operator-spacing (false positive) public getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/ | undefined, source: string | undefined) { return this.forwardJSONCall( `getCompletionEntryDetails('${fileName}', ${position}, '${entryName}')`,