Skip to content

Debugger (Launch debugger and attached debugger) #187

Closed

Description

@trymeouteh

Please add the ability to debug Nushell scripts within VSCode. Would help when making large scripts to have a step debugger and be able to see the call stack, variable values, etc.

Would be great to have both an launch debugger option and an attached debugger option.

Activity

  1. devyn commented on Jul 26, 2024

    @devyn

    We don't have a debugger at all to start with, so this is something we'll have to work on. But I think there is interest in developing something like this with the Debug Adapter Protocol so that it can work with multiple editors.

  2. devyn commented on Jul 26, 2024

    @devyn

    You may want to check out the debug profile command, it is able to show you the result of elements executed within a pipeline and the exact execution steps taken, at least. Since it outputs a table it's fairly easy to analyze it however you want with the standard Nushell data manipulation commands.

  3. fdncred commented on Jul 26, 2024

    @fdncred
    Contributor

    You can also find commands that help with debugging by running this command below.

    help commands | where category == debug
  4. rvhelden commented on Jul 24, 2026

    @rvhelden
    Contributor

    Hey all — I've built a working DAP debugger for Nushell scripts in VS Code and published an early version: dreamcode.nu-dap-vscode.

    Full disclosure: it's largely "vibe coded" with an AI assistant, but guided throughout by me as a developer — I drove the design, tested against real scripts, and steered the fixes, so the architecture and decisions are deliberate even where the code was AI-generated. It's a debug adapter that embeds Nushell as a library (using nu-protocol, nu-engine, nu-parser, and nu-command) and implements the Debugger trait, so it runs your script under eval_block:: and hooks each instruction. You get breakpoints (conditional + logpoints), step over/into/out — including stepping through pipeline stages — an exception view, variable inspection with visualizers for tables/records/binary/JSON, watch expressions, and input/input list surfaced as native VS Code pickers.

    It's genuinely early and rough around the edges, so treat it as a preview. The biggest limitation is upstream: the Debugger trait callbacks don't receive the Stack, so I reconstruct variable values indirectly by watching IR instructions — which works, but blocks features like editing variables while paused, seeing closure parameters, and inspecting stream values without consuming them. A couple of small trait changes on the Nushell side (passing &Stack into the callbacks, and a control-flow return from enter_instruction for jump-to-cursor) would remove most of these workarounds and make the experience much better.

    Would love feedback, and I'm happy to discuss the upstream changes if there's interest from the core team.

  5. fdncred commented on Jul 24, 2026

    @fdncred
    Contributor

    @rvhelden That sounds cool. I've always wanted a nushell debugger added to the extension. Ya, feel free to propose your changes on Discord in the #design-discussions channel. I'm sure we'd welcome small changes.

  6. rvhelden commented on Sep 28, 2026

    @rvhelden
    Contributor

    I was already started to integrate my vscode debugger directly into this vscode extension instead of a separate extension, was waiting on the 116 release. Hopefully I can open a PR next weekend

  7. rvhelden commented on Oct 24, 2026

    @rvhelden
    Contributor

    @fdncred I think this one can be closed since PR #241 has merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions