denoland / vscode_deno

Visual Studio Code plugin for Deno
https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno
MIT License
1.47k stars 141 forks source link

The debug console does not produce any output when the program ends in a short time. #613

Closed YouXam closed 2 years ago

YouXam commented 2 years ago

Describe the bug

When the program ends in a short time (about 1 second), the debug console has no output.

To Reproduce

Run the following program(press f5).

// main.ts
console.log("test")

Expected behavior

The debug console outputs the following:

C:\Users\Lenovo\.deno\bin\deno.EXE run --inspect --allow-all .\main.ts
test

Then the debugging ends immediately

Current behavior

Debug console has no output, and the debugging ends after about 10 seconds.

Screenshot at the beginning of debugging Screenshot at the beginning of debugging

Possible reasons

When debugging is finally finished (no output), the OUTPUT panel outputs the following:

[2022-01-22 18:06:25.200] [renderer1] [error] [Extension Host] Error: Could not connect to debug target at http://127.0.0.1:9229: Could not find any debuggable target
    at Object.retryGetNodeEndpoint (c:\Users\Lenovo\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:2:1398832)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async t (c:\Users\Lenovo\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:2:1433734)
    at async x.launch (c:\Users\Lenovo\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:2:1438435)
    at async t.Binder.captureLaunch (c:\Users\Lenovo\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:2:1230057)
    at async t.Binder._launch (c:\Users\Lenovo\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:2:1229602)
    at async Promise.all (index 3)
    at async t.Binder._boot (c:\Users\Lenovo\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:2:1228654)
    at async t.default._onMessage (c:\Users\Lenovo\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:2:1321495)

It seems that the extension did not connect to the debugger server because the program ended immediately.

When the program runs for a long time, it can be output normally.

setTimeout(() => console.log('test'), 1000)

My launch.json(default)

{
    "version": "0.2.0",
    "configurations": [
        {
            "request": "launch",
            "name": "Launch Program",
            "type": "pwa-node",
            "program": "${workspaceFolder}/main.ts",
            "cwd": "${workspaceFolder}",
            "runtimeExecutable": "C:\\Users\\Lenovo\\.deno\\bin\\deno.EXE",
            "runtimeArgs": [
                "run",
                "--inspect",
                "--allow-all"
            ],
            "attachSimplePort": 9229
        }
    ]
}

Versions

vscode: 1.63.2(user setup) deno: 1.18.0 (release, x86_64-pc-windows-msvc) extension: v3.10.1

kitsonk commented 2 years ago

Duplicate of #557