Coder Social home page Coder Social logo

vscode-node-debug2's Introduction

Important note: By default, this extension now delegates to the new js-debug extension which is built-in to VS Code. Please file issues on that repo. To revert to the old behavior, you can set "debug.javascript.usePreview": false in your settings.


Node Debug

Build Status

This extension is bundled with Visual Studio Code and together with Node Debug (legacy) forms the Node.js debugging experience.

Node Debug is the debugger for Node.js versions >= 8.0.

See a general overview of debugging in VS Code here.

Documentation for Node.js specific debugging can be found here.

Please submit bugs and feature requests to the VS Code repository.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.

vscode-node-debug2's People

Contributors

bzoz avatar connor4312 avatar danyeh avatar dbaeumer avatar digeff avatar ericcornelson avatar igelbox avatar isidorn avatar janbaltus avatar kieferrm avatar mrcrane avatar msft-cwells avatar msftgits avatar nickolasclarke avatar rianadon avatar roblourens avatar sandy081 avatar shenniey avatar sindresvendby avatar torn4dom4n avatar weinand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-node-debug2's Issues

Spawning Node with bad args - surface the actual error message

After calling cp.spawn for an old version of Node with the --inspect argument, the process sends 'exit' and 'close' but no 'error' or stdout/stderr. What's the best way to get more info and show a helpful error message?

Important so people don't have a confusing experience when they run with an old Node version.

Debugger doesn't *actually* support 6.3.0?

Testing microsoft/vscode#12600

Contrary to v6.3.0 release notes... https://nodejs.org/en/blog/release/v6.3.0/

With Node v6.3.0 (32-bit) on Windows, VSCode attempts to run:
node --inspect=13471 --debug-brk --nolazy server.js

Expected: debugger attaches successfully

Instead prints gobligook message to debug console
`Cannot connect to runtime process, timeout after 10000 ms - (reason: Response from the target seems invalid: [ { "description": "node.js instance", "devtoolsFrontendUrl": "https://chrome-devtools-frontend.appspot.com/serve_file/@521e5b7e2b7cc66b4006a8a54cb9c4e57494a5ef/inspector.html?experiments=true&v8only=true&ws=localhost:13471/node", "faviconUrl": "https://nodejs.org/static/favicon.ico", "id": "1468", "title": "C:\Program Files\nodejs\node.exe", "type": "node", "webSocketDebuggerUrl":```

debugger not disconnecting

  • have an app and config as shown below
  • run the app (without any breakpoint)
  • ๐Ÿ› the console keeps showing Waiting for the debugger to disconnect...

sep-27-2016 12-11-26

console.log(process.version, process.argv);

class Data {

}

const map = new Map();

let c = 0;
while (c++ < 1000) {
    map.set(new Data(), Math.ceil(Math.random() * 10000).toString(17));
}

console.log(map.size);

for (const entry of map) {
    console.log(entry);
}

console.log('disconnect');
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "node2",
            "request": "launch",
            "program": "${workspaceRoot}/app.js",
            "stopOnEntry": false,
            "args": [],
            "cwd": "${workspaceRoot}",
            "preLaunchTask": null,
            "runtimeExecutable": null,
            "runtimeArgs": [
                "--nolazy"
            ],
            "env": {
                "NODE_ENV": "development"
            },
            "console": "internalConsole",
            "sourceMaps": false,
            "outFiles": []
        },
        {
            "name": "Attach",
            "type": "node",
            "request": "attach",
            "port": 5858,
            "address": "localhost",
            "restart": false,
            "sourceMaps": false,
            "outFiles": [],
            "localRoot": "${workspaceRoot}",
            "remoteRoot": null
        },
        {
            "name": "Attach to Process",
            "type": "node",
            "request": "attach",
            "processId": "${command.PickProcess}",
            "port": 5858,
            "sourceMaps": false,
            "outFiles": []
        }
    ]
}

Occasional debug fails to start w/o message on Windows w/ Node v6.6.0 (32-bit)

Testing microsoft/vscode#12600
Occasionally, debugging fails to launch w/o much indication as to why.

F5 to launch, debug bar flashes, then quickly disappars as the following message is printed to the debug console:

node --inspect=6952 --debug-brk --nolazy server.js 
Debugger listening on port 6952.
Warning: This is an experimental feature and could change at any time.

will update w/ better repro steps if available, but might be good to add some better logging to account for issues like this in the future

Occasional `[node-debug2] read ECONNRESET` on Windows w/ Node v6.6.0 (32-bit)

Testing microsoft/vscode#12600

Running against Node v6.6.0 (32-bit), after launching the debugger successfully several times in a row, saw this error in the infobar:
[node-debug2] read ECONNRESET

And this error to the debug console:

node --inspect=28101 --debug-brk --nolazy server.js 
Debugger listening on port 28101.
Warning: This is an experimental feature and could change at any time.
******** Error in DebugAdapter - Unhandled promise rejection: Error: read ECONNRESET
    at exports._errnoException (util.js:1026:11)

Will provide further details if I manage to come up with a better repro

Gap Analysis: chrome-debug vs. node-debug

Goal: Find out what is needed to use the 'Debugger for Chrome' extension as a replacement for 'Node Debug'.

Installation of node 7.0:

    npm install -g node-nightly
    node-nightly --version

Install experimental CDP extension:

    git clone https://github.com/Microsoft/vscode-node-cdp-debug
    cd vscode-node-cdp-debug
    npm install
    code .

Run node 7.0 in 'inspect' mode:

    node-nightly --inspect index.js

Findings:

Node CDP Debug tasks

P0

P1

P2

Engineering

  • Get existing Node tests working against this debug adapter
  • Do a pass for error messages and failure modes that are handled in node-debug but not here
  • Launch error experience - #14
  • Cleanup properly after running in server mode - microsoft/vscode-chrome-debug-core#95
  • Switch to ES6 output - microsoft/vscode-chrome-debug-core#100
  • List in the marketplace (as a built-in)
  • Include in the code-insiders build

Later

No suggestions for nested properties

Testing microsoft/vscode/issues/14340

Have the following code snippet and invoke intelisense on
range.child.grandhcild. -> no suggestions

var range = {

    startLineNumber: 7,

    endLineNumber: 8,
    startColumn: 123,
    text: "lineContext.getTokenEndIndex(tokenIndex) + 1",
    te: "11",
    te6: "11",
    // te7: myLongString,
    child: {
        aunt: {

            grandchild: {
                lala: 'adasd',
                evenMore: 'alskdjlaksd',
                t3: 'asdlkasdjlkasdjlkasdjlkads',
                t5: 'asddasdasadsadsadsads',
                t7: 'asdasdadsadsadsasdasdasdads',
                t9: 'asddasadsads',
                i: 1123,
                j: 12121
            }
        }
    }
}

Breakpoints not resolving properly in attach configuration on Windows

Testing microsoft/vscode#12600

Node v6.6.0 (32-bit), Windows

/* app.js */
var screenName = 'hello';
var sc = ""; // set breakpoint
setTimeout(function() {
    console.log('done');
    a(screenName);

    process.exit(); // set breakpoint
},1000)

function a(screenName) {
    console.log(screenName); // set breakpoint
}

From cmd line: node --inspect --debug-brk app.js, then run attach debug configuration

image

Remaining tasks

Feature request: Support sourcemap updates when live-editing files

In our react-native debugger (uses the node debugger internally) one scenario we require is being able to edit the sourcecode and have it take effect almost immediately. We currently handle the source code changes just fine, but updating source maps requires additional work. Currently we have some invasive logic to manually clear the source map cache of the debugger, but it'd be great if the debugger itself could somehow notice that the sourcemap file has been updated.

Hovering over argument with same name as outer variable produces nothing

Testing microsoft/vscode#12600

Using the following code and a breakpoint at the location specified location

var screenName = 'hello';

setTimeout(function() {
    console.log('done');
    a(screenName);

    process.exit();
},1000)

function a(screenName) {
    console.log(screenName); // SET BREAKPOINT HERE
}

hovering over screenName at this position should produce the string "hello", instead, no hover appears. Changing the name of the argument resolves the issue.

Debug launch should gracefully fail on older versions of Node

Testing microsoft/vscode#12600

Node v6.2.1 x64 on Windows attempts to run:
node --inspect=13471 --debug-brk --nolazy server.js

Expected: helpful and actionable error message about an unsupported version

Actual: debug fails with following cryptic message to debug console

node --inspect=9286 --debug-brk --nolazy server.js 
node: bad option: --inspect=9286

Occasional debug timeout issue during attach to process

Testing microsoft/vscode#12600

Node v6.6.0 (32-bit), Windows

Infobar:
Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: 404 - Not Found. The requested location could not be found.).

From command line:

C:\src\node-interactive\hello-world>node --inspect --debug-brk app.js
Debugger listening on port 9229.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
    chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=localhost:9229/node
C:\Program Files\nodejs\node.exe: src\inspector_socket.cc:553: Assertion `(inspector->http_parsing_state) == (nullptr)' failed.

Verbose logs: vscode-node-debug2.txt

stderr output appears twice

Quick brain dump -

We get messages from the runtime via Console.messageAdded. We also listen to stderr, because there are some messages that only come via that channel, from the Node process itself. Those are important to get. But console.error and some others come via both.

For now, we'll just only show messages from stdout/err, same as node-debug. In theory it would be better to use messageAdded because we can do a better job with logging objects or format messages in different ways. But actually, that is probably not that useful at the moment because of microsoft/vscode-node-debug/issues/4. I'll need to leave this up to the consumer to implement or add a switch to disable.

And also, onConsoleMessage is deprecated and we will need to use Runtime.consoleAPICalled which should be easy.

VSCode automatically saves file while debugging using nodemon

Testing microsoft/vscode#14341

Launch config:

    {
            "name": "Attach nodemon",
            "type": "node",
            "request": "attach",
            "port": 9229,
            "verboseDiagnosticLogging": true,
            "restart": true
        }

In cmd prompt, run: nodemon --debug-brk --inspect server.js, and then attach vscode devbugger

Try editing server.js while app is running. Even though autosave is off, the editor will automatically save the file, which triggers a nodemon restart, debugger reattach, and makes it virtually impossible to edit the code in any substantive way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.