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

bugfix: Don't run command without clicking and fix infinite recursion #1414

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions packages/metals-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,9 @@ function launchMetals(
commands.executeCommand(workbenchCommands.focusDiagnostics)
);

registerCommand(ClientCommands.RunDoctor, () =>
commands.executeCommand(ClientCommands.RunDoctor)
);
registerCommand(ClientCommands.RunDoctor, async () => {
await doctorProvider.runDoctor();
});
Comment on lines +572 to +574
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how did this work before fix? 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every time when I look at vscode's commands I have no idea what's going on. I mix server commands with client ones. Might be good idea to have some doc for clarification + some abstraction to execute server commands. to have something better than

await this.client.sendRequest(ExecuteCommandRequest.type, {
      command: ServerCommands.DoctorRun,
    });

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't work before, but it seems no once clicked the status bar 😅


registerCommand(ClientCommands.ToggleLogs, () => {
if (channelOpen) {
Expand Down Expand Up @@ -722,13 +722,7 @@ function launchMetals(
item.tooltip = params.tooltip;
}
if (params.command) {
const command = params.command;
item.command = params.command;
commands.getCommands().then((values) => {
if (values.includes(command)) {
commands.executeCommand(command);
}
});
Comment on lines -727 to -731
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we use this callback, e.g. DebugProvider.reportErrors for DebugErrorsPresent in metals. (I haven't tested this)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this was supposed to only invoke the command if anyone clicks on the status, so I am not sure why this was done and why it only started to pop up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But, I think we set it to status if we don't care to show it right away, otherwise we should invoke a command instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scala-debug-adapter-1691161142589

This started to happen :D

} else {
item.command = undefined;
}
Expand Down
Loading