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

Fix copilot quick fix #200162

Merged
merged 1 commit into from
Dec 6, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,12 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider<VsCodeCode
inferFromBody.diagnostics = [diagnostic];
inferFromBody.command = {
command: EditorChatFollowUp.ID,
arguments: [<EditorChatFollowUp_Args>{
arguments: [{
message: 'Add types to this code. Add separate interfaces when possible. Do not change the code except for adding types.',
expand: { kind: 'navtree-function', pos: diagnostic.range.start },
document,
action: { type: 'quickfix', quickfix: action }
}],
} satisfies EditorChatFollowUp_Args],
title: ''
};
actions.push(inferFromBody);
Expand Down Expand Up @@ -381,11 +381,12 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider<VsCodeCode
arguments: [codeAction.command, {
command: EditorChatFollowUp.ID,
title: '',
arguments: [<EditorChatFollowUp_Args>{
arguments: [{
message,
expand,
document
}],
document,
action: { type: 'quickfix', quickfix: action }
} satisfies EditorChatFollowUp_Args],
}],
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import * as fileSchemes from '../configuration/fileSchemes';
import { Schemes } from '../configuration/schemes';
import { TelemetryReporter } from '../logging/telemetry';
import { API } from '../tsServer/api';
import { CachedResponse } from '../tsServer/cachedResponse';
import type * as Proto from '../tsServer/protocol/protocol';
import * as PConst from '../tsServer/protocol/protocol.const';
import * as typeConverters from '../typeConverters';
import { ClientCapability, ITypeScriptServiceClient } from '../typescriptService';
import { coalesce } from '../utils/arrays';
import { nulToken } from '../utils/cancellation';
import FormattingOptionsManager from './fileConfigurationManager';
import { CompositeCommand, EditorChatFollowUp, EditorChatFollowUp_Args } from './util/copilot';
import { conditionalRegistration, requireSomeCapability } from './util/dependentRegistration';
import { EditorChatFollowUp, EditorChatFollowUp_Args, CompositeCommand } from './util/copilot';
import * as PConst from '../tsServer/protocol/protocol.const';
import { CachedResponse } from '../tsServer/cachedResponse';

function toWorkspaceEdit(client: ITypeScriptServiceClient, edits: readonly Proto.FileCodeEdits[]): vscode.WorkspaceEdit {
const workspaceEdit = new vscode.WorkspaceEdit();
Expand Down Expand Up @@ -645,7 +645,7 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider<TsCodeActi
copilotRename = info => ({
title: '',
command: EditorChatFollowUp.ID,
arguments: [<EditorChatFollowUp_Args>{
arguments: [{
message: `Rename ${newName} to a better name based on usage.`,
expand: Extract_Constant.matches(action) ? {
kind: 'navtree-function',
Expand All @@ -656,7 +656,7 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider<TsCodeActi
},
action: { type: 'refactor', refactor: action },
document,
}]
} satisfies EditorChatFollowUp_Args]
});
}

Expand Down