Skip to content

Interface

ycWang9725 edited this page Dec 27, 2018 · 3 revisions

After launching, Judy should immediately accept one connection on localhost:8000 and one on localhost:18001, before executing any code. The first connection carries requests (from adapter to debugger). The second connection carries events (from debugger to adapter). The following protocol describes the communication on these connections.

Packet

+-----------------------------------------------+----------------------------+
| length (8-digit decimal number padded with 0) | JSON data (`length` bytes) |
+-----------------------------------------------+----------------------------+

The JSON data follows JSON-RPC 2.0.

Example communication on the request connection:

  • adapter: 00000112{"jsonrpc": "2.0", "id": 1, "method": "setBreakPoints", "params": {"path": "C:\\foo\\bar.jl", "lines": [1, 2, 3]}}
  • debugger: 00000141{"jsonrpc": "2.0", "id": 1, "result": [{"verified": false}, {"verified": true, "line": 2, "id": 1}, {"verified": true, "line": 10, "id": 2}]}

Request methods

  • initialize

    params: { }

    result: { }

  • launch

    params: {"program": "D:\judy-ast/test/test1.jl" }

    result: '{ }'

  • setBreakPoints

    params: {"path": "C:\\foo\\bar.jl", "lines": [1, 2, 3]}

    result: [{"verified": false}, {"verified": true, "line": 2, "id": 1}, {"verified": true, "line": 10, "id": 2}]

  • configurationDone

    params: { }

    result: { }

  • continue

    params: { }

    result: { }

  • next

    params: { }

    result: { }

  • threads

    we don't support multi-threading debug, so this request will be responded by the adapter and will not send to the debugger.

  • stackTrace

    params: { }

    result: { { "frameId": 1, "name": "my_func", "path": "C:\\foo\\child.jl", "line": 1 }, { "frameId": 2, "name": "my_func2", "path": "C:\\foo\\child.jl", "line": 5 }, { "frameId": 3, "name": "main", "path": "C:\\foo\\parent.jl", "line": 1 } }

  • scopes

    params: { "frameId": 1 }

    result: { { "name": "main", "variablesReference": 37, "expensive": false } }

    note: "variablesReference" is the reference of the variable container.

  • variables

    params: { "variablesReference": 37 }

    result: { { "name": "my_float", "value": "23.09", "type": "float", "variablesReference": 0 }, { "name": "my_var", "value": "my_class{ _int: 1, _float: 5.99, _string: "too long to show i..." }", "type": "float", "variablesReference": 55 } }

    note: if variablesReference is > 0, the variable is structured and its children can be retrieved by passing variablesReference to the VariablesRequest.

Event methods

All events are notifications, which means they don't need responses.

  • initialized

    params: { }

  • stopped

    params: { "reason": "step", "description":"", "text": "" }

    note: (1)reason values: 'step', 'breakpoint', 'exception', 'pause', 'entry', 'goto', etc. (2) description: full reason for the event, show in UI (3) text is additional information like exception name, show in UI

  • exited

    params: { "exitCode": 0 }

  • output

    params: { "text": 'hello word', "filePath": "my/juliaTest.jl", "line":3, "column": 0 }

    note: this event is to send some kind of output to adapter, and will be shown in debug console.

some reminders

  1. On Windows: add your Julia binary to VSCode Settings:
"julia.executablePath": "C:\\Your\\Path\\to\\Julia-1.0.2\\bin\\julia.exe"
  1. Debugging your extension: use Server + Extension debug mode.
Clone this wiki locally