-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial integration of the new node js debugger (#733)
* Initial integration of the new node js debugger * Added automatic download
- Loading branch information
Showing
24 changed files
with
201 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
;;; dap-js.el --- Debug Adapter Protocol mode for Node -*- lexical-binding: t; -*- | ||
|
||
;; Copyright (C) Ivan Yonchovski | ||
|
||
;; Author: Ivan Yonchovski <[email protected]> | ||
;; Keywords: languages | ||
|
||
;; This program is free software; you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
;; the Free Software Foundation, either version 3 of the License, or | ||
;; (at your option) any later version. | ||
|
||
;; This program is distributed in the hope that it will be useful, | ||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
;; GNU General Public License for more details. | ||
|
||
;; You should have received a copy of the GNU General Public License | ||
;; along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
;; URL: https://github.com/emacs-lsp/dap-mode | ||
;; Package-Requires: ((emacs "25.1") (dash "2.14.1") (lsp-mode "4.0")) | ||
;; Version: 0.2 | ||
|
||
;;; Code: | ||
|
||
(require 'dap-mode) | ||
(require 'dap-utils) | ||
|
||
(defcustom dap-js-path (expand-file-name "js-debug" dap-utils-extension-path) | ||
"The path to the place at which the webfreak.debug extension. | ||
Link: https://marketplace.visualstudio.com/items?itemName=webfreak.debug ." | ||
:group 'dap-js | ||
:type 'string) | ||
|
||
(defcustom dap-js-debug-program `("node" ,(f-join dap-js-path "src" "dapDebugServer.js")) | ||
"The path to the JS debugger." | ||
:group 'dap-js | ||
:type '(repeat string)) | ||
|
||
(defun dap-js-setup (&optional forced) | ||
"Downloading webfreak.debug to path specified. | ||
With prefix, FORCED to redownload the extension." | ||
(interactive "P") | ||
(unless (and (not forced) (file-exists-p dap-js-path)) | ||
(lsp-download-install | ||
(lambda (&rest _) (lsp--info "Downloaded extension!")) | ||
(lambda (error) (lsp--error "Failed Downloaded extension %s!" error)) | ||
:url (lsp--find-latest-gh-release-url | ||
"https://api.github.com/repos/microsoft/vscode-js-debug/releases/latest" | ||
"js-debug-dap") | ||
:store-path dap-js-path | ||
:decompress :targz))) | ||
|
||
(defun dap-js--populate-start-file-args (conf) | ||
"Populate CONF with the required arguments." | ||
(let ((port (dap--find-available-port))) | ||
(-> conf | ||
(append | ||
(list :debugServer port | ||
:host "localhost" | ||
:type "pwa-node" | ||
:program-to-start (concat (s-join " " dap-js-debug-program) | ||
" " | ||
(number-to-string port)))) | ||
(dap--put-if-absent :cwd default-directory) | ||
(dap--put-if-absent :name "Node Debug")))) | ||
|
||
(dap-register-debug-provider "pwa-node" #'dap-js--populate-start-file-args) | ||
|
||
(dap-register-debug-template | ||
"Node Run Configuration (new)" | ||
(list :type "pwa-node" | ||
:cwd nil | ||
:request "launch" | ||
:program nil | ||
:name "Node::Run")) | ||
|
||
(provide 'dap-js) | ||
;;; dap-js.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.