Skip to content

Commit

Permalink
Merge pull request #1449 from tgodzik/show-error-on-lenses
Browse files Browse the repository at this point in the history
bugfix: Show error properly if lenses cannot be run
  • Loading branch information
tgodzik authored Jan 10, 2024
2 parents eaa0897 + dcd6f94 commit cee20ea
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions packages/metals-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,22 +593,36 @@ function launchMetals(
registerCommand(
ClientCommands.StartDebugSession,
(param: ScalaCodeLensesParams) => {
scalaDebugger.start(false, param).then((wasStarted) => {
if (!wasStarted) {
window.showErrorMessage("Debug session not started");
scalaDebugger.start(false, param).then(
(wasStarted) => {
if (!wasStarted) {
window.showErrorMessage("Debug session not started");
}
},
(reason) => {
if (reason instanceof Error) {
window.showErrorMessage(reason.message);
}
}
});
);
}
);

registerCommand(
ClientCommands.StartRunSession,
(param: ScalaCodeLensesParams) => {
scalaDebugger.start(true, param).then((wasStarted) => {
if (!wasStarted) {
window.showErrorMessage("Run session not started");
scalaDebugger.start(true, param).then(
(wasStarted) => {
if (!wasStarted) {
window.showErrorMessage("Run session not started");
}
},
(reason) => {
if (reason instanceof Error) {
window.showErrorMessage(reason.message);
}
}
});
);
}
);

Expand Down

0 comments on commit cee20ea

Please sign in to comment.