microsoft / microsoft/debug-adapter-protocol

Variables, evaluation, and escaping

Open
#36 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clarification
Dominant language
HTML
Stars
1.8k
Forks
173
Avg merge
7d 7h
Merged PRs (30d)
2

Description

It seems to me, after guessing and experiments with some debug adapters, that Variable.value is supposed to hold a string that can be evaluated (in some unspecified context) to some approximately equivalent value. So, when the value is the 4-letter string null, it is supposed to be something like "null".

The specification completely fails to discuss that, and existing debug adapters implement this improperly, including Microsoft's own debug adapters. For instance, when debugging typescript, and my variable holds a string that contains quote marks, they are not escaped. Consequently, when I right click the variable, select »Set Value«, and want to append a single character, I may have to go through the whole string to manually escape quote marks and possibly other characters, to make up an expression that can be evaluated.

Likewise, the specification never says for setVariable that the value is actually not a value but an expression that ought to be evaluated in the context of the variablesReference first, before modifying the variable.

The specification should call this out explicitly, including the need to escape values properly, and probably ought to link Variables requests semantically to SetVariable requests (values from a response to the former should be valid input to the latter, with the general expectation that setting a variable to the value reported by the Variables request, does not change the value or its properties like its type).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the specification sections for Variables and setVariable, including the Variable.value and value fields described in the issue. Clarify whether reported values are evaluable expressions, define escaping and evaluation context, and document the expected round-trip behavior between Variables and SetVariable requests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.