mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Merge pull request #20 from int19h/varset
Resolve #16: Setting variable values
This commit is contained in:
commit
2a31b8800a
1 changed files with 24 additions and 0 deletions
|
|
@ -307,6 +307,7 @@ class VSCodeMessageProcessor(ipcjson.SocketIO, ipcjson.IpcChannel):
|
|||
request,
|
||||
supportsExceptionInfoRequest=True,
|
||||
supportsConfigurationDoneRequest=True,
|
||||
supportsSetVariable=True,
|
||||
exceptionBreakpointFilters=[
|
||||
{
|
||||
'filter': 'raised',
|
||||
|
|
@ -464,6 +465,29 @@ class VSCodeMessageProcessor(ipcjson.SocketIO, ipcjson.IpcChannel):
|
|||
|
||||
self.send_response(request, variables=variables)
|
||||
|
||||
@async_handler
|
||||
def on_setVariable(self, request, args):
|
||||
vsc_var = int(args['variablesReference'])
|
||||
pyd_var = self.var_map.to_pydevd(vsc_var)
|
||||
|
||||
# VSC gives us variablesReference to the parent of the variable being set, and
|
||||
# variable name; but pydevd wants the ID (or rather path) of the variable itself.
|
||||
pyd_var += (args['name'],)
|
||||
vsc_var = self.var_map.to_vscode(pyd_var)
|
||||
|
||||
cmd_args = [str(s) for s in pyd_var] + [args['value']]
|
||||
_, _, resp_args = yield self.pydevd_request(pydevd_comm.CMD_CHANGE_VARIABLE, '\t'.join(cmd_args))
|
||||
xml = untangle.parse(resp_args).xml
|
||||
xvar = xml.var
|
||||
|
||||
response = {
|
||||
'type': unquote(xvar['type']),
|
||||
'value': unquote(xvar['value']),
|
||||
}
|
||||
if bool(xvar['isContainer']):
|
||||
response['variablesReference'] = vsc_var
|
||||
self.send_response(request, **response)
|
||||
|
||||
@async_handler
|
||||
def on_pause(self, request, args):
|
||||
# TODO: docstring
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue