Skip to content

Debug protocol extension: editing variables #27

Closed

Description

To be able to use the debug protocol in other IDEs (Visual Studio, Xamarin Studio) or VS Code in the future we should think about how the debug protocol should support editing variables. Something like:

export interface SetValueRequest extends Request {
    variablesReference: number;
    newValue: string;
}

Note that I would expect this to be able to fail with a message (ex: the new value has a syntax error), but I think a normal error response could be used there.

Seems like we might also want some sort of 'isEditable' attribute on evaluate results to let the IDE know if editing should be allowed.

Activity

  1. daviwil commented on Jun 7, 2016

    @daviwil

    I know Keith Hill (@rkeithhill) would definitely be interested in this for the PowerShell extension.

  2. weinand commented on Jun 15, 2016

    @weinand
    Contributor

    I've added a first cut of a 'SetVariableRequest' to the debug protocol:
    333b123 and 38a49b2

  3. gregg-miskelly commented on Jun 15, 2016

    @gregg-miskelly
    MemberAuthor

    Looks good to me. One suggestion: in the description for the request do you think we should try and call out that support for the command is optional?

  4. weinand commented on Jun 15, 2016

    @weinand
    Contributor

    Gregg Miskelly (@gregg-miskelly) sure, I will add more details to the description after I've used this in node-debug. I just wanted to get this into VS Code so that we can build the UI and explore the details.

  5. gregg-miskelly commented on Jun 15, 2016

    @gregg-miskelly
    MemberAuthor

    Cool. I didn't realize you guys were planning to support it in the UI. Sounds great.

  6. weinand commented on Jun 15, 2016

    @weinand
    Contributor

    Gregg Miskelly (@gregg-miskelly) our current development model is to only add things to the debug protocol that we've used ourselves. Only exception so far is the module view. So we are excited to get a PR for that. :-)

  7. gregg-miskelly commented on Jun 15, 2016

    @gregg-miskelly
    MemberAuthor

    Got it. How do you want to handle then features which aren't in VS Code? For example, I imagine it will be a while before you get to #34, but you might want it some day, where as we will need it soon for Xamarin studio. Do we just want to agree on something in these issues?

  8. weinand commented on Jun 15, 2016

    @weinand
    Contributor

    Gregg Miskelly (@gregg-miskelly) with #34 we are closer than you think... yes, we will agree on something (but in both directions).

  9. gregg-miskelly commented on Jun 15, 2016

    @gregg-miskelly
    MemberAuthor

    Andre Weinand (@weinand) that is great to hear! However, it still seems like at least one of the issues I opened is something that it will be a while before it makes sense to add to VS Code, right? If so, how would you like to handle this? We would like make sure that we add to the protocol in a way that your team is happy with.

  10. weinand commented on Jun 15, 2016

    @weinand
    Contributor

    Gregg Miskelly (@gregg-miskelly) right, if we are happy with a feature request, then we have no problems adding it to the protocol. Currently we are going through your issues and we will raise all concerns and discuss them with all stakeholders one by one.
    Seeing implementations, adoptions, and PRs on all fronts is an excellent way to validate (protocol) designs and to foster progress.

  11. rkeithhill commented on Jun 15, 2016

    @rkeithhill

    PowerShell has some variables that are constant/readonly. I assume we can set the response.success to false and if we provide a response.message, VSCode UI would display that, right?

  12. weinand commented on Jun 15, 2016

    @weinand
    Contributor

    Keith Hill (@rkeithhill) yes, exactly that would be the way to deal with read only variables.

  13. gregg-miskelly commented on Jun 15, 2016

    @gregg-miskelly
    MemberAuthor

    Andre Weinand (@weinand) in our discussions on the 'type' thread, I realized that there is one other item we would probably want here --

    interface Variable
    {
        ...
        // Optional string that is the initial value if the user attempt to edit this variable. If not
        // provided, 'value' is used instead. This is used for the case that the debug adapter
        // and/or underlying debugger have done steps to improve the display of the variable
        // which makes the value invalid syntax (ex: include the type of the value in 'value')
        editableValue?: string;
    
  14. weinand commented on Jun 21, 2016

    @weinand
    Contributor

    Gregg Miskelly (@gregg-miskelly) David Wilson (@daviwil) Keith Hill (@rkeithhill) Jackson Davis (@jacdavis) Felix Becker (@felixfbecker) Luke Hoban (@lukehoban) roblourens Don Jayamanne (@DonJayamanne) Jan Jurzitza (@WebFreak001) Peng Lyu (@rebornix)
    A first version of 'variable editing' support is now available in the Insider build (node-debug) and the 'next' version of the debug protocol.
    Still missing is the UI for showing errors.

  15. weinand commented on Jun 23, 2016

    @weinand
    Contributor

    We've added the UI for showing errors returned from the setVariablesRequest

  16. wesrupert commented on Jun 23, 2016

    @wesrupert
    Contributor

    I second Gregg Miskelly (@gregg-miskelly)'s suggestion to add an editableValue string to Variable. Currently since Variable only contains name and value as display properties, the only way to show type information is to format it into value, e.g. i: 3 [int]. This means that when the user clicks into the field to edit it, they have to clear out the [int] part of the string every time. Being able to pass separate edit and display values would make this experience a lot cleaner.

  17. weinand commented on Jun 23, 2016

    @weinand
    Contributor

    Wes Rupert (@wesrupert) please consider to make use of the type attribute which will become available in the June release. See #32

  18. wesrupert commented on Jun 23, 2016

    @wesrupert
    Contributor

    Andre Weinand (@weinand) Great! I'll work on updating the plugin based on the new protocol changes.

  19. gregg-miskelly commented on Jun 23, 2016

    @gregg-miskelly
    MemberAuthor

    Andre Weinand (@weinand) support for type will definitely reduce our need for this, but editableValue is a concept we have in VS for other scenarios too - sometimes its useful to have a display name which is different than the editable value. Consider a character pointer in C++ for example. The editable value might just be something like 0x123456 where the display could be '0x123456 "The string value pointed to goes here"'. I couldn't tell you off hand all the scenarios where we have an editable value which is different from the display value, but I do know that we have them even for C#.

  20. weinand commented on Jun 23, 2016

    @weinand
    Contributor

    Gregg Miskelly (@gregg-miskelly) I see the need, but not for this sprint. Please adopt what will be available in June and we can iterate over the issues after that.

  21. gregg-miskelly commented on Jun 24, 2016

    @gregg-miskelly
    MemberAuthor

    Andre Weinand (@weinand) will do. Would you like us to open an issue for adding this for the future?

  22. rkeithhill commented on Aug 20, 2016

    @rkeithhill

    Andre Weinand (@weinand) I have a question about the protocol. The SetVariableArguments type defines name to be of type number. But when I look at in the debugger, it is coming across as a string. String makes sense to me but how can this work if the .ts is typed as a number. The magic of JavaScript? ConfusedInColorado. :-)

  23. weinand commented on Aug 20, 2016

    @weinand
    Contributor

    Keith Hill (@rkeithhill) your 'protocol' link from above refers to an erroneous commit.
    This problem no longer exists in the 1.11.0 version of the protocol.
    Here is the link to the 'master' branch:
    https://github.com/Microsoft/vscode-debugadapter-node/blob/master/protocol/src/debugProtocol.ts

  24. rkeithhill commented on Aug 20, 2016

    @rkeithhill

    My sanity has been restored. Thanks!

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions