Ts-node: Lost debug context with latest vs code(1.31.1)

Created on 13 Feb 2019  路  2Comments  路  Source: TypeStrong/ts-node

When I use ts-node to debug my program, breakpoints can still paused the program,but that line are not highlighted and the variable and watch side menu is empty.
I Just tried compile ts file to js and debug it with source map,it worked.
Here is my vs code launch config

        {
            // worked
            "type": "node",
            "request": "launch",
            "name": "Launch compiled",
            "outFiles": ["${workspaceRoot}/dist/**/*.js"],
            "program": "${workspaceFolder}/a.ts",
            "runtimeArgs": ["--nolazy"],
            "sourceMaps": true
        },
        {
            // doesn't work
            "type": "node",
            "request": "launch",
            "name": "Launch TS",
            "runtimeArgs": [
                "-r",
                "ts-node/register"],          
            "args": [
                "${workspaceFolder}/a.ts"
            ],

            "cwd": "${workspaceFolder}",
            "protocol": "inspector",
            "sourceMaps": true
        },

image

Most helpful comment

Seems to be related to https://github.com/Microsoft/vscode/issues/68616 issue. Try disabling smartStep:

{
            // doesn't work
            "type": "node",
            "request": "launch",
            "name": "Launch TS",
            "runtimeArgs": [
                "-r",
                "ts-node/register"],          
            "args": [
                "${workspaceFolder}/a.ts"
            ],

            "cwd": "${workspaceFolder}",
            "protocol": "inspector",
            "sourceMaps": true,
            "smartStep": false,
        },

All 2 comments

Seems to be related to https://github.com/Microsoft/vscode/issues/68616 issue. Try disabling smartStep:

{
            // doesn't work
            "type": "node",
            "request": "launch",
            "name": "Launch TS",
            "runtimeArgs": [
                "-r",
                "ts-node/register"],          
            "args": [
                "${workspaceFolder}/a.ts"
            ],

            "cwd": "${workspaceFolder}",
            "protocol": "inspector",
            "sourceMaps": true,
            "smartStep": false,
        },

Closing because it looks like the suggestion to disable smartStep has solved the problem. If you have debugger issues, please feel free to comment here, open a new issue, or ask for advice on the TypeScript Community Discord.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Borewit picture Borewit  路  3Comments

mattdell picture mattdell  路  4Comments

KiaraGrouwstra picture KiaraGrouwstra  路  3Comments

OliverJAsh picture OliverJAsh  路  3Comments

sodiumjoe picture sodiumjoe  路  4Comments