-
Notifications
You must be signed in to change notification settings - Fork 76
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
Conversation
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.
commands.getCommands().then((values) => { | ||
if (values.includes(command)) { | ||
commands.executeCommand(command); | ||
} | ||
}); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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
registerCommand(ClientCommands.RunDoctor, async () => { | ||
await doctorProvider.runDoctor(); | ||
}); |
There was a problem hiding this comment.
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? 😅
There was a problem hiding this comment.
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,
});
There was a problem hiding this comment.
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 😅
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.