From a08b6e8c009218b1376698567dc45185f331f65c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Roveg=C3=A5rd?= Date: Sun, 22 Oct 2017 20:10:22 +0200 Subject: [PATCH] Release 0.6.0 Adding documentation about debugging with VSCode --- CHANGELOG.md | 3 ++- README.md | 17 +++++++++++++++-- docs/README.md | 4 ++++ docs/VSCode.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 docs/VSCode.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d8b779..5798209 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 0.6.0 (2017-10-22) * Lift requirement that a script path must be absolute - support relative paths as well (though relative source maps won't work). @@ -8,6 +8,7 @@ as a console log message. * Handle GC better during code evaluation (issue #62) * Initial support for building with Java 9 (issue #67) +* Support debugging in Visual Studio Code. ## 0.5.6 (2017-09-15) diff --git a/README.md b/README.md index 5d911fb..511c90c 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,15 @@ [![Build Status](https://travis-ci.org/provegard/ncdbg.svg?branch=master)](https://travis-ci.org/provegard/ncdbg) NCDbg is a debugger for Nashorn (the JavaScript engine in Java 8 and onward) that -uses Google Chrome DevTools as frontend. +uses Google Chrome DevTools or [Visual Studio Code](https://code.visualstudio.com/) (VSCode) as frontend. NCDbg is an abbreviation of Nashorn Chrome Debugger. I chose that name because of -my profound lack of imagination when it comes to naming things. +my profound lack of imagination when it comes to naming things. Since VSCode can act as a +debugger frontend as well (since 0.6.0), there is a great need for a better name. Suggestions +are welcome! + +Both Java 8 and Java 9 are supported. Please see [the documentation](docs/README.md) for information +about Java 9. ## Building & running tests @@ -31,6 +36,10 @@ See *build.gradle* for details. Documentation can be found in the _docs_ folder. +### Visual Studio Code + +VSCode has a [separate documentation](docs/VSCode.md). + ## Contributing Pull requests are welcome! However, before creating a pull request, please open an issue to describe @@ -38,6 +47,10 @@ the missing/limited/faulty behavior that you intend to fix, along with a solutio In the absence of a proper style guide, please follow the style of existing code. +## Changelog + +Please see CHANGELOG.md. + ## License The code in this repository is licensed under the MIT license. See the *LICENCE* file diff --git a/docs/README.md b/docs/README.md index 03f1a46..3a74a8d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -57,6 +57,10 @@ take a look at the scripts, set breakpoints etc.! Note that the Developer Tools console can only be used when the debugger is paused in a breakpoint. +### Visual Studio Code + +VSCode has a [separate documentation](VSCode.md). + ## Configuring Options Running with `--help` shows all available options. diff --git a/docs/VSCode.md b/docs/VSCode.md new file mode 100644 index 0000000..7c670d9 --- /dev/null +++ b/docs/VSCode.md @@ -0,0 +1,48 @@ +# Visual Studio Code + +Since version 0.6.0, Visual Studio Code (VSCode) can act as a debugger frontend in addition to +Google Chrome. + +To use VSCode, please follow the steps below. + +## Start NCDbg + +Start NCDbg as usual. No special configuration is needed. + +## Install Debugger for Chrome + +To be able to connect to NCDbg, a Microsoft-provided extension called Debugger for Chrome +is needed. Go to the _View_ menu in VSCode and select _Extensions_. Search for and install +Debugger for Chrome. Follow the instructions to restart. + +## Open a workspace in VSCode + +VSCode tries to map scripts exposed by NCDbg to workspace scripts, so if your scripts reside +in an existing workspace, it's a good idea to open that. In particular, you will need to add +an entry in _launch.json_. + +## Modify launch.json + +Open _launch.json_ and add the following configuration entry (in the `configurations` array): + + + { + "type": "chrome", + "request": "attach", + "name": "Attach to NCDbg", + "address": "localhost", + "port": 7778, + "webRoot": "${workspaceRoot}" + } + +Adjust the host name and port accordingly. For VSCode to be able to map a script with a relative +path to a workspace script, the `webRoot` property should be set to the "base location" of +relative script paths. + +## Start debugging + +Finally switch to the Debug view, select "Attach to NCDbg" in the configurations dropdown and +click the green run arrow. If the configuration in _launch.json_ is correct, you should now be +connected. + +All loaded scripts should appear under the "Loaded Scripts" pane.