tonka3000 / vscode-raycast

Raycast tools for VSCode
https://marketplace.visualstudio.com/items?itemName=tonka3000.raycast
MIT License
16 stars 2 forks source link

No way to attach the debugger #31

Closed imkebe closed 6 months ago

imkebe commented 6 months ago

Summary

No way to attach the debugger

Steps to reproduce

I can't attach the debugger to the process. I start by "Start Development Mode" and than "Attach the Debugger". I created the

        {
            "name": "Attach by Process ID",
            "processId": "${command:PickProcess}",
            "request": "attach",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "type": "node"
        }
    ]

launch.json however there is no process to choose from.

tonka3000 commented 6 months ago

Hi,

you tried the following command after Start Development Mode?

CleanShot 2024-02-11 at 14 01 28@2x

imkebe commented 6 months ago

Yes.Exacly that one. I've tried with different version like node 18, 20. No option. Could you share the launch.json to use.?

tonka3000 commented 6 months ago

There is no launch.json to create. The command do that on the fly because the PID of the process is dynamic.

It looks like you don't have a running Raycast Helper. Did you start at least on extension command after the last restart of Raycast?

What is the output of ps aux | grep Raycast?

Which Raycast version do you use?

imkebe commented 6 months ago
kebe             89235   0,0  0,3 410400416  93040   ??  S     1:31     0:42.59 Raycast Helper (Extensions)
kebe              1879   0,0  0,6 411485136 194256   ??  S    śro10   65:16.97 /Applications/Raycast.app/Contents/MacOS/Raycast

Raycast 1.67.1

imkebe commented 6 months ago

How does it work without the launch.json ? It forces me to create one when i run the "Attach Debuger"

tonka3000 commented 6 months ago

Interesting. On my machine it works normally.

Can you make a short video what happens after Raycast: Attach debugger. Does it show the typically vscode debugger command bar or do you get an error?

tonka3000 commented 6 months ago

How does it work without the launch.json ? It forces me to create one when i run the "Attach Debuger"

Yes. You don't need to configure anything because there is only one valid config which will be done by the Command. You can use the normal attach mode as you already mention, but you need to figure out the details yourself because they change on every restart of Raycast. That is also the reason this command exists in the first place.

tonka3000 commented 6 months ago

Please also activate the logger in debug level

{
    "raycast.loglevel": "debug"
}

Start the Attach Debugger afterwards and copy/paste the result. This will look like following. CleanShot 2024-02-11 at 14 29 21@2x

imkebe commented 6 months ago

First run the Development mode and launched Attach to Debuger https://github.com/tonka3000/vscode-raycast/assets/4148157/fec2f75c-4ba1-42e8-8000-253b87119b7b

Then created the launch.json to pick one of the processes. https://github.com/tonka3000/vscode-raycast/assets/4148157/737257d1-59a1-4201-b922-8607f613a0e2

However the second one won't work since it's not the "node" command but "raycast" that we try to attach to? I have also tried to set the "hostname: localhost" and "port:7265" on which the Raycast is listening.

tonka3000 commented 6 months ago

What is the output of the debug-level prints?

I assume that the grabbing of the PID in the process fails in the command for whatever reason. As written, launch.json is not necessary.

imkebe commented 6 months ago
2024-02-11T13:46:59.955Z [debug] start watching transit folder /Users/kebe/Library/Application Support/Code/User/globalStorage/tonka3000.raycast/transit
2024-02-11T13:46:59.955Z [debug] Fetch latest raycast migration version from npm
2024-02-11T13:46:59.955Z [debug] Fetch NPM package information for '@raycast/migration'
2024-02-11T13:46:59.955Z [debug] update state
2024-02-11T13:47:00.129Z [debug] /Users/kebe/projects/raycast-external-devices/external-devices/package.json raycast enabled: true
2024-02-11T13:47:00.129Z [debug] setContext raycast.workspaceEnabled to true
2024-02-11T13:47:00.183Z [debug] setContent succeeded
2024-02-11T13:47:00.191Z [debug] read in package.json
2024-02-11T13:47:00.193Z [debug] /Users/kebe/projects/raycast-external-devices/external-devices/package.json raycast enabled: true
2024-02-11T13:47:00.193Z [debug] setContext raycast.workspaceEnabled to true
2024-02-11T13:47:00.212Z [debug] setContent succeeded
2024-02-11T13:47:00.212Z [debug] setContext raycast.extensionLoaded to true
2024-02-11T13:47:00.214Z [debug] setContent succeeded
2024-02-11T13:47:00.400Z [debug] config changed event
2024-02-11T13:47:00.400Z [debug] update state
2024-02-11T13:47:00.403Z [debug] /Users/kebe/projects/raycast-external-devices/external-devices/package.json raycast enabled: true
2024-02-11T13:47:00.403Z [debug] setContext raycast.workspaceEnabled to true
2024-02-11T13:47:00.404Z [debug] setContent succeeded
2024-02-11T13:47:00.605Z [debug] return cached manifest, no filechange in package.json
2024-02-11T13:47:03.211Z [debug] Got version 1.67.0 from npm for @raycast/migration
2024-02-11T13:47:03.211Z [debug] set latest npm raycast migration version to 1.67.0
2024-02-11T13:47:03.211Z [debug] refresh treedataprovider
2024-02-11T13:47:03.213Z [debug] raycast npm Version: 1.67.0, package.json version: ^1.67.0
2024-02-11T13:47:03.213Z [debug] minor version => npm: 1.67.0, package.json: 1.67.0
2024-02-11T13:47:03.226Z [debug] return cached manifest, no filechange in package.json
2024-02-11T13:47:03.281Z [debug] start dev process
2024-02-11T13:47:13.225Z [debug] start dev process
2024-02-11T13:47:38.756Z [debug] found Raycast node process: 25877 Raycast Helper (Extensions)      
2024-02-11T13:47:38.756Z [debug] 25877
2024-02-11T13:48:16.700Z [debug] return cached manifest, no filechange in package.json
2024-02-11T13:50:46.329Z [debug] Start Extension Issues
2024-02-11T13:50:46.330Z [debug] Get Extension ID from store for "external-devices"
2024-02-11T13:51:01.318Z [debug] update state
2024-02-11T13:51:01.319Z [debug] /Users/kebe/projects/raycast-external-devices/external-devices/package.json raycast enabled: true
2024-02-11T13:51:01.319Z [debug] setContext raycast.workspaceEnabled to true
2024-02-11T13:51:01.322Z [debug] setContent succeeded
2024-02-11T13:51:01.323Z [debug] raycast npm Version: 1.67.0, package.json version: ^1.67.0
2024-02-11T13:51:01.323Z [debug] minor version => npm: 1.67.0, package.json: 1.67.0
2024-02-11T13:51:01.324Z [debug] return cached manifest, no filechange in package.json
2024-02-11T13:51:01.325Z [debug] return cached manifest, no filechange in package.json
2024-02-11T13:51:01.528Z [debug] raycast npm Version: 1.67.0, package.json version: ^1.67.0
2024-02-11T13:51:01.528Z [debug] minor version => npm: 1.67.0, package.json: 1.67.0
2024-02-11T13:51:01.532Z [debug] return cached manifest, no filechange in package.json
2024-02-11T13:51:01.532Z [debug] return cached manifest, no filechange in package.json
2024-02-11T13:51:31.068Z [debug] found Raycast node process: 25877 Raycast Helper (Extensions)      
2024-02-11T13:51:31.069Z [debug] 25877
tonka3000 commented 6 months ago

ok, grabbing works. So now you can try the launch.json manually.

Here you can see the content of launch.json. Replace the ${pid} with the PID from the log output (in the current session of Raycast it is 25877). Try to start it. I would assume that the same happens. If yes, maybe reboot vscode, Raycast and as a last resort your machine.

imkebe commented 6 months ago

Nothing works. However as I understand that might be an issue with the VSCode ? Thank you for your help. If I'll find the solution i will post here.

imkebe commented 6 months ago

Btw.


Wersja: 1.86.1
Zatwierdzenie: 31c37ee8f63491495ac49e43b8544550fbae4533
Data: 2024-02-07T09:08:57.920Z
Elektron: 27.2.3
ElektronBuildId: 26495564
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
System operacyjny: Darwin arm64 23.2.0
``
tonka3000 commented 6 months ago

Nothing works. However as I understand that might be an issue with the VSCode ?

Yes. It is very likely that this is a VSCode issue because the extension instruct VSCode correctly.

I closed the issue for now. If you find a solution you can of course post it here.

klmz commented 3 months ago

I have the same issue. But only got a little bit further. When i try to look up de pid of the node process I get two options:

joost            70951   0.0  0.4 409510512 142320 s018  S+    5:46PM   0:00.37 /Users/joost/repos/raycast/extensions/harvest/node_modules/@raycast/api/bin/arm64/ray develop
joost            70937   0.0  0.0 408105136   1680 s018  S+    5:46PM   0:00.00 /bin/bash /Users/joost/repos/raycast/extensions/harvest/node_modules/.bin/ray develop

I cant attach to the first one, it just doesn't respond. But when I try to attach to the second one I get this:

Debugger listening on ws://127.0.0.1:9229/22d01897-caf4-4851-ba5d-3977aff7cd84
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
npm ERR! path /Users/joost/repos/raycast/extensions/harvest
npm ERR! command failed
npm ERR! signal SIGUSR1
npm ERR! command sh -c ray develop

So, when inspector is turned on in the node process it crashes.

My guess is that the vscode extension grabs the first pid so it doesn't do anything. I don't know why it crashes.

Update: this command sh -c ray develop, is not actually valid I think 🤔 . It should be sh -c "ray develop", but I'm not sure where it comes from.

tonka3000 commented 3 months ago

@klmz Can you post the log file here. Typically the extension choose the first process.

The process should be called Raycast Helper (Extensions) 736 0,0 0,7 410092032 182720 ?? S 9:25pm 0:11.52 Raycast Helper (Extensions)

tonka3000 commented 3 months ago

Not quite sure if this is a nodejs debugger issue in VSCode. I tried the attach directly in launch.json and it still does not work. Maybe nodejs debugger of vscode is broken.