diff --git a/extensions/typescript-language-features/src/languageFeatures/quickFix.ts b/extensions/typescript-language-features/src/languageFeatures/quickFix.ts index 0d87cb86eac..b83af8d2526 100644 --- a/extensions/typescript-language-features/src/languageFeatures/quickFix.ts +++ b/extensions/typescript-language-features/src/languageFeatures/quickFix.ts @@ -45,12 +45,33 @@ class ApplyCodeActionCommand implements Command { ] } */ + console.log('resource : ', resource); + console.log('action : ', action); + console.log('diagnostic : ', diagnostic); + this.telemetryReporter.logTelemetry('quickFix.execute', { fixName: action.fixName }); this.diagnosticManager.deleteDiagnostic(resource, diagnostic); - return applyCodeActionCommands(this.client, action.commands, nulToken); + // TODO: point of interest + const codeActionResult = await applyCodeActionCommands(this.client, action.commands, nulToken); + + // TODO: how to find the end line number of the class? + // const startLine = diagnostic.range.start.line; + // Find end line using the outline + // vscode.window.activeTextEditor?.document + + const numberLines = vscode.window.activeTextEditor?.document.lineCount; + + // once done, need to call the interactive editor, when working with the implentation interface case + if (action.fixName === 'fixClassIncorrectlyImplementsInterface') { + console.log('case when class incorrectly implements interface'); + await vscode.commands.executeCommand('interactiveEditor.start', { initialRange: { startLineNumber: 0, endLineNumber: numberLines, startColumn: 0, endColumn: 0 }, message: 'Implement the class from the interface', autoSend: true }); + } + // + + return codeActionResult; } } @@ -230,6 +251,9 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider { + + console.log('inside of provideCodeActions'); + const file = this.client.toOpenTsFilePath(document); if (!file) { return; @@ -265,6 +289,9 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider { + + console.log('inside of resolveCodeAction'); + if (!(codeAction instanceof VsCodeFixAllCodeAction) || !codeAction.tsAction.fixId) { return codeAction; } @@ -293,10 +320,14 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider { + + console.log('inside of getFixesForDiagnostic'); + const args: Proto.CodeFixRequestArgs = { ...typeConverters.Range.toFileRangeRequestArgs(file, diagnostic.range), errorCodes: [+(diagnostic.code!)] }; + // TODO: point of interest const response = await this.client.execute('getCodeFixes', args, token); if (response.type !== 'response' || !response.body) { return results; @@ -315,6 +346,9 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider | undefined, diff --git a/src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorActions.ts b/src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorActions.ts index 4946a918df2..df5da0c7728 100644 --- a/src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorActions.ts +++ b/src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorActions.ts @@ -56,6 +56,8 @@ export class StartSessionAction extends EditorAction2 { } override runEditorCommand(_accessor: ServicesAccessor, editor: ICodeEditor, ..._args: any[]) { + console.log('inside of the case when running the interactive editor start command'); + let options: InteractiveEditorRunOptions | undefined; const arg = _args[0]; if (arg && this._isInteractivEditorOptions(arg)) {