Nimala::Raku-LSP — Nimala::Raku-DAP

NAME

Nimala::Raku-DAP - The Raku Debug Adapter Protocol (DAP) Server

DESCRIPTION

This module implements the Debug Adapter Protocol (DAP) for Raku. It serves as the main broker between the IDE (such as VS Code, Neovim, or Emacs) and the target Raku process being debugged.

Supported DAP Features

  • Launch: Launching scripts with custom CLI arguments and environment variables.

  • Line Breakpoints: Setting line breakpoints with smart alignment to executable statements and conditional expressions.

  • Logpoints: Setting non-breaking logpoints with dynamic expression interpolation.

  • Function Breakpoints: Breakpoints by routine name with conditional evaluation.

  • Exception Breakpoints: Automatic pause on uncaught and all exceptions with full stack trace and exceptionInfo inspection.

  • Execution Stepping: Step Over (`next`), Step In (`stepIn`), Step Out (`stepOut`), Pause (`pause`), and Continue (`continue`).

  • Threads & Call Stacks: Multi-threaded stack frame inspection with file locations, line numbers, and active subroutine names.

  • Variable Inspection: Inspection of Lexical (`Locals`) scopes with lazy navigation of object attributes, positionals, and associatives.

  • Interactive REPL & Evaluation: Real-time bounded expression evaluation in the debug console with safe `.gist` inspection.

Architecture: Native MoarVM Remote Debugging Protocol

This DAP server communicates directly with MoarVM's built-in remote debugging protocol over loopback TCP using MessagePack framing.

  • Native VM-Level Execution: The debuggee runs as standard raku --debug-port=<port> --debug-suspend <program>, executing standard precompiled bytecode. This eliminates the precompilation slot mismatches, slow first launches, and compiler when statement crashes of earlier statement-hook implementations.

  • Pure-Raku MessagePack Framing: Communication uses a fast, dependency-free MessagePack codec and protocol client with monotonic request/response correlation and event dispatch.

  • Monotonic Handle Management: Context and object handles allocated during stops are tracked in a lifecycle registry and cleanly released in batches upon resume or disconnect.

  • Bounded Expressions & Safe Inspection: Expression evaluation, conditional breakpoints, and logpoints use a bounded expression grammar (variables, attribute/key/index access, comparisons against literals). Arbitrary method calls and mutations are refused; only the whitelisted helpers .gist, .Str, .raku and .elems run in the debuggee, at most one per stop.

  • Smart Stepping: Configurable smart stepping (into, over, disable) automatically filters out internal compiler, runtime, and NQP frames on builds without line drift, while robust sweep stepping protects stepping on builds with bytecode line drift.

Public Interface

The public interface of this module is minimal as it primarily acts as an entry point for the DAP server binary.

  • run-dap-server(): Starts the DAP event loop, reading DAP messages from standard input, translating them to MoarVM protocol commands, and relaying events back to the client.

License Artistic-2.0

Nimala::Raku-LSP v1.0.2

Complete Raku Language Server Protocol (LSP 3.18) & Debug Adapter Protocol (DAP)

Authors

  • kliklamala

License

Artistic-2.0

Dependencies

DBIishJSON::Fast

Provides

  • Nimala::Model::SymbolLookup
  • Nimala::Raku-DAP
  • Nimala::Raku-DAP::BreakpointRegistry
  • Nimala::Raku-DAP::BreakpointRequests
  • Nimala::Raku-DAP::ClientCoordinates
  • Nimala::Raku-DAP::DebuggeeProcess
  • Nimala::Raku-DAP::Evaluator
  • Nimala::Raku-DAP::ExceptionState
  • Nimala::Raku-DAP::Expression
  • Nimala::Raku-DAP::FrameClassifier
  • Nimala::Raku-DAP::Framing
  • Nimala::Raku-DAP::Handles
  • Nimala::Raku-DAP::Inspector
  • Nimala::Raku-DAP::LaunchConfig
  • Nimala::Raku-DAP::Launcher
  • Nimala::Raku-DAP::MessagePack
  • Nimala::Raku-DAP::MoarVMProbe
  • Nimala::Raku-DAP::Protocol
  • Nimala::Raku-DAP::Protocol::Messages
  • Nimala::Raku-DAP::Remote
  • Nimala::Raku-DAP::Session
  • Nimala::Raku-DAP::SourceLines
  • Nimala::Raku-DAP::Stepping
  • Nimala::Raku-DAP::StopHandler
  • Nimala::Raku-DAP::SymbolScanner
  • Nimala::Raku-DAP::ThreadState
  • Nimala::Raku-DAP::Trace
  • Nimala::Raku-DAP::Translate
  • Nimala::Raku-DAP::ValueRenderer
  • Nimala::Raku-LSP
  • Nimala::Raku-LSP::AST
  • Nimala::Raku-LSP::Analysis
  • Nimala::Raku-LSP::Analysis::Completion
  • Nimala::Raku-LSP::Analysis::Cursor
  • Nimala::Raku-LSP::Analysis::Diagnostics
  • Nimala::Raku-LSP::Analysis::InlineCompletion
  • Nimala::Raku-LSP::Analysis::Intelligence
  • Nimala::Raku-LSP::Analysis::Symbols
  • Nimala::Raku-LSP::Analysis::TypeInference
  • Nimala::Raku-LSP::Cache
  • Nimala::Raku-LSP::Client
  • Nimala::Raku-LSP::CoreDocs
  • Nimala::Raku-LSP::Dispatcher
  • Nimala::Raku-LSP::Document
  • Nimala::Raku-LSP::Handler
  • Nimala::Raku-LSP::Handler::Base
  • Nimala::Raku-LSP::Handler::CodeActionProviders
  • Nimala::Raku-LSP::Handler::CodeLens
  • Nimala::Raku-LSP::Handler::Diagnostics
  • Nimala::Raku-LSP::Handler::EditorFeatures
  • Nimala::Raku-LSP::Handler::Formatting
  • Nimala::Raku-LSP::Handler::Hierarchy
  • Nimala::Raku-LSP::Handler::Intelligence
  • Nimala::Raku-LSP::Handler::Lifecycle
  • Nimala::Raku-LSP::Handler::Navigation
  • Nimala::Raku-LSP::Handler::Refactoring
  • Nimala::Raku-LSP::Handler::SemanticTokens
  • Nimala::Raku-LSP::Handler::Sync
  • Nimala::Raku-LSP::Handler::Types
  • Nimala::Raku-LSP::NativeWorker
  • Nimala::Raku-LSP::Parser
  • Nimala::Raku-LSP::Protocol::Types
  • Nimala::Raku-LSP::SymbolDB
  • Nimala::Raku-LSP::Transport::Framing
  • Nimala::Raku-LSP::Transport::Socket
  • Nimala::Raku-LSP::Transport::Stdio
  • Nimala::Raku-LSP::URI
  • Nimala::Raku-LSP::VendorIndex
  • Nimala::Raku-LSP::Workspace
  • Nimala::URI

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.