hackwaly / ocamlearlybird

OCaml debug adapter
MIT License
208 stars 23 forks source link

Start an OCaml Debug Session renders error #34

Closed cdaringe closed 2 years ago

cdaringe commented 2 years ago

problem

ctrl+shift+p and attempting to start a session yields a pop up error.

research

jumping into the extension host logs shows:

[2021-10-29 22:42:11.261] [exthost] [error] TypeError: Cannot read property 'scheme' of undefined
// ...snip snip snip...
Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:103:33550)
    at /Users/myuser/.vscode/extensions/hackwaly.ocamlearlybird-1.2.0/extension.js:72:39 // eyes
    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) ocamlearlybird.startDebug

by editting the JS, i discovered that uri is not defined:

https://github.com/hackwaly/ocamlearlybird/blob/7f41c13d6906edeef5ed1c353927aaab94ed178d/integrations/vscode/extension.js#L70-L71

cdaringe commented 2 years ago

Further debugging showed me that I could use:

const uri = vscode.window.activeTextEditor.document.uri;

to acquire a Uri!

i wasn't able to fully get into a debugging state yet though.

I'm trying to debug a local version of the jsoo compiler, a la:

    {
        "name": "js_of_ocaml.bc",
        "type": "ocamlearlybird",
        "request": "launch",
        "stopOnEntry": true,
        "yieldSteps": 4096,
        "arguments": ["compile", "/tmp/dummy.ml"],
        "program": "/Users/myuser/src/js_of_ocaml/_build/default/compiler/bin-js_of_ocaml/js_of_ocaml.bc",
    },

but:

thanks for your time!

hackwaly commented 2 years ago

This command is not designed to manually call it in command plates. It is used to implement context menu on bytecode file. And if you debug in this way. You will lost the chance to specify arguments to debuggee program.

The recommended way is using launch configuration to debug. Just click the start debug button in debug pannel or press F5.

cdaringe commented 2 years ago

Thanks for the feedback.

I can certainly use the other methods.

However, if it is not supported from command palette, why register the command?

  "contributes": {
    "commands": [
      {
        "command": "ocamlearlybird.startDebug",
        "title": "Start an OCaml Debug Session"
      },

Any reason to not support it? I can send the PR :)

If it's explicitly forbidden, one could remove it from the palette, but i think it would be quite nice to have a executable file open and jump right into a debug session!

not critical though

hackwaly commented 2 years ago

Vscode context menu api requires that. I didn't know there's option to hide command from command plate while I was developing this extension.

---Original--- From: "Christopher @.> Date: Sun, Oct 31, 2021 07:10 AM To: @.>; Cc: @.**@.>; Subject: Re: [hackwaly/ocamlearlybird] Start an OCaml Debug Session renderserror (Issue #34)

Thanks for the feedback.

I can certainly use the other methods. However, if it is not support from command pallete, why register the command? "contributes": { "commands": [ { "command": "ocamlearlybird.startDebug", "title": "Start an OCaml Debug Session" },

Any reason to not support it? I can send the PR :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.