From ab6e103983228fdb94a316461ba7f072c534b116 Mon Sep 17 00:00:00 2001 From: enyaxu <40362568+enyaxu@users.noreply.github.com> Date: Sun, 12 Aug 2018 16:08:48 +0800 Subject: [PATCH] feature: vscode debug config support (#446) * feature: vscode debug config support * improment vscode debug settings --- .vscode/launch.json | 35 +++++++++++++++++++++++++++++++++++ src/main/app.js | 5 +++++ 2 files changed, 40 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..71e2acba --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,35 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Marktext: Main", + "program": "${workspaceFolder}/.electron-vue/dev-runner.js", + "windows": { + "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd" + } + }, + { + "name": "Marktext: Renderer", + "type": "chrome", + "request": "attach", + "port": 8315, + "webRoot": "${workspaceFolder}/src", + "timeout": 30000, + "urlFilter": "localhost:*" + } + ], + "compounds": [ + { + "name": "Marktext: All", + "configurations": [ + "Marktext: Main", + "Marktext: Renderer" + ] + } + ] +} \ No newline at end of file diff --git a/src/main/app.js b/src/main/app.js index 32a37fe7..f7ed4e79 100644 --- a/src/main/app.js +++ b/src/main/app.js @@ -16,6 +16,11 @@ class App { app.commandLine.appendSwitch('enable-experimental-web-platform-features', 'true') } + // Enable vscode chrome extension debugger connection + if (process.env.NODE_ENV === 'development') { + app.commandLine.appendSwitch('remote-debugging-port', '8315') + } + app.on('open-file', this.openFile.bind(this)) app.on('ready', this.ready.bind(this))