Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c91630d

Browse files
authored
Merge pull request #621 from codestoryai/features/fix-how-we-parse-code-actions
[ide] fix how we parse the code actions
2 parents 9eef4dd + c5a7f1f commit c91630d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

extensions/codestory/src/server/quickFix.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,20 @@ export async function quickFixInvocation(request: SidecarQuickFixInvocationReque
8181
export async function quickFixList(request: SidecarQuickFixRequest): Promise<SidecarQuickFixResponse> {
8282
const textDocumentUri = vscode.Uri.file(request.fs_file_path);
8383
const requestId = request.request_id;
84+
const startPosition = request.range.startPosition;
85+
const endPosition = request.range.endPosition;
86+
const quickFixRange = new vscode.Range(new vscode.Position(startPosition.line, startPosition.character), new vscode.Position(endPosition.line, endPosition.character));
8487
await vscode.workspace.openTextDocument(textDocumentUri);
8588
const codeActions: vscode.CodeAction[] = await vscode.commands.executeCommand(
8689
'vscode.executeCodeActionProvider',
8790
textDocumentUri,
88-
request.range,
91+
quickFixRange,
8992
);
9093
const actionsFlattened: { label: string; arguments: any; command: string; id: number }[] = [];
9194
let actionIndex = 0;
9295
// Over here try to get all the code actions which we need to execute
9396
codeActions.forEach((codeAction) => {
94-
if (codeAction.command?.command === 'rust-analyzer.resolveCodeAction') {
97+
if (codeAction.command?.command === 'rust-analyzer.applyActionGroup') {
9598
// This means there are multiple commands in there, so we have to add it
9699
// to the flattened list
97100
const commandPossibleArguments = codeAction.command.arguments ?? [];
@@ -107,9 +110,11 @@ export async function quickFixList(request: SidecarQuickFixRequest): Promise<Sid
107110
}
108111
} else {
109112
const actionCommand = codeAction.command;
113+
console.log('whats the command over here');
114+
console.log(actionCommand);
110115
if (actionCommand !== undefined) {
111116
actionsFlattened.push({
112-
label: codeAction.title,
117+
label: actionCommand.title,
113118
command: actionCommand.command,
114119
arguments: actionCommand.arguments,
115120
id: actionIndex,
@@ -118,6 +123,9 @@ export async function quickFixList(request: SidecarQuickFixRequest): Promise<Sid
118123
}
119124
}
120125
});
126+
console.log('actions');
127+
console.log(actionsFlattened);
128+
console.log('actions list');
121129
QUICK_FIX_LIST.insertForRequestId(requestId, actionsFlattened);
122130
return {
123131
options: actionsFlattened.map((action) => {

0 commit comments

Comments
 (0)