From 314211d17cd959a1229398fac5ade7be3db46aaf Mon Sep 17 00:00:00 2001 From: Pavel Minaev Date: Thu, 22 Mar 2018 15:12:46 -0700 Subject: [PATCH] Improve value formatting for setExpression. --- ptvsd/wrapper.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ptvsd/wrapper.py b/ptvsd/wrapper.py index c162159a..3a3c980e 100644 --- a/ptvsd/wrapper.py +++ b/ptvsd/wrapper.py @@ -1069,9 +1069,7 @@ class VSCodeMessageProcessor(ipcjson.SocketIO, ipcjson.IpcChannel): vsc_fid = int(args['frameId']) pyd_tid, pyd_fid = self.frame_map.to_pydevd(vsc_fid) - - safe_repr_provider.set_format( - self._extract_format(args)) + fmt = args.get('format', {}) lhs_expr = args.get('expression') rhs_expr = args.get('value') @@ -1082,12 +1080,11 @@ class VSCodeMessageProcessor(ipcjson.SocketIO, ipcjson.IpcChannel): cmd_args = (pyd_tid, pyd_fid, 'LOCAL', expr, '1') msg = '\t'.join(str(s) for s in cmd_args) - _, _, _ = yield self.pydevd_request( - pydevd_comm.CMD_EXEC_EXPRESSION, - msg) + with (yield self.using_format(fmt)): + _, _, _ = yield self.pydevd_request( + pydevd_comm.CMD_EXEC_EXPRESSION, + msg) - # Reset hex format since this is per request. - safe_repr_provider.convert_to_hex = False # Return 'None' here, VS will call getVariables to retrieve # updated values anyway. Doing eval on the left-hand-side # expression may have side-effects