Skip to content

Commit 277e318

Browse files
Andymhegazy
Andy
authored andcommitted
Make getCompletionEntryDetails and getCompletionEntrySymbol parameters non-optional (microsoft#19507)
* Make getCompletionEntryDetails and getCompletionEntrySymbol parameters non-optional * Increment servicesVersion * Update api baselines
1 parent 6c71ca8 commit 277e318

File tree

6 files changed

+20
-14
lines changed

6 files changed

+20
-14
lines changed

src/harness/harnessLanguageService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ namespace Harness.LanguageService {
416416
getCompletionsAtPosition(fileName: string, position: number): ts.CompletionInfo {
417417
return unwrapJSONCallResult(this.shim.getCompletionsAtPosition(fileName, position));
418418
}
419-
getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: ts.FormatCodeOptions): ts.CompletionEntryDetails {
420-
return unwrapJSONCallResult(this.shim.getCompletionEntryDetails(fileName, position, entryName, JSON.stringify(options)));
419+
getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: ts.FormatCodeOptions | undefined, source: string | undefined): ts.CompletionEntryDetails {
420+
return unwrapJSONCallResult(this.shim.getCompletionEntryDetails(fileName, position, entryName, JSON.stringify(options), source));
421421
}
422422
getCompletionEntrySymbol(): ts.Symbol {
423423
throw new Error("getCompletionEntrySymbol not implemented across the shim layer.");

src/services/services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
namespace ts {
3333
/** The version of the language service API */
34-
export const servicesVersion = "0.5";
34+
export const servicesVersion = "0.6";
3535

3636
/* @internal */
3737
let ruleProvider: formatting.RulesProvider;

src/services/shims.ts

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

143143
getCompletionsAtPosition(fileName: string, position: number): string;
144-
getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/): string;
144+
getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/, source: string | undefined): string;
145145

146146
getQuickInfoAtPosition(fileName: string, position: number): string;
147147

@@ -893,12 +893,12 @@ namespace ts {
893893
}
894894

895895
/** Get a string based representation of a completion list entry details */
896-
public getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/) {
896+
public getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: string/*Services.FormatCodeOptions*/, source: string | undefined) {
897897
return this.forwardJSONCall(
898898
`getCompletionEntryDetails('${fileName}', ${position}, '${entryName}')`,
899899
() => {
900900
const localOptions: ts.FormatCodeOptions = JSON.parse(options);
901-
return this.languageService.getCompletionEntryDetails(fileName, position, entryName, localOptions);
901+
return this.languageService.getCompletionEntryDetails(fileName, position, entryName, localOptions, source);
902902
}
903903
);
904904
}

src/services/types.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,14 @@ namespace ts {
238238

239239
getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
240240
// "options" and "source" are optional only for backwards-compatibility
241-
getCompletionEntryDetails(fileName: string, position: number, name: string, options?: FormatCodeOptions | FormatCodeSettings, source?: string): CompletionEntryDetails;
242-
getCompletionEntrySymbol(fileName: string, position: number, name: string, source?: string): Symbol;
241+
getCompletionEntryDetails(
242+
fileName: string,
243+
position: number,
244+
name: string,
245+
options: FormatCodeOptions | FormatCodeSettings | undefined,
246+
source: string | undefined,
247+
): CompletionEntryDetails;
248+
getCompletionEntrySymbol(fileName: string, position: number, name: string, source: string | undefined): Symbol;
243249

244250
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
245251

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3916,8 +3916,8 @@ declare namespace ts {
39163916
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
39173917
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
39183918
getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
3919-
getCompletionEntryDetails(fileName: string, position: number, name: string, options?: FormatCodeOptions | FormatCodeSettings, source?: string): CompletionEntryDetails;
3920-
getCompletionEntrySymbol(fileName: string, position: number, name: string, source?: string): Symbol;
3919+
getCompletionEntryDetails(fileName: string, position: number, name: string, options: FormatCodeOptions | FormatCodeSettings | undefined, source: string | undefined): CompletionEntryDetails;
3920+
getCompletionEntrySymbol(fileName: string, position: number, name: string, source: string | undefined): Symbol;
39213921
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
39223922
getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan;
39233923
getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan;
@@ -4599,7 +4599,7 @@ declare namespace ts {
45994599
}
46004600
declare namespace ts {
46014601
/** The version of the language service API */
4602-
const servicesVersion = "0.5";
4602+
const servicesVersion = "0.6";
46034603
interface DisplayPartsSymbolWriter extends SymbolWriter {
46044604
displayParts(): SymbolDisplayPart[];
46054605
}

tests/baselines/reference/api/typescript.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3916,8 +3916,8 @@ declare namespace ts {
39163916
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
39173917
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
39183918
getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
3919-
getCompletionEntryDetails(fileName: string, position: number, name: string, options?: FormatCodeOptions | FormatCodeSettings, source?: string): CompletionEntryDetails;
3920-
getCompletionEntrySymbol(fileName: string, position: number, name: string, source?: string): Symbol;
3919+
getCompletionEntryDetails(fileName: string, position: number, name: string, options: FormatCodeOptions | FormatCodeSettings | undefined, source: string | undefined): CompletionEntryDetails;
3920+
getCompletionEntrySymbol(fileName: string, position: number, name: string, source: string | undefined): Symbol;
39213921
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
39223922
getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan;
39233923
getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan;
@@ -4599,7 +4599,7 @@ declare namespace ts {
45994599
}
46004600
declare namespace ts {
46014601
/** The version of the language service API */
4602-
const servicesVersion = "0.5";
4602+
const servicesVersion = "0.6";
46034603
interface DisplayPartsSymbolWriter extends SymbolWriter {
46044604
displayParts(): SymbolDisplayPart[];
46054605
}

0 commit comments

Comments
 (0)