LanguageServiceShim.getCompletionEntryDetails: Support undefined options (#20810)

* LanguageServiceShim.getCompletionEntryDetails: Support undefined options

* Fix lint
This commit is contained in:
Andy
2017-12-20 07:39:11 -08:00
committed by GitHub
parent 8173733ead
commit a92a594ebe

View File

@@ -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;
@@ -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);
}
);