use of nl.ramsolutions.sw.magik.debugadapter.BreakpointManager.MagikBreakpoint in project magik-tools by StevenLooman.
the class MagikDebugAdapter method setBreakpoints.
@Override
public CompletableFuture<SetBreakpointsResponse> setBreakpoints(final SetBreakpointsArguments args) {
LOGGER.trace("setBreakpoints");
return CompletableFuture.supplyAsync(() -> {
final Source source = args.getSource();
// Do some manual fixing if needed.
if (source.getName() == null && source.getPath() != null) {
final Path path = Path.of(source.getPath());
final String name = path.getFileName().toString();
source.setName(name);
}
try {
final SourceBreakpoint[] sourceBreakpoints = args.getBreakpoints();
final List<MagikBreakpoint> magikBreakpoints = this.breakpointManager.setBreakpoints(source, sourceBreakpoints);
// Return response.
final SetBreakpointsResponse response = new SetBreakpointsResponse();
final Breakpoint[] breakpoints = Lsp4jConversion.toLsp4j(source, magikBreakpoints);
response.setBreakpoints(breakpoints);
return response;
} catch (InterruptedException exception) {
java.lang.Thread.currentThread().interrupt();
throw new CompletionException(exception.getMessage(), exception);
} catch (IOException | ExecutionException exception) {
throw new CompletionException(exception.getMessage(), exception);
}
});
}
use of nl.ramsolutions.sw.magik.debugadapter.BreakpointManager.MagikBreakpoint in project magik-tools by StevenLooman.
the class MagikDebugAdapter method setFunctionBreakpoints.
@Override
public CompletableFuture<SetFunctionBreakpointsResponse> setFunctionBreakpoints(final SetFunctionBreakpointsArguments args) {
LOGGER.trace("setFunctionBreakpoints");
return CompletableFuture.supplyAsync(() -> {
try {
// Clear existing breakpoints.
this.breakpointManager.clearFunctionBreakpoints();
// Set new breakpoints.
final FunctionBreakpoint[] functionBreakpoints = args.getBreakpoints();
final List<MagikBreakpoint> magikBreakpoints = this.breakpointManager.addFunctionBreakpoints(functionBreakpoints);
// Return response.
final SetFunctionBreakpointsResponse response = new SetFunctionBreakpointsResponse();
final Breakpoint[] breakpoints = Lsp4jConversion.toLsp4j(null, magikBreakpoints);
response.setBreakpoints(breakpoints);
return response;
} catch (InterruptedException exception) {
java.lang.Thread.currentThread().interrupt();
throw new CompletionException(exception.getMessage(), exception);
} catch (IOException | ExecutionException exception) {
throw new CompletionException(exception.getMessage(), exception);
}
});
}
Aggregations