From 4d592eea8b43c092ebfa05926c9c13602e9dcc5e Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 6 Mar 2018 07:46:49 -0800 Subject: [PATCH] More review --- src/harness/fourslash.ts | 16 ++++++++-------- src/harness/unittests/extractTestHelpers.ts | 2 ++ src/harness/unittests/organizeImports.ts | 4 ++-- src/server/protocol.ts | 6 +++--- src/server/session.ts | 16 ++++++++-------- src/services/organizeImports.ts | 4 +++- src/services/refactorProvider.ts | 1 + src/services/services.ts | 17 ++++++++++------- src/services/types.ts | 10 +++++----- .../reference/api/tsserverlibrary.d.ts | 18 +++++++++--------- tests/baselines/reference/api/typescript.d.ts | 10 +++++----- 11 files changed, 56 insertions(+), 48 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index cd8132760ceb9..7966750c8e9b3 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2924,7 +2924,7 @@ Actual: ${stringify(fullActual)}`); public verifyApplicableRefactorAvailableAtMarker(negative: boolean, markerName: string) { const marker = this.getMarkerByName(markerName); - const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, marker.position); + const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, marker.position, ts.defaultOptions); const isAvailable = applicableRefactors && applicableRefactors.length > 0; if (negative && isAvailable) { this.raiseError(`verifyApplicableRefactorAvailableAtMarker failed - expected no refactor at marker ${markerName} but found some.`); @@ -2944,7 +2944,7 @@ Actual: ${stringify(fullActual)}`); public verifyRefactorAvailable(negative: boolean, name: string, actionName?: string) { const selection = this.getSelection(); - let refactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, selection) || []; + let refactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, selection, ts.defaultOptions) || []; refactors = refactors.filter(r => r.name === name && (actionName === undefined || r.actions.some(a => a.name === actionName))); const isAvailable = refactors.length > 0; @@ -2966,7 +2966,7 @@ Actual: ${stringify(fullActual)}`); public verifyRefactor({ name, actionName, refactors }: FourSlashInterface.VerifyRefactorOptions) { const selection = this.getSelection(); - const actualRefactors = (this.languageService.getApplicableRefactors(this.activeFile.fileName, selection) || ts.emptyArray) + const actualRefactors = (this.languageService.getApplicableRefactors(this.activeFile.fileName, selection, ts.defaultOptions) || ts.emptyArray) .filter(r => r.name === name && r.actions.some(a => a.name === actionName)); this.assertObjectsEqual(actualRefactors, refactors); } @@ -2977,7 +2977,7 @@ Actual: ${stringify(fullActual)}`); throw new Error("Exactly one refactor range is allowed per test."); } - const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, { pos: ranges[0].pos, end: ranges[0].end }); + const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, ts.first(ranges), ts.defaultOptions); const isAvailable = applicableRefactors && applicableRefactors.length > 0; if (negative && isAvailable) { this.raiseError(`verifyApplicableRefactorAvailableForRange failed - expected no refactor but found some.`); @@ -2989,7 +2989,7 @@ Actual: ${stringify(fullActual)}`); public applyRefactor({ refactorName, actionName, actionDescription, newContent: newContentWithRenameMarker }: FourSlashInterface.ApplyRefactorOptions) { const range = this.getSelection(); - const refactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, range); + const refactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, range, ts.defaultOptions); const refactorsWithName = refactors.filter(r => r.name === refactorName); if (refactorsWithName.length === 0) { this.raiseError(`The expected refactor: ${refactorName} is not available at the marker location.\nAvailable refactors: ${refactors.map(r => r.name)}`); @@ -3003,7 +3003,7 @@ Actual: ${stringify(fullActual)}`); this.raiseError(`Expected action description to be ${JSON.stringify(actionDescription)}, got: ${JSON.stringify(action.description)}`); } - const editInfo = this.languageService.getEditsForRefactor(this.activeFile.fileName, this.formatCodeSettings, range, refactorName, actionName); + const editInfo = this.languageService.getEditsForRefactor(this.activeFile.fileName, this.formatCodeSettings, range, refactorName, actionName, ts.defaultOptions); for (const edit of editInfo.edits) { this.applyEdits(edit.fileName, edit.textChanges, /*isFormattingEdit*/ false); } @@ -3048,14 +3048,14 @@ Actual: ${stringify(fullActual)}`); formattingOptions = formattingOptions || this.formatCodeSettings; const markerPos = this.getMarkerByName(markerName).position; - const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, markerPos); + const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, markerPos, ts.defaultOptions); const applicableRefactorToApply = ts.find(applicableRefactors, refactor => refactor.name === refactorNameToApply); if (!applicableRefactorToApply) { this.raiseError(`The expected refactor: ${refactorNameToApply} is not available at the marker location.`); } - const editInfo = this.languageService.getEditsForRefactor(this.activeFile.fileName, formattingOptions, markerPos, refactorNameToApply, actionName); + const editInfo = this.languageService.getEditsForRefactor(this.activeFile.fileName, formattingOptions, markerPos, refactorNameToApply, actionName, ts.defaultOptions); for (const edit of editInfo.edits) { this.applyEdits(edit.fileName, edit.textChanges, /*isFormattingEdit*/ false); diff --git a/src/harness/unittests/extractTestHelpers.ts b/src/harness/unittests/extractTestHelpers.ts index 8970990326c15..dc9a65b92ecbf 100644 --- a/src/harness/unittests/extractTestHelpers.ts +++ b/src/harness/unittests/extractTestHelpers.ts @@ -127,6 +127,7 @@ namespace ts { endPosition: selectionRange.end, host: notImplementedHost, formatContext: formatting.getFormatContext(testFormatOptions), + options: defaultOptions, }; const rangeToExtract = refactor.extractSymbol.getRangeToExtract(sourceFile, createTextSpanFromRange(selectionRange)); assert.equal(rangeToExtract.errors, undefined, rangeToExtract.errors && "Range error: " + rangeToExtract.errors[0].messageText); @@ -190,6 +191,7 @@ namespace ts { endPosition: selectionRange.end, host: notImplementedHost, formatContext: formatting.getFormatContext(testFormatOptions), + options: defaultOptions, }; const rangeToExtract = refactor.extractSymbol.getRangeToExtract(sourceFile, createTextSpanFromRange(selectionRange)); assert.isUndefined(rangeToExtract.errors, rangeToExtract.errors && "Range error: " + rangeToExtract.errors[0].messageText); diff --git a/src/harness/unittests/organizeImports.ts b/src/harness/unittests/organizeImports.ts index bb5c9cbee1867..b11f35be7683f 100644 --- a/src/harness/unittests/organizeImports.ts +++ b/src/harness/unittests/organizeImports.ts @@ -193,7 +193,7 @@ export const Other = 1; content: "function F() { }", }; const languageService = makeLanguageService(testFile); - const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, testFormatOptions); + const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, testFormatOptions, defaultOptions); assert.isEmpty(changes); }); @@ -403,7 +403,7 @@ import { React, Other } from "react"; function runBaseline(baselinePath: string, testFile: TestFSWithWatch.FileOrFolder, ...otherFiles: TestFSWithWatch.FileOrFolder[]) { const { path: testPath, content: testContent } = testFile; const languageService = makeLanguageService(testFile, ...otherFiles); - const changes = languageService.organizeImports({ type: "file", fileName: testPath }, testFormatOptions); + const changes = languageService.organizeImports({ type: "file", fileName: testPath }, testFormatOptions, defaultOptions); assert.equal(changes.length, 1); assert.equal(changes[0].fileName, testPath); diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 58aa25ed56daa..ceeaef3b9961e 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -2589,17 +2589,17 @@ namespace ts.server.protocol { } export interface Options { - quote: "double" | "single"; + quote?: "double" | "single"; /** * If enabled, TypeScript will search through all external modules' exports and add them to the completions list. * This affects lone identifier completions but not completions on the right hand side of `obj.`. */ - includeExternalModuleExports: boolean; + includeExternalModuleExports?: boolean; /** * If enabled, the completion list will include completions with invalid identifier names. * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`. */ - includeInsertTextCompletions: boolean; + includeInsertTextCompletions?: boolean; } export interface CompilerOptions { diff --git a/src/server/session.ts b/src/server/session.ts index 0b20f829f125d..cd51c7e2aaba1 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1239,7 +1239,7 @@ namespace ts.server { const position = this.getPosition(args, scriptInfo); const completions = project.getLanguageService().getCompletionsAtPosition(file, position, { - ...this.getServicesOptions(file), + ...this.getOptions(file), includeExternalModuleExports: args.includeExternalModuleExports, includeInsertTextCompletions: args.includeInsertTextCompletions }); @@ -1564,7 +1564,7 @@ namespace ts.server { const { file, project } = this.getFileAndProject(args); const scriptInfo = project.getScriptInfoForNormalizedPath(file); const { position, textRange } = this.extractPositionAndRange(args, scriptInfo); - return project.getLanguageService().getApplicableRefactors(file, position || textRange); + return project.getLanguageService().getApplicableRefactors(file, position || textRange, this.getOptions(file)); } private getEditsForRefactor(args: protocol.GetEditsForRefactorRequestArgs, simplifiedResult: boolean): RefactorEditInfo | protocol.RefactorEditInfo { @@ -1577,7 +1577,8 @@ namespace ts.server { this.getFormatOptions(file), position || textRange, args.refactor, - args.action + args.action, + this.getOptions(file), ); if (result === undefined) { @@ -1603,8 +1604,7 @@ namespace ts.server { private organizeImports({ scope }: protocol.OrganizeImportsRequestArgs, simplifiedResult: boolean): ReadonlyArray | ReadonlyArray { Debug.assert(scope.type === "file"); const { file, project } = this.getFileAndProject(scope.args); - const formatOptions = this.getFormatOptions(file); - const changes = project.getLanguageService().organizeImports({ type: "file", fileName: file }, formatOptions); + const changes = project.getLanguageService().organizeImports({ type: "file", fileName: file }, this.getFormatOptions(file), this.getOptions(file)); if (simplifiedResult) { return this.mapTextChangesToCodeEdits(project, changes); } @@ -1622,7 +1622,7 @@ namespace ts.server { const scriptInfo = project.getScriptInfoForNormalizedPath(file); const { startPosition, endPosition } = this.getStartAndEndPosition(args, scriptInfo); - const codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes, this.getFormatOptions(file), this.getServicesOptions(file)); + const codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes, this.getFormatOptions(file), this.getOptions(file)); if (!codeActions) { return undefined; } @@ -1637,7 +1637,7 @@ namespace ts.server { private getCombinedCodeFix({ scope, fixId }: protocol.GetCombinedCodeFixRequestArgs, simplifiedResult: boolean): protocol.CombinedCodeActions | CombinedCodeActions { Debug.assert(scope.type === "file"); const { file, project } = this.getFileAndProject(scope.args); - const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId, this.getFormatOptions(file), this.getServicesOptions(file)); + const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId, this.getFormatOptions(file), this.getOptions(file)); if (simplifiedResult) { return { changes: this.mapTextChangesToCodeEdits(project, res.changes), commands: res.commands }; } @@ -2157,7 +2157,7 @@ namespace ts.server { return this.projectService.getFormatCodeOptions(file); } - private getServicesOptions(file: NormalizedPath): Options { + private getOptions(file: NormalizedPath): Options { return this.projectService.getOptions(file); } } diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index 511fa821fd231..eb6fe5174fd9b 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -11,7 +11,9 @@ namespace ts.OrganizeImports { sourceFile: SourceFile, formatContext: formatting.FormatContext, host: LanguageServiceHost, - program: Program) { + program: Program, + _options: Options, + ) { const changeTracker = textChanges.ChangeTracker.fromContext({ host, formatContext }); diff --git a/src/services/refactorProvider.ts b/src/services/refactorProvider.ts index 3d5957c694c99..10cba3c3174d2 100644 --- a/src/services/refactorProvider.ts +++ b/src/services/refactorProvider.ts @@ -14,6 +14,7 @@ namespace ts { endPosition?: number; program: Program; cancellationToken?: CancellationToken; + options: Options; } export namespace refactor { diff --git a/src/services/services.ts b/src/services/services.ts index 15dc5aedd4976..c5a197059a6f4 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1835,13 +1835,13 @@ namespace ts { return codefix.getAllFixes({ fixId, sourceFile, program, host, cancellationToken, formatContext, options }); } - function organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings): ReadonlyArray { + function organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, options: Options): ReadonlyArray { synchronizeHostData(); Debug.assert(scope.type === "file"); const sourceFile = getValidSourceFile(scope.fileName); const formatContext = formatting.getFormatContext(formatOptions); - return OrganizeImports.organizeImports(sourceFile, formatContext, host, program); + return OrganizeImports.organizeImports(sourceFile, formatContext, host, program, options); } function applyCodeActionCommand(action: CodeActionCommand): Promise; @@ -2065,7 +2065,7 @@ namespace ts { return Rename.getRenameInfo(program.getTypeChecker(), defaultLibFileName, getCanonicalFileName, getValidSourceFile(fileName), position); } - function getRefactorContext(file: SourceFile, positionOrRange: number | TextRange, formatOptions?: FormatCodeSettings): RefactorContext { + function getRefactorContext(file: SourceFile, positionOrRange: number | TextRange, options: Options, formatOptions?: FormatCodeSettings): RefactorContext { const [startPosition, endPosition] = typeof positionOrRange === "number" ? [positionOrRange, undefined] : [positionOrRange.pos, positionOrRange.end]; return { file, @@ -2075,13 +2075,14 @@ namespace ts { host, formatContext: formatting.getFormatContext(formatOptions), cancellationToken, + options, }; } - function getApplicableRefactors(fileName: string, positionOrRange: number | TextRange): ApplicableRefactorInfo[] { + function getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, options: Options): ApplicableRefactorInfo[] { synchronizeHostData(); const file = getValidSourceFile(fileName); - return refactor.getApplicableRefactors(getRefactorContext(file, positionOrRange)); + return refactor.getApplicableRefactors(getRefactorContext(file, positionOrRange, options)); } function getEditsForRefactor( @@ -2089,11 +2090,13 @@ namespace ts { formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, - actionName: string): RefactorEditInfo { + actionName: string, + options: Options, + ): RefactorEditInfo { synchronizeHostData(); const file = getValidSourceFile(fileName); - return refactor.getEditsForRefactor(getRefactorContext(file, positionOrRange, formatOptions), refactorName, actionName); + return refactor.getEditsForRefactor(getRefactorContext(file, positionOrRange, options, formatOptions), refactorName, actionName); } return { diff --git a/src/services/types.ts b/src/services/types.ts index 76f5a38e26792..58255b1c40e43 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -303,8 +303,8 @@ namespace ts { getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan; - getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: ReadonlyArray, formatOptions: FormatCodeSettings, servicesOptions: Options): ReadonlyArray; - getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, servicesOptions: Options): CombinedCodeActions; + getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: ReadonlyArray, formatOptions: FormatCodeSettings, options: Options): ReadonlyArray; + getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, options: Options): CombinedCodeActions; applyCodeActionCommand(action: CodeActionCommand): Promise; applyCodeActionCommand(action: CodeActionCommand[]): Promise; applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[]): Promise; @@ -314,9 +314,9 @@ namespace ts { applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise; /** @deprecated `fileName` will be ignored */ applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise; - getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange): ApplicableRefactorInfo[]; - getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string): RefactorEditInfo | undefined; - organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings): ReadonlyArray; + getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange, options: Options): ApplicableRefactorInfo[]; + getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, options: Options): RefactorEditInfo | undefined; + organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, options: Options): ReadonlyArray; getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 58913a0d1507a..a90d83b44f73a 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4101,8 +4101,8 @@ declare namespace ts { getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan; - getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: ReadonlyArray, formatOptions: FormatCodeSettings, servicesOptions: Options): ReadonlyArray; - getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, servicesOptions: Options): CombinedCodeActions; + getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: ReadonlyArray, formatOptions: FormatCodeSettings, options: Options): ReadonlyArray; + getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, options: Options): CombinedCodeActions; applyCodeActionCommand(action: CodeActionCommand): Promise; applyCodeActionCommand(action: CodeActionCommand[]): Promise; applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[]): Promise; @@ -4112,9 +4112,9 @@ declare namespace ts { applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise; /** @deprecated `fileName` will be ignored */ applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise; - getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange): ApplicableRefactorInfo[]; - getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string): RefactorEditInfo | undefined; - organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings): ReadonlyArray; + getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange, options: Options): ApplicableRefactorInfo[]; + getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, options: Options): RefactorEditInfo | undefined; + organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, options: Options): ReadonlyArray; getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; getProgram(): Program; dispose(): void; @@ -7044,17 +7044,17 @@ declare namespace ts.server.protocol { insertSpaceBeforeTypeAnnotation?: boolean; } interface Options { - quote: "double" | "single"; + quote?: "double" | "single"; /** * If enabled, TypeScript will search through all external modules' exports and add them to the completions list. * This affects lone identifier completions but not completions on the right hand side of `obj.`. */ - includeExternalModuleExports: boolean; + includeExternalModuleExports?: boolean; /** * If enabled, the completion list will include completions with invalid identifier names. * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`. */ - includeInsertTextCompletions: boolean; + includeInsertTextCompletions?: boolean; } interface CompilerOptions { allowJs?: boolean; @@ -7319,7 +7319,7 @@ declare namespace ts.server { executeCommand(request: protocol.Request): HandlerResponse; onMessage(message: string): void; private getFormatOptions(file); - private getServicesOptions(file); + private getOptions(file); } interface HandlerResponse { response?: {}; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index ab24c6326ec2b..51cc267a195bb 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4353,8 +4353,8 @@ declare namespace ts { getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan; - getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: ReadonlyArray, formatOptions: FormatCodeSettings, servicesOptions: Options): ReadonlyArray; - getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, servicesOptions: Options): CombinedCodeActions; + getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: ReadonlyArray, formatOptions: FormatCodeSettings, options: Options): ReadonlyArray; + getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, options: Options): CombinedCodeActions; applyCodeActionCommand(action: CodeActionCommand): Promise; applyCodeActionCommand(action: CodeActionCommand[]): Promise; applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[]): Promise; @@ -4364,9 +4364,9 @@ declare namespace ts { applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise; /** @deprecated `fileName` will be ignored */ applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise; - getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange): ApplicableRefactorInfo[]; - getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string): RefactorEditInfo | undefined; - organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings): ReadonlyArray; + getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange, options: Options): ApplicableRefactorInfo[]; + getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, options: Options): RefactorEditInfo | undefined; + organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, options: Options): ReadonlyArray; getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; getProgram(): Program; dispose(): void;