probe-rs / vscode

VSCode debug extension for probe-rs. It uses the MS DAP protocol to communicate directly with the probe (via probe-rs), and supports basic command line debugging in addition to VSCode UI.
https://probe.rs/
Other
65 stars 5 forks source link

Display the flashing progress in some form #75

Closed bugadani closed 6 months ago

bugadani commented 6 months ago

Maybe I'm just missing where it should be, but as far as I can tell, there is currently no way for the user to see the current status of the flashing progress.

noppej commented 6 months ago

It is not always obvious, but it is there .... possibly requires some documentation to clarify. A couple of notes here ...

Let me know if this helps. If not, I will do a little screen grab video to demonstrate.

bugadani commented 6 months ago

Thanks, I have seen the progress reported in a notification popup once now. I suspect some weirdness still, I'll keep my eyes (and this issue) open in case I manage to find out more.

noppej commented 6 months ago

Also make sure that nothing else that is active is already using the progress update in the status bar. For instance, if rust analyzer is busy doing stuff when I start flashing, I find VSCode does not show my flashing progress.

bugadani commented 6 months ago

So my confusion came from flashingEnabled. The extension thinks its default value is true, but I don't think it sets that value - I need to manually add "flashingEnabled": true to my launch config to make it take effect. This suggests that probe-rs's default false is the actual default value when the option is not passed. This also suggests that the extensions default values are largely ignored for anything except documentation purposes.

My uneducated guess is that the following part is not implemented, leaving unset variables (so that they'll get filled by probe-rs & serde):

A launch configuration can be resolved (or modified) before it is used to start a new debug session. This allows for filling in default values based on information available in the workspace. Two resolve methods exist: resolveDebugConfiguration is called before variables are substituted in the launch configuration, resolveDebugConfigurationWithSubstitutedVariables is called after all variables have been substituted. The former must be used if the validation logic inserts additional variables into the debug configuration. The latter must be used if the validation logic needs access to the final values of all debug configuration attributes.

noppej commented 6 months ago

Hmmm ... I think you you're right. That leaves us with two options: 1) Implement the missing resolveXXXXX methods, and apply default values for the extension. 2) Remove default behaviour from the extension, and rely on probe-rs implementation defaults.

My first instinct is to go with option 2, because it promotes consistency in the various binary uses of probe-rs.

@bugadani , @Yatekii , @Tiwalun ... what do you think?

bugadani commented 6 months ago

I'm fine with option 2, all we need is to change the defaults here to their actual values - so that they still are hinted at:

image

noppej commented 6 months ago

I agree.

That said, it is a bit(LOT) of a pain to manually synchronize the list of config options and their defaults and allowed values between the extension and the app. I live in optimistic hope that one day someone will feel inspired to replace the static entries in package.json with a DebugConfigurationProvider that queries probe-rs executable for valid config and options 🤔

bugadani commented 6 months ago

I don't yet understand what the extensions can do. it looks like DebugConfigurationProvider can either provide an initial launch config, or send one dynamically to probe-rs, but what we would need here is a third option: to generate a launch config schema, and I'm not sure how to do that.

Yatekii commented 6 months ago

Yeah the docs on the VSCode API are not great imo. everytime I check it's like a real hassle ^^

I think synchronizing with probe-rs defaults is the sane choice here :)

noppej commented 6 months ago

Thanks. If the DebugConfigurationProvider can't do it, then perhaps a simple script to convert the Rust struct values from probe-rs, and generate the appropriate json might do it. As I typed this, I realize it is probably easier just to synch them manually, as long as we remember to update the docs also 😱