-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug mode for scripts #4539
Comments
Oh yeah, one thing I forgot to mention: You can set the |
i think |
Powershell has $ErrorActionPreference = "Stop" In regards to debugging and testing, I also really like the -wi "what if" flag that powershell commands have. Maybe that could also be an environment variable (could be indicated in the prompt as training wheels). |
I was looking for an equivalent of: |
not that i know of. i end up putting |
I see! Did the team decide to keep it disabled because of design decisions, or...? |
@aslynatilla I'm confused now. |
@fdncred my bad. I had misunderstood what setting |
Personally I'd very much like to be able to work with a script in an IDE, step through it, watch locals, etc. It's very time-consuming having to debug most scripting languages by, essentially, printf statements, just because they're for scripting, and if the idea is that nu offers the features of a real language but still convenient for shell use, then I think something like this could be really powerful. I presume some sort of language server would be in order here. |
@stellarpower agreed. step debugging would be awesome. I believe vscode has the ability to use DAP now https://microsoft.github.io/debug-adapter-protocol/. If you look at our vscode extension, we're just starting to add basic IDE support, but debugging isn't currently included. |
with the standard library, you can use the |
What about utilizing the existing OpenTelemetry Ecosystem?
Those are just a few ideas, but I think fleshing out a nutshell <-> OTEL integration could also be useful for:
Any thoughts? |
We now have a Debugger trait which can be used to implement custom debuggers (an example is the |
To elaborate a bit further: Using the info that this debugger trait is available, I think utilizing the tracing crate with tracing-opentelemetry could work out nicely. Entering and leaving blocks or pipelines enters and leaves the associated spans. I'm just a bit unsure how to best include the stdout of commands in the spans. As far as I can tell, the various stdouts are not passed through the Debugger trait? Adding a collector to just print executed commands to stdout should be trivial afterwards. |
You should be able to capture stdout from an external process via |
Discussed in #4530
Originally posted by cypof February 18, 2022
What would be the best way to run nu scripts in debug mode? E.g. bash can run scripts with settings like this:
The text was updated successfully, but these errors were encountered: