Skip to content

Questions & Notes #177

Closed
Closed

Description

@lukejans

I'm not sure where to post questions or discussions on this extension so I'm just creating an issue. Please let me know where I should ask questions in the future.

Questions & Notes

  1. Is it possible to run the debugger on a single file? In school, I often find myself writing many Java files in the same project to solve certain exercises. All of these classes have nothing to do with one another, and they all have their own entry point/psvm method. When I attempt to launch the debugger, it tells me that I must specify the entry point to use. This is a great feature, but it would be nice to have a way to just debug the current file instead of having to change the entry point each time. If there is an easy way to debug a single file, I would love to hear it.

  2. Is there a way to exclude certain files from the java debugger?

Activity

  1. tartarughina commented on Jan 22, 2026

    @tartarughina
    Collaborator

    Hey @lukejans

    We are lacking a Discussion tab so an issue is, at the moment, the best place where to ask.

    1. Rust has implemented in the runnable an option to run or debug, we could implement the same. This would allow you to easily start a debugging session without explicitly updating the entry point.
    Image
    1. With excluding, what do you mean exactly? Skipping the file while debugging? I don't think that's possible but my experience with the java debugger is limited hence there could be the option but I've never seen it. Do you by any chance have examples of IDEs doing it?
  2. tartarughina commented on Jan 22, 2026

    @tartarughina
    Collaborator

    If you're working a lot with single file debugging you can try the following config for debug.json

    [
      {
        "label": "Debug $ZED_STEM",
        "adapter": "Java",
        "request": "launch",
        "mainClass": "$ZED_STEM",
        "build": {
          "command": "javac -d . $ZED_FILE",
          "shell": {
            "with_arguments": {
              "program": "/bin/sh",
              "args": ["-c"]
            }
          }
        }
      }
    ]

    It will allow you to have the debugger start with the current selected file as argument. Sadly integrating the debugger along with the runnable seems to be limited to core languages for now in Zed. This is the best workaround I've found.

  3. lukejans commented on Feb 9, 2026

    @lukejans
    Author

    Thank you for the quick and helpful response! I think having a debug option in the runnable section would be awesome! The work around you came up with works great for the time being though!

    1. What i meant by excluding was for the debugger to not step into things like builtin methods. I noticed with methods like .get(), the debugger would take multiple steps on this line instead of a single step.
  4. tartarughina commented on Feb 9, 2026

    @tartarughina
    Collaborator

    @lukejans that's a behavior coming from the debugger itself, we do not have a way to change it or offer the option to personalize it.

    You should try using the option Step over rather than just executing the next step in the call stack.

  5. tartarughina commented on Mar 6, 2026

    @tartarughina
    Collaborator

    I've added the single file debugging to the README, the issue can be considered completed

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