Skip to content

Commit a92a594

Browse files
author
Andy
authored
LanguageServiceShim.getCompletionEntryDetails: Support undefined options (microsoft#20810)
* LanguageServiceShim.getCompletionEntryDetails: Support undefined options * Fix lint
1 parent 8173733 commit a92a594

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/services/shims.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ namespace ts {
141141
getEncodedSemanticClassifications(fileName: string, start: number, length: number): string;
142142

143143
getCompletionsAtPosition(fileName: string, position: number, options: GetCompletionsAtPositionOptions | undefined): string;
144-
getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/, source: string | undefined): string;
144+
// tslint:disable-next-line type-operator-spacing (false positive)
145+
getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/ | undefined, source: string | undefined): string;
145146

146147
getQuickInfoAtPosition(fileName: string, position: number): string;
147148

@@ -906,11 +907,12 @@ namespace ts {
906907
}
907908

908909
/** Get a string based representation of a completion list entry details */
909-
public getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/, source: string | undefined) {
910+
// tslint:disable-next-line type-operator-spacing (false positive)
911+
public getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/ | undefined, source: string | undefined) {
910912
return this.forwardJSONCall(
911913
`getCompletionEntryDetails('${fileName}', ${position}, '${entryName}')`,
912914
() => {
913-
const localOptions: ts.FormatCodeOptions = JSON.parse(options);
915+
const localOptions: ts.FormatCodeOptions = options === undefined ? undefined : JSON.parse(options);
914916
return this.languageService.getCompletionEntryDetails(fileName, position, entryName, localOptions, source);
915917
}
916918
);

0 commit comments

Comments
 (0)