Skip to content

Conversation

joyceerhl
Copy link

@joyceerhl joyceerhl commented Oct 23, 2020

For https://github.com/microsoft/vscode-python/issues/14441

With our previous custom evaluate request, debugpy was returning the result of calling repr() on our variable value, which is what caused the extra backslashes. By sending "format": "rawString" with our request (implemented as a VS extension: https://github.com/microsoft/VSDebugAdapterHost/wiki/Stack-Trace-and-Value-Formatting), debugpy returns us the raw stringified JSON object, which we can then parse as JSON. The alternative would've been to parse Python string literals ourselves.

escapebugfix

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).
  • The wiki is updated with any design decisions/details.

@joyceerhl joyceerhl added the no-changelog No news entry required label Oct 23, 2020
@joyceerhl joyceerhl requested a review from rchiodo October 23, 2020 23:09
@codecov-io
Copy link

codecov-io commented Oct 23, 2020

Codecov Report

Merging #14501 into release-2020.10 will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@               Coverage Diff                @@
##           release-2020.10   #14501   +/-   ##
================================================
  Coverage            59.19%   59.19%           
================================================
  Files                  721      721           
  Lines                40228    40228           
  Branches              5828     5828           
================================================
  Hits                 23811    23811           
  Misses               15155    15155           
  Partials              1262     1262           
Impacted Files Coverage Δ
...rc/client/datascience/jupyter/debuggerVariables.ts 8.21% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d63031c...e3a1cd0. Read the comment docs.

return _VSCODE_json.dumps(result)
stringified = _VSCODE_json.dumps(result)
# use `encode` to obtain a bytestring for increased portability
return stringified.encode()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files are used in the normal case too. (Jupyter kernel I mean). There were no changes required there as well?

Copy link
Author

@joyceerhl joyceerhl Oct 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was testing and noticed this broke variable explorer, as values come back from Jupyter with a 'b' in front (bytestring) which is not JSON parseable. Just reverted this. It's not strictly required, just recommended by Pavel, and we should probably still do this properly, just not needed now.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@rchiodo rchiodo merged commit a8ea839 into release-2020.10 Oct 26, 2020
@rchiodo rchiodo deleted the fix-escapes branch October 26, 2020 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog No news entry required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants