Skip to content

Commit

Permalink
bugfix: Don't show run code lense when using Main class and worksheets
Browse files Browse the repository at this point in the history
It happens if we have no package Main class and a worksheet next to it.

This is pretty minor edge case and doesn't break anything, but we should not show run/debug lenses for worksheets as it will run a different clas.
  • Loading branch information
tgodzik committed Nov 18, 2024
1 parent bd911b5 commit 8a1d1ec
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,15 @@ final class RunTestCodeLens(
// most of the bsp servers such as bloop and sbt might not support it.
} yield requestJvmEnvironment(buildTargetId, isJVM).map { _ =>
val classes = buildTargetClasses.classesOf(buildTargetId)
val syntheticLenses = syntheticCodeLenses(
textDocument,
buildTargetId,
classes,
isJVM,
)
val syntheticLenses =
if (!path.isWorksheet)
syntheticCodeLenses(
textDocument,
buildTargetId,
classes,
isJVM,
)
else Nil
val regularLenses =
codeLenses(
textDocument,
Expand Down

0 comments on commit 8a1d1ec

Please sign in to comment.