Skip to content

Commit

Permalink
Release 0.6.0
Browse files Browse the repository at this point in the history
Adding documentation about debugging with VSCode
  • Loading branch information
provegard committed Oct 22, 2017
1 parent 2530692 commit a08b6e8
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# 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).
* Intercept calls to Nashorn's `print` extension and send the printed message to DevTools
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)

Expand Down
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -31,13 +36,21 @@ 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
the missing/limited/faulty behavior that you intend to fix, along with a solution proposal.

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
Expand Down
4 changes: 4 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
48 changes: 48 additions & 0 deletions docs/VSCode.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit a08b6e8

Please sign in to comment.