From 9b9d0f78087d2d6ce1fae4576cad0006363491a6 Mon Sep 17 00:00:00 2001 From: Dario Ceccoli Date: Tue, 27 Aug 2019 07:59:45 +0100 Subject: [PATCH 1/2] add react-native debugger using vscode extension --- dap-react-native.el | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 dap-react-native.el diff --git a/dap-react-native.el b/dap-react-native.el new file mode 100644 index 00000000..0fe9b6ce --- /dev/null +++ b/dap-react-native.el @@ -0,0 +1,67 @@ +;;; dap-react-native.el --- Debug Adapter Protocol mode for React Native -*- lexical-binding: t; -*- + +;; Copyright (C) 2019 Dario Ceccoli + +;; Author: Dario Ceccoli +;; 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 . + +;; URL: https://github.com/yyoncho/dap-mode +;; Package-Requires: ((emacs "25.1") (dash "2.14.1") (lsp-mode "4.0")) +;; Version: 0.2 + +;;; Commentary: +;; Adapter for https://github.com/microsoft/vscode-react-native + +;;; Code: + +(require 'dap-mode) +(require 'dap-utils) + +(defcustom dap-react-native-debug-path (expand-file-name "vscode/msjsdiag.vscode-react-native" + dap-utils-extension-path) + "The path to React Native Tools vscode extension." + :group 'dap-react-native + :type 'string) + +(defcustom dap-react-native-debug-program `("node" + ,"--inspect-brk" + ,(f-join dap-react-native-debug-path "extension/src/debugger/reactNativeDebugEntryPoint.js")) + "The path to the React Native debugger." + :group 'dap-react-native + :type '(repeat string)) + +(dap-utils-vscode-setup-function "dap-react-native" "msjsdiag" "vscode-react-native" + dap-react-native-debug-path) + +(defun dap-react-native--populate-start-file-args (conf) + "Populate CONF with the required arguments." + (-> conf + (dap--put-if-absent :dap-server-path dap-react-native-debug-program) + (dap--put-if-absent :type "react-native") + (dap--put-if-absent :cwd default-directory) + (dap--put-if-absent :name "React Native Attach"))) + +(dap-register-debug-provider "react-native" #'dap-react-native--populate-start-file-args) + +(dap-register-debug-template "React Native Attach" + (list :type "react-native" + :cwd nil + :request "attach" + :reAttach t + :name "React Native Attach")) + +(provide 'dap-react-native) +;;; dap-react-native.el ends here From 7d3c7bff9148176d3501008402e8dce6615a397d Mon Sep 17 00:00:00 2001 From: Dario Ceccoli Date: Thu, 29 Aug 2019 08:45:46 +0100 Subject: [PATCH 2/2] remove inspect on debug-program --- dap-react-native.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dap-react-native.el b/dap-react-native.el index 0fe9b6ce..7d2659b7 100644 --- a/dap-react-native.el +++ b/dap-react-native.el @@ -36,8 +36,7 @@ :group 'dap-react-native :type 'string) -(defcustom dap-react-native-debug-program `("node" - ,"--inspect-brk" +(defcustom dap-react-native-debug-program `("node" ,(f-join dap-react-native-debug-path "extension/src/debugger/reactNativeDebugEntryPoint.js")) "The path to the React Native debugger." :group 'dap-react-native