Skip to content

Commit

Permalink
LanguageServiceShim.getCompletionEntryDetails: Support undefined opti…
Browse files Browse the repository at this point in the history
…ons (microsoft#20810)

* LanguageServiceShim.getCompletionEntryDetails: Support undefined options

* Fix lint
  • Loading branch information
Andy authored Dec 20, 2017
1 parent 8173733 commit a92a594
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/services/shims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ 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;
// 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;

Expand Down Expand Up @@ -906,11 +907,12 @@ 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) {
// 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}')`,
() => {
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);
}
);
Expand Down

0 comments on commit a92a594

Please sign in to comment.