From b567701a44ad0847ee8e8d70cb6dcf54aad863bc Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 26 Oct 2017 14:01:04 -0700 Subject: [PATCH 1/3] Make getCompletionEntryDetails and getCompletionEntrySymbol parameters non-optional --- src/harness/harnessLanguageService.ts | 4 ++-- src/services/shims.ts | 6 +++--- src/services/types.ts | 10 ++++++++-- tests/baselines/reference/api/tsserverlibrary.d.ts | 4 ++-- tests/baselines/reference/api/typescript.d.ts | 4 ++-- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 64ef1b552f5fa..87827d0c14ae4 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -416,8 +416,8 @@ namespace Harness.LanguageService { getCompletionsAtPosition(fileName: string, position: number): ts.CompletionInfo { return unwrapJSONCallResult(this.shim.getCompletionsAtPosition(fileName, position)); } - getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: ts.FormatCodeOptions): ts.CompletionEntryDetails { - return unwrapJSONCallResult(this.shim.getCompletionEntryDetails(fileName, position, entryName, JSON.stringify(options))); + getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: ts.FormatCodeOptions | undefined, source: string | undefined): ts.CompletionEntryDetails { + return unwrapJSONCallResult(this.shim.getCompletionEntryDetails(fileName, position, entryName, JSON.stringify(options), source)); } getCompletionEntrySymbol(): ts.Symbol { throw new Error("getCompletionEntrySymbol not implemented across the shim layer."); diff --git a/src/services/shims.ts b/src/services/shims.ts index 6e979e22023fc..3e0a1e75f4183 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): string; - getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/): string; + getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/, source: string | undefined): string; getQuickInfoAtPosition(fileName: string, position: number): string; @@ -893,12 +893,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*/) { + public getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/, source: string | undefined) { return this.forwardJSONCall( `getCompletionEntryDetails('${fileName}', ${position}, '${entryName}')`, () => { const localOptions: ts.FormatCodeOptions = JSON.parse(options); - return this.languageService.getCompletionEntryDetails(fileName, position, entryName, localOptions); + return this.languageService.getCompletionEntryDetails(fileName, position, entryName, localOptions, source); } ); } diff --git a/src/services/types.ts b/src/services/types.ts index c854eb8aaccfc..3bb65b808fd65 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -238,8 +238,14 @@ namespace ts { getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; // "options" and "source" are optional only for backwards-compatibility - getCompletionEntryDetails(fileName: string, position: number, name: string, options?: FormatCodeOptions | FormatCodeSettings, source?: string): CompletionEntryDetails; - getCompletionEntrySymbol(fileName: string, position: number, name: string, source?: string): Symbol; + getCompletionEntryDetails( + fileName: string, + position: number, + name: string, + options: FormatCodeOptions | FormatCodeSettings | undefined, + source: string | undefined, + ): CompletionEntryDetails; + getCompletionEntrySymbol(fileName: string, position: number, name: string, source: string | undefined): Symbol; getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 5d439e840b09f..1ef983e353ba4 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3915,8 +3915,8 @@ declare namespace ts { getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications; getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; - getCompletionEntryDetails(fileName: string, position: number, name: string, options?: FormatCodeOptions | FormatCodeSettings, source?: string): CompletionEntryDetails; - getCompletionEntrySymbol(fileName: string, position: number, name: string, source?: string): Symbol; + getCompletionEntryDetails(fileName: string, position: number, name: string, options: FormatCodeOptions | FormatCodeSettings | undefined, source: string | undefined): CompletionEntryDetails; + getCompletionEntrySymbol(fileName: string, position: number, name: string, source: string | undefined): Symbol; getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 2afef7d692cd9..a82fc00d9d20f 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3915,8 +3915,8 @@ declare namespace ts { getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications; getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; - getCompletionEntryDetails(fileName: string, position: number, name: string, options?: FormatCodeOptions | FormatCodeSettings, source?: string): CompletionEntryDetails; - getCompletionEntrySymbol(fileName: string, position: number, name: string, source?: string): Symbol; + getCompletionEntryDetails(fileName: string, position: number, name: string, options: FormatCodeOptions | FormatCodeSettings | undefined, source: string | undefined): CompletionEntryDetails; + getCompletionEntrySymbol(fileName: string, position: number, name: string, source: string | undefined): Symbol; getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; From 4f5fae1579687ac8cd3b740c1e0579884c04cbc4 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 30 Oct 2017 12:48:29 -0700 Subject: [PATCH 2/3] Increment servicesVersion --- src/services/services.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/services.ts b/src/services/services.ts index d6e75868852ae..100e90529e892 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -31,7 +31,7 @@ namespace ts { /** The version of the language service API */ - export const servicesVersion = "0.5"; + export const servicesVersion = "0.6"; /* @internal */ let ruleProvider: formatting.RulesProvider; From 70c155705ae64e6a388179b893b9fdb085d2c3ac Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 30 Oct 2017 13:47:54 -0700 Subject: [PATCH 3/3] Update api baselines --- tests/baselines/reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 1ef983e353ba4..d0d4eafb47c61 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4598,7 +4598,7 @@ declare namespace ts { } declare namespace ts { /** The version of the language service API */ - const servicesVersion = "0.5"; + const servicesVersion = "0.6"; interface DisplayPartsSymbolWriter extends SymbolWriter { displayParts(): SymbolDisplayPart[]; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index a82fc00d9d20f..1529e31f9793a 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4598,7 +4598,7 @@ declare namespace ts { } declare namespace ts { /** The version of the language service API */ - const servicesVersion = "0.5"; + const servicesVersion = "0.6"; interface DisplayPartsSymbolWriter extends SymbolWriter { displayParts(): SymbolDisplayPart[]; }