chrome debugger

This commit is contained in:
Ben Jackson 2019-10-06 19:35:22 +01:00
commit 52b0ee9d49
6 changed files with 104 additions and 1 deletions

View file

@ -88,6 +88,7 @@ on a best-efforts basis:
- C# (c-sharp) using dotnet core
- Go (requires separate installation of [Delve][])
- Node.js (requires node <12 for installation)
- Anything running in chrome (i.e. javascript).
## Languages known not to work
@ -162,6 +163,7 @@ The debug adapters themselves have certain runtime dependencies:
| C# (mono) | Experimental | `--force-enable-csharp` | vscode-mono-debug | Mono |
| Go | Experimental | `--enable-go` | vscode-go | Go, [Delve][] |
| Node.js | Experimental | `--force-enable-node` | vscode-node-debug2 | 6 < Node < 12, Npm |
| Javascript | Experimental | `--force-enable-chrome` | debugger-for-chrome | Chrome |
For other languages, you'll need some other way to install the gadget.
@ -615,9 +617,9 @@ Requires:
* For installation, a Node.js environemt that is < node 12. I believe this is an
incompatibility with gulp. Advice, use [nvm][] with `nvm install --lts 10; nvm
use --lts 10; ./install_gadget.py --force-enable-node ...`
* Options described here:
https://code.visualstudio.com/docs/nodejs/nodejs-debugging
* Example: `support/test/node/simple`
```json
{
@ -637,6 +639,31 @@ Requires:
}
```
* Chrome
This uses the chrome debugger, see
https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome.
It allows you to debug scripts running inside chrome from within Vim.
* `./install_gadget.py --force-enable-chrome`
* Example: `support/test/chrome`
```json
{
"configurations": {
"launch": {
"adapter": "chrome",
"configuration": {
"request": "launch",
"url": "http://localhost:1234/",
"webRoot": "${workspaceRoot}/www"
}
}
}
}
```
Also the mock debugger, but that isn't actually useful.
## Partially supported

View file

@ -225,6 +225,32 @@ GADGETS = {
},
},
},
'debugger-for-chrome': {
'language': 'typescript',
'enabled': False,
'download': {
'url': 'https://marketplace.visualstudio.com/_apis/public/gallery/'
'publishers/msjsdiag/vsextensions/'
'debugger-for-chrome/${version}/vspackage',
'target': 'msjsdiag.debugger-for-chrome-4.12.0.tar.gz',
'format': 'tar',
},
'all': {
'version': '4.12.0',
'file_name': 'msjsdiag.debugger-for-chrome-4.12.0.vsix',
'checksum': ''
},
'adapters': {
'chrome': {
'name': 'debugger-for-chrome',
'type': 'chrome',
'command': [
'node',
'${gadgetDir}/debugger-for-chrome/out/src/chromeDebug.js'
],
},
},
},
}

View file

@ -0,0 +1,5 @@
{
"plugins": {
"browser": {}
}
}

View file

@ -0,0 +1,12 @@
{
"configurations": {
"launch": {
"adapter": "chrome",
"configuration": {
"request": "launch",
"url": "http://localhost:1234/",
"webRoot": "${workspaceRoot}/www"
}
}
}
}

View file

@ -0,0 +1,24 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<h1>Hello, world!</h1>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="js/test.js" type="text/javascript"></script>
</body>
</html>

View file

@ -0,0 +1,9 @@
$( document ).ready( function() {
var getMessage = function() {
var msg = 'this is ';
msg += 'a test';
return msg;
};
alert( 'test: ' + getMessage() );
} );