diff --git a/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/JBallerinaDebugServer.java b/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/JBallerinaDebugServer.java index b35415ce98d2..9efbd4aab2f3 100755 --- a/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/JBallerinaDebugServer.java +++ b/misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/JBallerinaDebugServer.java @@ -68,6 +68,7 @@ import org.eclipse.lsp4j.debug.ConfigurationDoneArguments; import org.eclipse.lsp4j.debug.ContinueArguments; import org.eclipse.lsp4j.debug.ContinueResponse; +import org.eclipse.lsp4j.debug.ContinuedEventArguments; import org.eclipse.lsp4j.debug.DisconnectArguments; import org.eclipse.lsp4j.debug.EvaluateArguments; import org.eclipse.lsp4j.debug.EvaluateResponse; @@ -1220,6 +1221,7 @@ private void clearSuspendedState() { * Clears all state information. */ private void resetServer() { + clearDebugHits(); Optional.ofNullable(eventProcessor).ifPresent(JDIEventProcessor::reset); Optional.ofNullable(outputLogger).ifPresent(DebugOutputLogger::reset); Optional.ofNullable(executionManager).ifPresent(DebugExecutionManager::reset); @@ -1227,4 +1229,14 @@ private void resetServer() { clearSuspendedState(); context.reset(); } + + /** + * Clears any debug hits in the client side before restarting the debug session. + */ + private void clearDebugHits() { + // Notifies the debug client that the execution is resumed. + ContinuedEventArguments continuedEventArguments = new ContinuedEventArguments(); + continuedEventArguments.setAllThreadsContinued(true); + context.getClient().continued(continuedEventArguments); + } }