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

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Aug 4, 2023

Previously, we would run a command without clicking on the status bar, which could be problematic if a message was shown multiple times. We would also invoke the RunDoctor command, which invokes itself. Now, RunDoctor invokes the correct part of the extension and status bar command is not invoked right away.

I am not sure why this never happened before, but might be a change in VS Code that prompted it.

Previously, we would run a command without clicking on the status bar, which could be problematic if a message was shown multiple times. We would also invoke the RunDoctor command, which invokes itself. Now, RunDoctor invokes the correct part of the extension and status bar command is not invoked right away.

I am not sure why this never happened before, but might be a change in VS Code that prompted it.
Comment on lines -727 to -731
commands.getCommands().then((values) => {
if (values.includes(command)) {
commands.executeCommand(command);
}
});
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

Copy link
Member

@kpodsiad kpodsiad left a comment

Choose a reason for hiding this comment

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

Looks good, but I'm also a bit intrested how things was working before :D

Comment on lines +572 to +574
registerCommand(ClientCommands.RunDoctor, async () => {
await doctorProvider.runDoctor();
});
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 😅

@tgodzik tgodzik merged commit 9ccd390 into scalameta:main Aug 7, 2023
10 checks passed
@tgodzik tgodzik deleted the fix-doctor branch August 7, 2023 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants