Skip to content

Commit 7fd22f8

Browse files
author
Josh Goldberg
committed
Have args extend scope so it is not a breaking change
1 parent 394eeb4 commit 7fd22f8

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/harness/fourslashImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ namespace FourSlash {
528528
}
529529

530530
public verifyOrganizeImports(newContent: string) {
531-
const changes = this.languageService.organizeImports({ scope: { fileName: this.activeFile.fileName, type: "file" } }, this.formatCodeSettings, ts.emptyOptions);
531+
const changes = this.languageService.organizeImports({ fileName: this.activeFile.fileName, type: "file" }, this.formatCodeSettings, ts.emptyOptions);
532532
this.applyChanges(changes);
533533
this.verifyFileContent(this.activeFile.fileName, newContent);
534534
}

src/server/session.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2171,7 +2171,8 @@ namespace ts.server {
21712171
const changes = project.getLanguageService().organizeImports(
21722172
{
21732173
allowDestructiveCodeActions: args.allowDestructiveCodeActions,
2174-
scope: { type: "file", fileName: file },
2174+
fileName: file,
2175+
type: "file",
21752176
},
21762177
this.getFormatOptions(file),
21772178
this.getPreferences(file)

src/services/services.ts

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

19761976
function organizeImports(args: OrganizeImportsArgs, formatOptions: FormatCodeSettings, preferences: UserPreferences = emptyOptions): readonly FileTextChanges[] {
19771977
synchronizeHostData();
1978-
Debug.assert(args.scope.type === "file");
1979-
const sourceFile = getValidSourceFile(args.scope.fileName);
1978+
Debug.assert(args.type === "file");
1979+
const sourceFile = getValidSourceFile(args.fileName);
19801980
const formatContext = formatting.getFormatContext(formatOptions, host);
19811981

19821982
return OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, args.allowDestructiveCodeActions);

src/services/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,8 @@ namespace ts {
548548

549549
export interface CombinedCodeFixScope { type: "file"; fileName: string; }
550550

551-
export interface OrganizeImportsArgs {
551+
export interface OrganizeImportsArgs extends CombinedCodeFixScope {
552552
allowDestructiveCodeActions?: boolean;
553-
scope: CombinedCodeFixScope;
554553
}
555554

556555
export type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#";

0 commit comments

Comments
 (0)