Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make getCompletionEntryDetails and getCompletionEntrySymbol parameters non-optional #19507

Merged
merged 3 commits into from
Oct 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/harness/harnessLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
2 changes: 1 addition & 1 deletion src/services/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/services/shims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
);
}
Expand Down
10 changes: 8 additions & 2 deletions src/services/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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[];
}
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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[];
}
Expand Down