├── .github ├── dependabot.yml └── workflows │ ├── docs.yml │ └── test.yml ├── .gitignore ├── CHANGELOG.org ├── CODE_OF_CONDUCT.md ├── Eask ├── LICENSE ├── Makefile ├── README.org ├── dap-chrome.el ├── dap-codelldb.el ├── dap-cpptools.el ├── dap-dlv-go.el ├── dap-docker.el ├── dap-edge.el ├── dap-elixir.el ├── dap-erlang.el ├── dap-firefox.el ├── dap-gdb-lldb.el ├── dap-gdb.el ├── dap-gdscript.el ├── dap-go.el ├── dap-hydra.el ├── dap-js.el ├── dap-julia.el ├── dap-kotlin.el ├── dap-launch.el ├── dap-lldb.el ├── dap-magik.el ├── dap-mode.el ├── dap-mouse.el ├── dap-netcore.el ├── dap-node.el ├── dap-ocaml.el ├── dap-overlays.el ├── dap-php.el ├── dap-pwsh.el ├── dap-python.el ├── dap-ruby.el ├── dap-swi-prolog.el ├── dap-tasks.el ├── dap-ui.el ├── dap-unity.el ├── dap-utils.el ├── dap-variables.el ├── docs ├── page │ ├── adding-debug-server.md │ ├── clojure.md │ ├── configuration.md │ ├── features.md │ ├── gallery.md │ ├── how-to.md │ └── python-poetry-pyenv.md └── stylesheets │ └── extra.css ├── features ├── BreakpointUI.feature ├── Breakpoints.feature ├── BreakpointsMultipleFilesUI.feature ├── BreakpointsTwoFiles.feature ├── DebugRun.feature ├── Eval.feature ├── JUnit.feature ├── LocalVariables.feature ├── MultiProject.feature ├── MultiSession.feature ├── MultiThreads.feature ├── StackFrames.feature ├── SwitchSession.feature ├── TODO.org ├── Threads.feature ├── fixtures │ └── test-project │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── temp │ │ │ └── App.java │ │ └── test │ │ └── java │ │ └── temp │ │ └── AppTest.java ├── step-definitions │ └── dap-java-steps.el └── support │ └── env.el ├── icons ├── eclipse │ ├── collapsed.png │ ├── expanded.png │ ├── inspect.png │ ├── project-running.png │ ├── project-stopped.png │ ├── scope.png │ ├── stack-frame-running.png │ ├── stack-frame-stopped.png │ ├── thread-running.png │ ├── thread-stopped.png │ └── variable.png └── vscode │ ├── close-all.png │ ├── continue-disabled.png │ ├── continue.png │ ├── disconnect-disabled.png │ ├── disconnect.png │ ├── pause-disabled.png │ ├── pause.png │ ├── restart-disabled.png │ ├── restart.png │ ├── reverse-continue.png │ ├── start.png │ ├── step-back.png │ ├── step-into-disabled.png │ ├── step-into.png │ ├── step-out-disabled.png │ ├── step-out.png │ ├── step-over-disabled.png │ ├── step-over.png │ ├── stop-disabled.png │ ├── stop.png │ └── toggle-breakpoints.png ├── mkdocs.yml ├── screenshots ├── MultiSession.png ├── Swift.png ├── cider.png ├── dap-ui-repl.png ├── debug.png ├── erlang.png ├── flutter-debug.gif ├── go.png ├── implementations.png ├── javascript.png ├── logo.png ├── rust.png └── swi-prolog.png └── test └── dap-test.el /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: / 5 | schedule: 6 | interval: daily 7 | -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: Docs 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v4 14 | 15 | - name: README.org -> README.md 16 | uses: docker://pandoc/core:2.9 17 | with: 18 | args: -s README.org -t gfm -o docs/README.md 19 | 20 | - name: CHANGELOG.org -> CHANGELOG.md 21 | uses: docker://pandoc/core:2.9 22 | with: 23 | args: -s CHANGELOG.org -t gfm -o docs/CHANGELOG.md 24 | 25 | - name: MkDocs 26 | run: | 27 | cp -rf screenshots docs 28 | 29 | docker login docker.pkg.github.com --username $GITHUB_ACTOR --password ${{ secrets.GITHUB_TOKEN }} 30 | docker run --rm -v ${PWD}:/docs docker.pkg.github.com/emacs-lsp/docs-image/docs-image -- build 31 | 32 | - name: Deploy 33 | uses: peaceiris/actions-gh-pages@v3 34 | with: 35 | github_token: ${{ secrets.GITHUB_TOKEN }} 36 | publish_dir: ./site 37 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | test: 7 | runs-on: ${{ matrix.os }} 8 | continue-on-error: ${{ matrix.experimental }} 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | os: [ubuntu-latest, macos-latest, windows-latest] 13 | emacs-version: 14 | - 28.2 15 | - 29.4 16 | - 30.1 17 | experimental: [false] 18 | include: 19 | - os: ubuntu-latest 20 | emacs-version: snapshot 21 | experimental: true 22 | - os: macos-latest 23 | emacs-version: snapshot 24 | experimental: true 25 | - os: windows-latest 26 | emacs-version: snapshot 27 | experimental: true 28 | 29 | steps: 30 | - uses: actions/checkout@v4 31 | 32 | - uses: jcs090218/setup-emacs@master 33 | with: 34 | version: ${{ matrix.emacs-version }} 35 | 36 | - uses: emacs-eask/setup-eask@master 37 | with: 38 | version: 'snapshot' 39 | 40 | - name: Run tests 41 | run: make ci 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .eask 2 | /dist 3 | *.elc 4 | .classpath 5 | .project 6 | .settings 7 | target 8 | /dap-autoloads.el 9 | /ert-profile 10 | /ert-profile~ 11 | -------------------------------------------------------------------------------- /CHANGELOG.org: -------------------------------------------------------------------------------- 1 | # -*- fill-column: 100 -*- 2 | #+STARTUP: content 3 | 4 | * Changelog 5 | ** Unreleased 0.9 6 | - Added ~dap-gdb~ 7 | - Added ~dap-julia~ 8 | ** 0.8 9 | - [Breaking Change] Change debug provider names to match VS Code's naming: ~lldb~ to ~lldb-mi~ and ~codelldb~ to ~lldb~ 10 | - Added ~dap-gdscript~ 11 | - Drop support for emacs 26.x 12 | ** 0.7 13 | - [Breaking change] For ~dap-lldb.el~, change ~type~ to ~lldb-vscode~. 14 | ** 0.5 15 | - added support for running TestNG tests 16 | - added ~dap-auto-configure-mode~ as the new ~dap-mode~ integration point. 17 | - Migrated to ~lsp-protocol.el~. 18 | ** 0.3 19 | - Added node/go/chrome/firefox/php/ruby/elixir/go/LLDB debuggers support 20 | - Added support for mouse hover 21 | - Added automatic installation of debuggers 22 | ** 0.2 23 | - Added python support 24 | - Added ~dap-hydra~ 25 | - Added ~dap-ui-repl~ 26 | - Bug fixing. 27 | ** v0.1 28 | - Support for managing breakpoints 29 | - Next/StepIn/StepOut operations 30 | - Sessions window 31 | - Inspections 32 | - Evaluating 33 | - Breakpoint persistence and session management 34 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at yyoncho@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /Eask: -------------------------------------------------------------------------------- 1 | ;; -*- mode: eask; lexical-binding: t -*- 2 | 3 | (package "dap-mode" 4 | "0.8" 5 | "Debug Adapter Protocol mode") 6 | 7 | (website-url "https://github.com/emacs-lsp/dap-mode") 8 | (keywords "languages" "debug") 9 | 10 | (package-file "dap-mode.el") 11 | 12 | (files "*.el") 13 | 14 | (script "test" "echo \"Error: no test specified\" && exit 1") 15 | 16 | (source 'gnu) 17 | (source 'melpa) 18 | 19 | (depends-on "emacs" "28.1") 20 | (depends-on "lsp-mode") 21 | (depends-on "lsp-treemacs") 22 | (depends-on "lsp-docker") 23 | (depends-on "posframe") 24 | (depends-on "bui") 25 | (depends-on "dash") 26 | (depends-on "f") 27 | (depends-on "s") 28 | (depends-on "ht") 29 | 30 | (development 31 | (depends-on "ecukes") 32 | (depends-on "espuds") 33 | (depends-on "undercover") 34 | (depends-on "ert") 35 | (depends-on "ert-runner")) 36 | 37 | ;;(setq eask-verbosity 4) 38 | 39 | (setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432 40 | 41 | ;; NOTE: treemacs also sets treemacs-no-load-time-warnings to t in its Makefile, so I guess it's OK? 42 | (setq treemacs-no-load-time-warnings t) 43 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all build compile clean test 2 | 3 | EMACS ?= emacs 4 | EASK ?= eask 5 | 6 | # TODO: add `lint` and `checkdoc` 7 | ci: clean build compile test 8 | 9 | build: 10 | $(EASK) package 11 | $(EASK) install 12 | $(EASK) clean elc 13 | 14 | compile: 15 | @echo "Compiling..." 16 | $(EASK) compile 17 | 18 | clean: 19 | $(EASK) clean all 20 | 21 | test: 22 | @echo "Testing..." 23 | $(EASK) install-deps --dev 24 | $(EASK) exec ert-runner -L . 25 | 26 | checkdoc: 27 | @echo "Run checkdoc..." 28 | $(EASK) lint checkdoc 29 | 30 | lint: 31 | @echo "Run package-lint..." 32 | $(EASK) lint package 33 | -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | [[https://melpa.org/#/dap-mode][file:https://melpa.org/packages/dap-mode-badge.svg]] 2 | [[https://stable.melpa.org/#/dap-mode][file:https://stable.melpa.org/packages/dap-mode-badge.svg]] 3 | [[http://spacemacs.org][file:https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg]] 4 | [[https://github.com/emacs-lsp/dap-mode/actions][file:https://github.com/emacs-lsp/dap-mode/workflows/CI/badge.svg]] 5 | [[https://discord.gg/swuxy5AAgT][file:https://discordapp.com/api/guilds/789885435026604033/widget.png?style=shield]] 6 | 7 | * dap-mode 8 | ** Table of Contents :TOC_4_gh:noexport: 9 | - [[#dap-mode][dap-mode]] 10 | - [[#summary][Summary]] 11 | - [[#project-status][Project status]] 12 | - [[#usage][Usage]] 13 | - [[#docker-usage][Docker usage]] 14 | - [[#features][Features]] 15 | - [[#configuration][Configuration]] 16 | - [[#gallery][Gallery]] 17 | - [[#extending-dap-with-new-debug-servers][Extending DAP with new Debug servers]] 18 | - [[#links][Links]] 19 | - [[#acknowledgments][Acknowledgments]] 20 | 21 | ** Summary 22 | Emacs client/library for [[https://microsoft.github.io/debug-adapter-protocol/][Debug Adapter Protocol]] is a wire protocol for 23 | communication between client and Debug Server. It's similar to the [[https://github.com/Microsoft/language-server-protocol][LSP]] but 24 | provides integration with debug server. 25 | *** Project status 26 | The API considered unstable until 1.0 release is out. It is tested against 27 | Java, Python, Ruby, Elixir and LLDB (C/C++/Objective-C/Swift). 28 | ** Usage 29 | The main entry points are ~dap-debug~ and ~dap-debug-edit-template~. The first 30 | one asks for a registered debug template and starts the configuration using 31 | the default values for that particular configuration. The latter creates a 32 | debug template which could be customized before running. 33 | ~dap-debug-edit-template~ will prepare a template declaration inside a 34 | temporary buffer. You should execute this code using ~C-M-x~ for the changes to 35 | apply. You should also copy this code into your Emacs configuration if you wish to 36 | make it persistent. 37 | 38 | dap-mode also provides a [[https://github.com/abo-abo/hydra][hydra]] with ~dap-hydra~. You can automatically trigger 39 | the hydra when the program hits a breakpoint by using the following code. 40 | 41 | #+BEGIN_SRC elisp 42 | (add-hook 'dap-stopped-hook 43 | (lambda (arg) (call-interactively #'dap-hydra))) 44 | #+END_SRC 45 | 46 | *** Docker usage 47 | You can also use this tool with dockerized debug servers: configure it either with a ~.dir-locals~ file 48 | or drop an ~.lsp-docker.yml~ configuration file (use [[https://github.com/emacs-lsp/lsp-docker][lsp-docker]] for general reference). 49 | Basically you have one function ~dap-docker-register~ that performs all the heavy lifting (finding the original debug template, 50 | patching it, registering a debug provider e.t.c). This function examines a configuration file or falls back to the default configuration 51 | (which can be patched using the ~.dir-locals~ approach, take a note that the default configuration doesn't provide any sane defaults for debugging) 52 | and then operates on the combination of the two. This mechanism is the same as in ~lsp-docker~. 53 | 54 | Note: currently you cannot use this mode when using a network connection to connect to debuggers (this part is yet to be implemented). 55 | Still want to talk to debuggers over network? In order to do so you have to look at the ~launch-args~ patching 56 | done by ~dap-docker--dockerize-start-file-args~, you have to somehow assign ~nil~ to ~dap-server-path~ before it is passed further into session creation. 57 | 58 | If you want to stick to a configuration file, take a look at the example below: 59 | 60 | #+begin_src yaml 61 | lsp: 62 | server: 63 | # 'lsp-docker' fields 64 | mappings: 65 | - source: "/your/host/source/path" # used both by 'lsp-docker' and 'dap-docker' 66 | destination: "/your/local/path/inside/a/container" # used both by 'lsp-docker' and 'dap-docker' 67 | debug: 68 | type: docker # only docker is supported 69 | subtype: image # or 'container' 70 | name: # you can omit this field 71 | # in this case the 'lsp-docker' ('server' section) image name is used 72 | enabled: true # you can explicitly disable 'dap-docker' by using 'false' 73 | provider: 74 | template: 75 | launch_command: 76 | # e.g. if you have installed a debug server in a different directory, not used with 'container' subtype debuggers 77 | #+end_src 78 | 79 | 80 | ** [[https://emacs-lsp.github.io/dap-mode/page/features/][Features]] 81 | ** [[https://emacs-lsp.github.io/dap-mode/page/configuration/][Configuration]] 82 | ** [[https://emacs-lsp.github.io/dap-mode/page/gallery][Gallery]] 83 | ** [[https://emacs-lsp.github.io/dap-mode/page/adding-debug-server][Extending DAP with new Debug servers]] 84 | ** Links 85 | - [[https://code.visualstudio.com/docs/extensionAPI/api-debugging][Debug Adapter Protocol]] 86 | - [[https://github.com/emacs-lsp/lsp-java][LSP Java]] 87 | - [[https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/][Debug Adapter Protocol Server Implementations]] 88 | ** Acknowledgments 89 | - [[https://github.com/danielmartin][Daniel Martin]] - LLDB integration. 90 | - [[https://github.com/kiennq][Kien Nguyen]] - NodeJS debugger, Edge debuggers, automatic extension installation. 91 | - [[https://github.com/Ladicle][Aya Igarashi]] - Go debugger integration. 92 | - [[https://github.com/nbfalcon][Nikita Bloshchanevich]] - launch.json support (+ variable expansion), debugpy 93 | support, (with some groundwork by yyoncho) runInTerminal support, various 94 | bug fixes. 95 | - [[https://github.com/factyy][Andrei Mochalov]] - Docker (debugging in containers) integration. 96 | -------------------------------------------------------------------------------- /dap-chrome.el: -------------------------------------------------------------------------------- 1 | ;;; dap-chrome.el --- Debug Adapter Protocol mode for Chrome -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2019 Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for https://github.com/chromeide/vscode-chrome 23 | 24 | ;;; Code: 25 | 26 | (require 'dap-mode) 27 | (require 'dap-utils) 28 | 29 | (defcustom dap-chrome-debug-path (expand-file-name "vscode/msjsdiag.debugger-for-chrome" 30 | dap-utils-extension-path) 31 | "The path to chrome vscode extension." 32 | :group 'dap-chrome 33 | :type 'string) 34 | 35 | (defcustom dap-chrome-debug-program `("node" 36 | ,(f-join dap-chrome-debug-path "extension/out/src/chromeDebug.js")) 37 | "The path to the chrome debugger." 38 | :group 'dap-chrome 39 | :type '(repeat string)) 40 | 41 | (dap-utils-vscode-setup-function "dap-chrome" "msjsdiag" "debugger-for-chrome" 42 | dap-chrome-debug-path) 43 | 44 | (defun dap-chrome--populate-start-file-args (conf) 45 | "Populate CONF with the required arguments." 46 | (setq conf (-> conf 47 | (plist-put :type "chrome") 48 | (plist-put :dap-server-path dap-chrome-debug-program) 49 | (dap--put-if-absent :cwd (expand-file-name default-directory)))) 50 | (dap--plist-delete 51 | (pcase (plist-get conf :mode) 52 | ("url" (-> conf 53 | (dap--put-if-absent :url (read-string 54 | "Browse url: " 55 | "http://localhost:4200" t)) 56 | (dap--put-if-absent :webRoot (lsp-workspace-root)))) 57 | ("file" (dap--put-if-absent conf :file 58 | (read-file-name "Select the file to open in the browser:" 59 | nil (buffer-file-name) t))) 60 | (_ conf)) 61 | :mode)) 62 | 63 | (dap-register-debug-provider "chrome" #'dap-chrome--populate-start-file-args) 64 | 65 | (dap-register-debug-template "Chrome Browse File" 66 | (list :type "chrome" 67 | :mode "file" 68 | :cwd nil 69 | :request "launch" 70 | :file nil 71 | :reAttach t 72 | :name "Chrome Browse File")) 73 | 74 | (dap-register-debug-template "Chrome Browse URL" 75 | (list :type "chrome" 76 | :cwd nil 77 | :mode "url" 78 | :request "launch" 79 | :webRoot nil 80 | :url nil 81 | :name "Chrome Browse URL")) 82 | 83 | (provide 'dap-chrome) 84 | ;;; dap-chrome.el ends here 85 | -------------------------------------------------------------------------------- /dap-codelldb.el: -------------------------------------------------------------------------------- 1 | ;;; dap-codelldb.el --- Debug Adapter Protocol mode for CodeLLDB -*- lexical-binding: t; -*- 2 | 3 | ;; This program is free software; you can redistribute it and/or modify 4 | ;; it under the terms of the GNU General Public License as published by 5 | ;; the Free Software Foundation, either version 3 of the License, or 6 | ;; (at your option) any later version. 7 | 8 | ;; This program is distributed in the hope that it will be useful, 9 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | ;; GNU General Public License for more details. 12 | 13 | ;; You should have received a copy of the GNU General Public License 14 | ;; along with this program. If not, see . 15 | 16 | ;;; Commentary: 17 | ;; Adapter for https://github.com/vadimcn/vscode-lldb 18 | 19 | ;;; Code: 20 | 21 | (require 'dap-mode) 22 | (require 'dap-utils) 23 | 24 | (defcustom dap-codelldb-extension-version "1.8.1" 25 | "The version of the codelldb vscode extension." 26 | :group 'dap-codelldb 27 | :type 'string) 28 | 29 | (defcustom dap-codelldb-download-url 30 | (format "https://github.com/vadimcn/vscode-lldb/releases/download/v%s/codelldb-%s.vsix" 31 | dap-codelldb-extension-version 32 | (plist-get 33 | (list 'windows-nt 34 | (cond ((string-match "\\(?:arm\\|aarch\\).?64" system-configuration) "aarch64-windows") 35 | (t "x86_64-windows")) 36 | 'darwin 37 | (cond ((string-match "^aarch64.*" system-configuration) "aarch64-darwin") 38 | (t "x86_64-darwin")) 39 | 'gnu/linux 40 | (cond ((string-match "^aarch64.*" system-configuration) "aarch64-linux") 41 | ((string-match "^arm.*" system-configuration) "arm-linux") 42 | (t "x86_64-linux"))) 43 | system-type)) 44 | "The download url." 45 | :group 'dap-codelldb 46 | :type 'string) 47 | 48 | (defcustom dap-codelldb-debug-path (expand-file-name "vscode/codelldb" dap-utils-extension-path) 49 | "The path to go vscode extension." 50 | :group 'dap-codelldb 51 | :type 'string) 52 | 53 | (defcustom dap-codelldb-debug-program 54 | (concat dap-codelldb-debug-path 55 | (if (eq system-type 'windows-nt) 56 | "/extension/adapter/codelldb.exe" 57 | "/extension/adapter/codelldb")) 58 | "The path to the codelldb debugger." 59 | :group 'dap-codelldb 60 | :type 'string) 61 | 62 | (defun dap-codelldb-setup (&optional forced) 63 | "Download and install codelldb adapter. 64 | With prefix, FORCED to redownload the extension." 65 | (interactive "P") 66 | (unless (and (not forced) (file-exists-p dap-codelldb-debug-path)) 67 | (dap-utils--get-extension dap-codelldb-download-url dap-codelldb-debug-path) 68 | (message "%s: Downloading done!" "dap-codelldb"))) 69 | 70 | (dap-register-debug-provider 71 | "lldb" 72 | (lambda (conf) 73 | (let ((debug-port (dap--find-available-port))) 74 | (plist-put conf :program-to-start (format "%s --port %s" dap-codelldb-debug-program debug-port)) 75 | (plist-put conf :debugServer debug-port)) 76 | (plist-put conf :host "localhost") 77 | (plist-put conf :type "lldb") 78 | (plist-put conf :cargo "") 79 | conf)) 80 | 81 | (provide 'dap-codelldb) 82 | ;;; dap-codelldb.el ends here 83 | -------------------------------------------------------------------------------- /dap-cpptools.el: -------------------------------------------------------------------------------- 1 | ;;; dap-cpptools.el --- Debug Adapter Protocol mode for cpptools -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2021 Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski 6 | ;; Keywords: language, tools 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; Adapter for https://github.com/microsoft/vscode-cpptools 24 | 25 | ;;; Code: 26 | 27 | (require 'dap-mode) 28 | (require 'dap-utils) 29 | 30 | (defcustom dap-cpptools-debug-path (expand-file-name "vscode/cpptools" dap-utils-extension-path) 31 | "The path to cpptools vscode extension." 32 | :group 'dap-cpptools 33 | :type 'string) 34 | 35 | (defcustom dap-cpptools-extension-version 36 | (let ((current-ver "1.13.8") 37 | (installed-ver (dap-utils-vscode-get-installed-extension-version dap-cpptools-debug-path))) 38 | (when (and installed-ver (version< installed-ver current-ver)) 39 | (warn "You have an old cpptools v%s. Please run `C-u 1 M-x dap-cpptools-setup' \ 40 | to install the new v%s." installed-ver current-ver)) 41 | current-ver) 42 | "The version of the cpptools vscode extension." 43 | :group 'dap-cpptools 44 | :type 'string) 45 | 46 | (defcustom dap-cpptools-download-url 47 | (format "https://github.com/microsoft/vscode-cpptools/releases/download/v%s/cpptools-%s.vsix" 48 | dap-cpptools-extension-version 49 | (plist-get 50 | (list 'windows-nt 51 | (cond ((string-match "\\(?:arm\\|aarch\\).?64" system-configuration) "win-arm64") 52 | ((string-match "64" system-configuration) "win64") 53 | (t "win32")) 54 | 'darwin 55 | (cond ((string-match "^aarch64.*" system-configuration) "osx-arm64") 56 | (t "osx")) 57 | 'gnu/linux 58 | (cond ((string-match "^aarch64.*" system-configuration) "linux-aarch64") 59 | ((string-match "^armhf.*" system-configuration) "linux-armhf") 60 | (t "linux"))) 61 | system-type)) 62 | "The download url." 63 | :group 'dap-cpptools 64 | :type 'string) 65 | 66 | (defcustom dap-cpptools-debug-program 67 | `(,(concat dap-cpptools-debug-path "/extension/debugAdapters/bin/OpenDebugAD7" 68 | (if (eq system-type 'windows-nt) ".exe" ""))) 69 | "The path to the cpptools debug adapter." 70 | :group 'dap-cpptools 71 | :type '(repeat string)) 72 | 73 | (defun dap-cpptools-setup (&optional forced) 74 | "Downloading ms-vscode.cpptools to path specified. 75 | With prefix, FORCED to redownload the extension." 76 | (interactive "P") 77 | (unless (and (not forced) (file-exists-p dap-cpptools-debug-path)) 78 | (dap-utils--get-extension dap-cpptools-download-url dap-cpptools-debug-path) 79 | (let* ((adapter-binary (cl-first dap-cpptools-debug-program)) 80 | (adapters-path (f-parent (f-parent adapter-binary))) 81 | (extension-bins-path (f-join (f-parent adapters-path) "bin")) 82 | (bins 83 | (append (mapcar (lambda (path) (f-join extension-bins-path path)) 84 | '("cpptools" "cpptools-srv")) 85 | (mapcar (lambda (path) (f-join adapters-path path)) 86 | '("bin/createdump" ;; In Linux and OSX versions 87 | ;; Exists in OSX version 88 | "lldb-mi/bin/lldb-mi" 89 | "lldb/bin/lldb-mi" 90 | "lldb/bin/debugserver" 91 | "lldb/bin/lldb-argdumper" 92 | "lldb/bin/lldb-launcher"))))) 93 | (set-file-modes adapter-binary #o0700) 94 | (dolist (bin bins) 95 | (when (f-exists? bin) 96 | (set-file-modes bin #o700)))) 97 | 98 | (message "%s: Downloading done!" "dap-cpptools"))) 99 | 100 | (defun dap-cpptools--populate-args (conf) 101 | "Populate auto arguments." 102 | (-> conf 103 | (dap--put-if-absent :dap-server-path dap-cpptools-debug-program) 104 | (dap--put-if-absent :request "launch") 105 | (dap--put-if-absent :type "cppdbg") 106 | (dap--put-if-absent :environment []))) 107 | 108 | (dap-register-debug-provider "cppdbg" #'dap-cpptools--populate-args) 109 | 110 | (dap-register-debug-template "cpptools::Run Configuration" 111 | (list :type "cppdbg" 112 | :request "launch" 113 | :name "cpptools::Run Configuration" 114 | :MIMode "gdb" 115 | :program "${workspaceFolder}/ replace with your binary" 116 | :cwd "${workspaceFolder}")) 117 | 118 | (provide 'dap-cpptools) 119 | ;;; dap-cpptools.el ends here 120 | -------------------------------------------------------------------------------- /dap-dlv-go.el: -------------------------------------------------------------------------------- 1 | ;;; dap-dlv-go.el --- Debug Adapter Protocol mode for Go -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2022 Sergey Kostyaev 4 | 5 | ;; Author: Sergey Kostyaev 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for https://github.com/go-delve/delve 23 | 24 | ;;; Code: 25 | 26 | (require 'dap-mode) 27 | (require 'dap-utils) 28 | (require 'dap-ui) 29 | (require 'f) 30 | (require 'lsp-mode) 31 | (require 'dash) 32 | 33 | (defcustom dap-dlv-go-delve-path 34 | (or (executable-find "dlv") 35 | (expand-file-name 36 | "dlv" (expand-file-name "bin" (or (getenv "GOPATH") 37 | (f-join (getenv "HOME") "go"))))) 38 | "The path to the delve command." 39 | :group 'dap-dlv-go 40 | :type 'string) 41 | 42 | (defcustom dap-dlv-go-extra-args "" 43 | "Extra arguments passed to the delve command." 44 | :group 'dap-dlv-go 45 | :type 'string) 46 | 47 | (defvar vterm-shell) 48 | (defvar vterm-kill-buffer-on-exit) 49 | (declare-function vterm-mode "ext:vterm.el") 50 | 51 | (defun dap-dlv-go--populate-default-args (conf) 52 | "Populate CONF with the default arguments." 53 | (setq conf 54 | (pcase (plist-get conf :mode) 55 | ("auto" 56 | (dap-dlv-go--populate-auto-args conf)) 57 | ("test" 58 | (dap-dlv-go--populate-test-args conf)) 59 | ("debug" 60 | (dap--put-if-absent 61 | conf :program (f-dirname (buffer-file-name)))) 62 | ("exec" 63 | (dap--put-if-absent 64 | conf :program 65 | (f-expand (read-file-name "enter path to executable: ")))) 66 | ("remote" 67 | (dap--put-if-absent conf :host (read-string "enter host: " "127.0.0.1")) 68 | (dap--put-if-absent conf :debugPort 69 | (string-to-number (read-string "enter port: " "2345")))) 70 | ("local" 71 | (dap--put-if-absent conf :cwd (f-dirname (buffer-file-name))) 72 | (dap--put-if-absent 73 | conf :processId (string-to-number (read-string "enter pid: " "2345")))))) 74 | 75 | (when-let ((env-file (plist-get conf :envFile))) 76 | (plist-put conf :env (dap-dlv-go--parse-env-file env-file))) 77 | 78 | (let ((debug-port (if (string= (plist-get conf :mode) 79 | "remote") 80 | (plist-get conf :debugPort) 81 | (dap--find-available-port)))) 82 | (dap--put-if-absent conf :host "localhost") 83 | (when (not (string= "remote" (plist-get conf :mode))) 84 | (plist-put 85 | conf :program-to-start 86 | (format "%s dap --listen 127.0.0.1:%s %s" dap-dlv-go-delve-path debug-port dap-dlv-go-extra-args))) 87 | (plist-put conf :debugServer debug-port)) 88 | 89 | (if (stringp (plist-get conf :args)) (plist-put conf :args (split-string (plist-get conf :args))) ()) 90 | 91 | (when (string= (plist-get conf :name) "Test function") 92 | (-when-let (name (dap-dlv-go--extract-current--method-or-function-name t)) 93 | (dap--put-if-absent conf :args (list (format "-test.run=^%s$" name))))) 94 | 95 | (when (string= (plist-get conf :name) "Test subtest") 96 | (-when-let (name (concat 97 | (dap-dlv-go--extract-current--method-or-function-name t) 98 | "/" 99 | (shell-quote-argument (dap-dlv-go--extract-current-subtest-name t)))) 100 | (dap--put-if-absent conf :args (list (format "-test.run=^%s" name))))) 101 | 102 | (-> conf 103 | (dap--put-if-absent :dlvToolPath dap-dlv-go-delve-path) 104 | 105 | (dap--put-if-absent :type "go") 106 | (dap--put-if-absent :name "Go Dlv Debug"))) 107 | 108 | (defun dap-dlv-go--populate-auto-args (conf) 109 | "Populate auto arguments according to CONF." 110 | (dap--put-if-absent conf :program (buffer-file-name)) 111 | 112 | (if (string-suffix-p "_test.go" (buffer-file-name)) 113 | (plist-put conf :mode "test") 114 | (plist-put conf :mode "debug"))) 115 | 116 | (defun dap-dlv-go--populate-test-args (conf) 117 | "Populate auto arguments according to CONF." 118 | (dap--put-if-absent conf :program ".")) 119 | 120 | (defun dap-dlv-go--extract-current--method-or-function-name (&optional no-signal?) 121 | "Extract current method or function name." 122 | (let ((symbols (lsp--get-document-symbols))) 123 | (or (->> symbols 124 | (-keep 125 | (-lambda ((&DocumentSymbol :kind :range :selection-range)) 126 | (-let (((beg . end) (lsp--range-to-region range))) 127 | (and (or (= lsp/symbol-kind-method kind) 128 | (= lsp/symbol-kind-function kind)) 129 | (<= beg (point) end) 130 | (lsp-region-text selection-range))))) 131 | (car)) 132 | (unless no-signal? 133 | (user-error "No method or function at point"))))) 134 | 135 | (defun dap-dlv-go--extract-current-subtest-name (&optional no-signal?) 136 | "Extract current subtest name." 137 | (save-excursion 138 | (save-restriction 139 | (search-backward-regexp "^[[:space:]]*{" nil t) 140 | (search-forward-regexp "name:[[:space:]]+[\"`]\\(.*\\)[\"`]\," nil t) 141 | (or (match-string-no-properties 1) 142 | (unless no-signal? 143 | (user-error "No subtest at point")))))) 144 | 145 | (defun dap-dlv-go--parse-env-file (file) 146 | "Parse env FILE." 147 | (with-temp-buffer 148 | (save-match-data 149 | (find-file file) 150 | (setq-local buffer-file-name nil) 151 | (replace-regexp "[[:space:]]*#.*$" "" nil (point-min) (point-max)) 152 | (let ((res (make-hash-table))) 153 | (goto-char (point-min)) 154 | (while (search-forward-regexp "\\(^[^=].*\\)=\\(.*\\)$" nil t) 155 | (ht-set res (match-string 1) (match-string 2))) 156 | (kill-buffer) 157 | res)))) 158 | 159 | (defun dap-dlv-go--get-cmd-pid (cmd) 160 | "Return pid of CMD." 161 | (string-to-number 162 | (cadr 163 | (s-split-words 164 | (car 165 | (seq-filter 166 | (lambda(s) (s-contains? cmd s)) 167 | (process-lines (executable-find "ps") "aux"))))))) 168 | 169 | (defun dap-dlv-go--run-cmd-in-vterm (cmd buf) 170 | "Run CMD with vterm in BUF." 171 | (with-current-buffer buf 172 | (require 'vterm) 173 | (let ((vterm-shell cmd) 174 | (vterm-kill-buffer-on-exit nil)) 175 | (vterm-mode)))) 176 | 177 | (defun dap-dlv-go--run-cmd-in-vterm-get-pid (cmd buf) 178 | "Run CMD in vterm inside BUF and return pid." 179 | (dap-dlv-go--run-cmd-in-vterm cmd buf) 180 | (dap-dlv-go--get-cmd-pid cmd)) 181 | 182 | (defun dap-dlv-go-debug-in-vterm () 183 | "Debug go program in vterm. 184 | With `C-u' you can edit command before run." 185 | (interactive) 186 | (let* ((exe (f-expand (read-file-name "enter path to executable: "))) 187 | (cmd (if (equal (car current-prefix-arg) 4) 188 | (read-string "command: " exe) 189 | exe)) 190 | (buf (generate-new-buffer 191 | (format "*%s console*" 192 | (f-base exe)))) 193 | (debug-port (dap--find-available-port)) 194 | (pid (dap-dlv-go--run-cmd-in-vterm-get-pid cmd buf))) 195 | (dap-start-debugging-noexpand (list :type "go" 196 | :request "attach" 197 | :name "Attach to running process" 198 | :mode "local" 199 | :host "localhost" 200 | :debugServer debug-port 201 | :processId pid 202 | :dlvToolPath dap-dlv-go-delve-path 203 | :program-to-start 204 | (format 205 | "%s dap --listen 127.0.0.1:%s %s" 206 | dap-dlv-go-delve-path 207 | debug-port 208 | dap-dlv-go-extra-args))) 209 | (display-buffer buf) 210 | (dap-ui--show-buffer buf))) 211 | 212 | (dap-register-debug-provider "go" 'dap-dlv-go--populate-default-args) 213 | 214 | (dap-register-debug-template "Go Dlv Launch File Configuration" 215 | (list :type "go" 216 | :request "launch" 217 | :name "Launch File" 218 | :mode "auto" 219 | :program nil 220 | :buildFlags nil 221 | :args nil 222 | :env nil)) 223 | 224 | (dap-register-debug-template "Go Dlv Attach Configuration" 225 | (list :type "go" 226 | :request "attach" 227 | :name "Attach to running process" 228 | :mode "auto")) 229 | 230 | (dap-register-debug-template "Go Dlv Launch Executable Configuration" 231 | (list :type "go" 232 | :request "launch" 233 | :name "Launch Executable" 234 | :mode "exec" 235 | :program nil 236 | :args nil 237 | :env nil)) 238 | 239 | (dap-register-debug-template "Go Dlv Remote Debug" 240 | (list :type "go" 241 | :request "attach" 242 | :name "Dlv Remote Debug" 243 | :mode "remote")) 244 | 245 | (dap-register-debug-template "Go Dlv Test Current Function Configuration" 246 | (list :type "go" 247 | :request "launch" 248 | :name "Test function" 249 | :mode "test" 250 | :program nil 251 | :args nil 252 | :env nil)) 253 | 254 | (dap-register-debug-template "Go Dlv Test Current Subtest Configuration" 255 | (list :type "go" 256 | :request "launch" 257 | :name "Test subtest" 258 | :mode "test" 259 | :program nil 260 | :args nil 261 | :env nil)) 262 | (provide 'dap-dlv-go) 263 | ;;; dap-dlv-go.el ends here 264 | -------------------------------------------------------------------------------- /dap-edge.el: -------------------------------------------------------------------------------- 1 | ;;; dap-edge.el --- Debug Adapter Protocol mode for Edge -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2019 Kien Nguyen 4 | 5 | ;; Author: Kien Nguyen 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Code: 22 | 23 | (require 'dap-mode) 24 | (require 'dap-utils) 25 | 26 | (defcustom dap-edge-debug-path (expand-file-name "vscode/msjsdiag.debugger-for-edge" 27 | dap-utils-extension-path) 28 | "The path to edge vscode extension." 29 | :group 'dap-edge 30 | :type 'string) 31 | 32 | (defcustom dap-edge-debug-program `("node" 33 | ,(f-join dap-edge-debug-path "extension/out/src/chromeDebug.js")) 34 | "The path to the edge debugger." 35 | :group 'dap-edge 36 | :type '(repeat string)) 37 | 38 | (dap-utils-vscode-setup-function "dap-edge" "msjsdiag" "debugger-for-edge" 39 | dap-edge-debug-path) 40 | 41 | (defun dap-edge--populate-start-file-args (conf) 42 | "Populate CONF with the required arguments." 43 | (-> conf 44 | (dap--put-if-absent :dap-server-path dap-edge-debug-program) 45 | (dap--put-if-absent :type "edge") 46 | (dap--put-if-absent :cwd default-directory) 47 | (dap--put-if-absent :file (read-file-name "Select the file to open in the browser:" nil (buffer-file-name) t)) 48 | (dap--put-if-absent :name "Edge Debug"))) 49 | 50 | (dap-register-debug-provider "edge" #'dap-edge--populate-start-file-args) 51 | 52 | (dap-register-debug-template "Edge Run Configuration" 53 | (list :type "edge" 54 | :cwd nil 55 | :request "launch" 56 | :file nil 57 | :reAttach t 58 | :program nil 59 | :version "dev" 60 | :name "Edge::Run")) 61 | 62 | (provide 'dap-edge) 63 | ;;; dap-edge.el ends here 64 | -------------------------------------------------------------------------------- /dap-elixir.el: -------------------------------------------------------------------------------- 1 | ;;; dap-elixir.el --- Debug Adapter Protocol mode for Elixir -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2018 Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for https://github.com/elixir-lsp/elixir-ls 23 | 24 | ;;; Code: 25 | 26 | (require 'dap-mode) 27 | 28 | (defun dap-elixir--populate-start-file-args (conf) 29 | "Populate CONF with the required arguments." 30 | (-> conf 31 | (dap--put-if-absent :dap-server-path '("debugger.sh")) 32 | (dap--put-if-absent :type "mix_task") 33 | (dap--put-if-absent :name "mix test") 34 | (dap--put-if-absent :request "launch") 35 | (dap--put-if-absent :task "test") 36 | (dap--put-if-absent :taskArgs (list "--trace")) 37 | (dap--put-if-absent :projectDir (lsp-find-session-folder (lsp-session) (buffer-file-name))) 38 | (dap--put-if-absent :cwd (lsp-find-session-folder (lsp-session) (buffer-file-name))) 39 | (dap--put-if-absent :requireFiles (list 40 | "test/**/test_helper.exs" 41 | "test/**/*_test.exs")))) 42 | 43 | (dap-register-debug-provider "Elixir" 'dap-elixir--populate-start-file-args) 44 | (dap-register-debug-template "Elixir Run Configuration" 45 | (list :type "Elixir" 46 | :cwd nil 47 | :request "launch" 48 | :program nil 49 | :name "Elixir::Run")) 50 | 51 | (provide 'dap-elixir) 52 | ;;; dap-elixir.el ends here 53 | -------------------------------------------------------------------------------- /dap-erlang.el: -------------------------------------------------------------------------------- 1 | ;;; dap-erlang.el --- Debug Adapter Protocol mode for Erlang -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2018 Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for https://github.com/erlang-ls/erlang_ls 23 | ;; Created by Roberto Aloi (@robertoaloi) 24 | 25 | ;;; Code: 26 | 27 | (require 'dap-mode) 28 | 29 | (defun dap-erlang--populate-start-file-args (conf) 30 | "Populate CONF with the required arguments." 31 | (-> conf 32 | (plist-put :dap-server-path '("els_dap")) 33 | (plist-put :projectDir (lsp-find-session-folder (lsp-session) (buffer-file-name))) 34 | (plist-put :cwd (lsp-find-session-folder (lsp-session) (buffer-file-name))))) 35 | (dap-register-debug-provider "erlang" 'dap-erlang--populate-start-file-args) 36 | 37 | (provide 'dap-erlang) 38 | ;;; dap-erlang.el ends here 39 | -------------------------------------------------------------------------------- /dap-firefox.el: -------------------------------------------------------------------------------- 1 | ;;; dap-firefox.el --- Debug Adapter Protocol mode for Firefox -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2019 Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for https://github.com/firefoxide/vscode-firefox 23 | 24 | ;;; Code: 25 | 26 | (require 'dap-mode) 27 | (require 'dap-utils) 28 | 29 | (defcustom dap-firefox-debug-path (expand-file-name "vscode/firefox-devtools.vscode-firefox-debug" 30 | dap-utils-extension-path) 31 | "The path to firefox vscode extension." 32 | :group 'dap-firefox 33 | :type 'string) 34 | 35 | (defcustom dap-firefox-debug-program `("node" 36 | ,(f-join dap-firefox-debug-path 37 | "extension/out/firefoxDebugAdapter.js")) 38 | "The path to the firefox debugger." 39 | :group 'dap-firefox 40 | :type '(repeat string)) 41 | 42 | (dap-utils-vscode-setup-function "dap-firefox" "firefox-devtools" "vscode-firefox-debug" 43 | dap-firefox-debug-path) 44 | 45 | (defun dap-firefox--populate-start-file-args (conf) 46 | "Populate CONF with the required arguments." 47 | (-> conf 48 | (dap--put-if-absent :dap-server-path dap-firefox-debug-program) 49 | (dap--put-if-absent :type "Firefox") 50 | (dap--put-if-absent :cwd default-directory) 51 | (dap--put-if-absent :file (expand-file-name (read-file-name "Select the file to open in the browser:" nil (buffer-file-name) t))) 52 | (dap--put-if-absent :name "Firefox Debug"))) 53 | 54 | (dap-register-debug-provider "firefox" 'dap-firefox--populate-start-file-args) 55 | 56 | (dap-register-debug-template "Firefox Run Configuration" 57 | (list :type "firefox" 58 | :cwd nil 59 | :request "launch" 60 | :file nil 61 | :reAttach t 62 | :program nil 63 | :name "Firefox::Run")) 64 | 65 | (provide 'dap-firefox) 66 | ;;; dap-firefox.el ends here 67 | -------------------------------------------------------------------------------- /dap-gdb-lldb.el: -------------------------------------------------------------------------------- 1 | ;;; dap-gdb-lldb.el --- Debug Adapter Protocol mode for LLDB/GDB -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2019 Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski yyoncho@gmail.com 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for https://github.com/WebFreak001/code-debug 23 | 24 | ;;; Code: 25 | 26 | (require 'dap-mode) 27 | (require 'dap-utils) 28 | 29 | (defcustom dap-gdb-lldb-extension-version "0.26.1" 30 | "The version of the gdb-lldb vscode extension." 31 | :group 'dap-gdb-lldb 32 | :type 'string) 33 | 34 | (defcustom dap-gdb-lldb-download-url 35 | (format "https://github.com/WebFreak001/code-debug/releases/download/v%s/debug-%s.vsix" 36 | dap-gdb-lldb-extension-version dap-gdb-lldb-extension-version) 37 | "The download url." 38 | :group 'dap-gdb-lldb 39 | :type 'string) 40 | 41 | (defcustom dap-gdb-lldb-path (expand-file-name "vscode/webfreak.debug" dap-utils-extension-path) 42 | "The path to the place at which the webfreak.debug extension. 43 | Link: https://marketplace.visualstudio.com/items?itemName=webfreak.debug ." 44 | :group 'dap-gdb-lldb 45 | :type 'string) 46 | 47 | (defcustom dap-gdb-lldb-debug-program `("node" 48 | ,(f-join dap-gdb-lldb-path "extension/out/src/gdb.js")) 49 | "The path to the LLDB debugger." 50 | :group 'dap-gdb-lldb 51 | :type '(repeat string)) 52 | 53 | (defun dap-gdb-lldb-setup (&optional forced) 54 | "Downloading webfreak.debug to path specified. 55 | With prefix, FORCED to redownload the extension." 56 | (interactive "P") 57 | (unless (and (not forced) (file-exists-p dap-gdb-lldb-path)) 58 | (dap-utils--get-extension dap-gdb-lldb-download-url dap-gdb-lldb-path) 59 | (message "%s: Downloading done!" "dap-gdb-lldb"))) 60 | 61 | (defun dap-gdb-lldb--populate-gdb (conf) 62 | "Populate CONF with the required arguments." 63 | (-> conf 64 | (dap--put-if-absent :dap-server-path dap-gdb-lldb-debug-program) 65 | (dap--put-if-absent :type "gdb") 66 | (dap--put-if-absent :cwd default-directory) 67 | (dap--put-if-absent :target (expand-file-name (read-file-name "Select file to debug."))) 68 | (dap--put-if-absent :name "GDB Debug") 69 | 70 | ;; This may become unnecessary once https://github.com/WebFreak001/code-debug/issues/344 is resolved. 71 | (dap--put-if-absent :valuesFormatting "prettyPrinters"))) 72 | 73 | 74 | (dap-register-debug-provider "gdb" 'dap-gdb-lldb--populate-gdb) 75 | (dap-register-debug-template "GDB Run Configuration" 76 | (list :type "gdb" 77 | :request "launch" 78 | :name "GDB::Run" 79 | :target nil 80 | :cwd nil)) 81 | 82 | (defun dap-gdb-lldb--populate-gdbserver (conf) 83 | "Populate CONF with the required arguments." 84 | (-> conf 85 | (dap--put-if-absent :dap-server-path dap-gdb-lldb-debug-program) 86 | (dap--put-if-absent :type "gdbserver") 87 | (dap--put-if-absent :name "GDB Server") 88 | (dap--put-if-absent :request "attach") 89 | (dap--put-if-absent :gdbpath "gdb") 90 | (dap--put-if-absent :cwd default-directory) 91 | (dap--put-if-absent :target (read-string "target?(host:port) ")) 92 | (dap--put-if-absent :remote :json-true) 93 | 94 | ;; This may become unnecessary once https://github.com/WebFreak001/code-debug/issues/344 is resolved. 95 | (dap--put-if-absent :valuesFormatting "prettyPrinters"))) 96 | 97 | 98 | (dap-register-debug-provider "gdbserver" 'dap-gdb-lldb--populate-gdbserver) 99 | (dap-register-debug-template "GDBServer Connect Configuration" 100 | (list :type "gdbserver" 101 | :name "GDBServer::Connect" 102 | :target nil ;;host:port 103 | :cwd nil 104 | :executable nil ;;usually not needed as symbols can be donwloaded from gdbserver 105 | :autorun nil 106 | :debugger_args nil 107 | :env nil 108 | :showDevDebugOutput :json-false 109 | :printCalls :json-false)) 110 | 111 | 112 | (defcustom dap-gdb-lldb-path-lldb `("node" ,(expand-file-name (f-join dap-gdb-lldb-path "extension/out/src/lldb.js"))) 113 | "The path to the LLDB debugger." 114 | :group 'dap-gdb-lldb 115 | :type '(repeat string)) 116 | 117 | (defun dap-gdb-lldb--populate-lldb (conf) 118 | "Populate CONF with the required arguments." 119 | (-> conf 120 | (dap--put-if-absent :dap-server-path dap-gdb-lldb-path-lldb) 121 | (dap--put-if-absent :type "lldb") 122 | (dap--put-if-absent :cwd default-directory) 123 | (dap--put-if-absent :target (expand-file-name (read-file-name "Select file to debug."))) 124 | (dap--put-if-absent :name "LLDB Debug") 125 | 126 | ;; This may become unnecessary once https://github.com/WebFreak001/code-debug/issues/344 is resolved. 127 | (dap--put-if-absent :valuesFormatting "prettyPrinters"))) 128 | 129 | 130 | (dap-register-debug-provider "lldb-mi" 'dap-gdb-lldb--populate-lldb) 131 | (dap-register-debug-template "LLDB Run Configuration" 132 | (list :type "lldb-mi" 133 | :request "launch" 134 | :name "LLDB::Run" 135 | :target nil 136 | :cwd nil)) 137 | 138 | (provide 'dap-gdb-lldb) 139 | ;;; dap-gdb-lldb.el ends here 140 | -------------------------------------------------------------------------------- /dap-gdb.el: -------------------------------------------------------------------------------- 1 | ;;; dap-gdb.el --- Debug Adapter Protocol mode for LLDB/GDB -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2019 Ivan Yonchovski 4 | ;; Copyright (C) 2024 Danny Milosavljevic 5 | 6 | ;; Author: Danny Milosavljevic 7 | ;; Keywords: languages 8 | 9 | ;; This program is free software; you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; This program is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | ;;; Commentary: 23 | ;; Adapter for GDB version >= 14 24 | 25 | ;;; Code: 26 | 27 | (require 'dap-mode) 28 | (require 'dap-utils) 29 | 30 | (defcustom dap-gdb-debug-program `("gdb" "-i" "dap") 31 | "The path to the GDB debugger." 32 | :group 'dap-gdb 33 | :type '(repeat string)) 34 | 35 | (defun dap-gdb--populate-gdb (conf) 36 | "Populate CONF with the required arguments." 37 | (-> conf 38 | (dap--put-if-absent :dap-server-path dap-gdb-debug-program) 39 | (dap--put-if-absent :type "gdb") 40 | (dap--put-if-absent :cwd default-directory) 41 | ;(dap--put-if-absent :target (expand-file-name (read-file-name "Select file to debug."))) 42 | (dap--put-if-absent :name "GDB Debug") 43 | 44 | (dap--put-if-absent :valuesFormatting "prettyPrinters"))) 45 | 46 | (dap-register-debug-provider "gdb" 'dap-gdb--populate-gdb) 47 | (dap-register-debug-template "GDB Run Configuration" 48 | (list :type "gdb" 49 | :request "launch" 50 | :name "GDB::Run" 51 | :target nil 52 | :cwd nil)) 53 | 54 | (defun dap-gdb--populate-gdbserver (conf) 55 | "Populate CONF with the required arguments." 56 | (-> conf 57 | (dap--put-if-absent :dap-server-path dap-gdb-debug-program) 58 | (dap--put-if-absent :type "gdbserver") 59 | (dap--put-if-absent :name "GDB Server") 60 | (dap--put-if-absent :request "attach") 61 | (dap--put-if-absent :gdbpath "gdb") 62 | (dap--put-if-absent :cwd default-directory) 63 | (dap--put-if-absent :target (read-string "target?(host:port) ")) 64 | (dap--put-if-absent :remote :json-true) 65 | 66 | (dap--put-if-absent :valuesFormatting "prettyPrinters"))) 67 | 68 | 69 | (dap-register-debug-provider "gdbserver" 'dap-gdb--populate-gdbserver) 70 | (dap-register-debug-template "GDBServer Connect Configuration" 71 | (list :type "gdbserver" 72 | :name "GDBServer::Connect" 73 | :target nil ;;host:port 74 | :cwd nil 75 | :executable nil ;;usually not needed as symbols can be downloaded from gdbserver 76 | :autorun nil 77 | :debugger_args nil 78 | :env nil 79 | :showDevDebugOutput :json-false 80 | :printCalls :json-false)) 81 | 82 | 83 | (provide 'dap-gdb) 84 | ;;; dap-gdb.el ends here 85 | -------------------------------------------------------------------------------- /dap-gdscript.el: -------------------------------------------------------------------------------- 1 | ;;; dap-gdscript.el --- Debug Adapter Protocol mode for gdscript -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2023 xiliuya 4 | 5 | ;; Author: xiliuya 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Code: 22 | 23 | (require 'dap-mode) 24 | (require 'dap-utils) 25 | 26 | (defcustom dap-gdscript-debug-port 6006 27 | "The port to the gdscript/godot4 debugger." 28 | :group 'dap-gdscript 29 | :type 'number) 30 | 31 | (defcustom dap-gdscript-debug-host "127.0.0.1" 32 | "The host to the gdscript/godot4 debugger." 33 | :group 'dap-gdscript 34 | :type 'string) 35 | 36 | (defun dap-gdscript--populate-start-file-args (conf) 37 | "Populate CONF with the required arguments." 38 | (let ((conf (-> conf 39 | (dap--put-if-absent :host dap-gdscript-debug-host) 40 | (dap--put-if-absent :debugServer dap-gdscript-debug-port) 41 | (dap--put-if-absent :type "gdscript") 42 | (dap--put-if-absent :cwd default-directory) 43 | (dap--put-if-absent :name "Gdscript Debug") 44 | (dap--put-if-absent :args "")))) 45 | conf)) 46 | 47 | (dap-register-debug-provider "gdscript" #'dap-gdscript--populate-start-file-args) 48 | 49 | (dap-register-debug-template "Gdscript Run Configuration" 50 | (list :type "gdscript" 51 | :cwd nil 52 | :request "launch" 53 | :program nil 54 | :name "Gdscript::Run")) 55 | 56 | (provide 'dap-gdscript) 57 | ;;; dap-gdscript.el ends here 58 | -------------------------------------------------------------------------------- /dap-go.el: -------------------------------------------------------------------------------- 1 | ;;; dap-go.el --- Debug Adapter Protocol mode for Go -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2018 Aya Igarashi 4 | 5 | ;; Author: Aya Igarashi 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for https://github.com/golang/vscode-go 23 | 24 | ;;; Code: 25 | 26 | (require 'dap-mode) 27 | (require 'dap-utils) 28 | 29 | (defcustom dap-go-debug-path (expand-file-name "vscode/golang.go" dap-utils-extension-path) 30 | "The path to go vscode extension." 31 | :group 'dap-go 32 | :type 'string) 33 | 34 | (defcustom dap-go-debug-program 35 | `("node" 36 | ,(let ((old (f-join dap-go-debug-path "extension/out/src/debugAdapter/goDebug.js")) 37 | (new (f-join dap-go-debug-path "extension/dist/debugAdapter.js"))) 38 | (if (f-exists? old) 39 | (progn 40 | (lsp--warn "Go debug adapter is outdated; some features will not work properly (map debugging).\n\ 41 | Update `dap-go' using `C-u M-x dap-go-setup'") 42 | old) 43 | new))) 44 | "The path to the go debugger." 45 | :group 'dap-go 46 | :type '(repeat string)) 47 | 48 | (defcustom dap-go-delve-path (or (executable-find "dlv") 49 | (expand-file-name "dlv" (expand-file-name "bin" (getenv "GOPATH")))) 50 | "The path to the delve command." 51 | :group 'dap-go 52 | :type 'string) 53 | 54 | (dap-utils-vscode-setup-function "dap-go" "golang" "go" dap-go-debug-path "0.32.0") 55 | 56 | (defun dap-go--populate-default-args (conf) 57 | "Populate CONF with the default arguments." 58 | (lwarn '(dap-go) :warning 59 | "`dap-go' is deprecated. Use `dap-dlv-go' instead. 60 | See https://emacs-lsp.github.io/dap-mode/page/configuration/#go") 61 | (setq conf 62 | (pcase (plist-get conf :mode) 63 | ("auto" (dap-go--populate-auto-args conf)) 64 | ("debug" (dap--put-if-absent conf :program (f-dirname (buffer-file-name)))) 65 | ("exec" (dap--put-if-absent conf :program (read-file-name "enter full path to executable without tilde:"))) 66 | ("remote" (dap--put-if-absent conf :program (f-dirname (buffer-file-name))) 67 | (dap--put-if-absent conf :host (read-string "enter host:" "127.0.0.1")) 68 | (dap--put-if-absent conf :port (string-to-number (read-string "Enter port: " "2345")))) 69 | ("local" 70 | (dap--put-if-absent conf :cwd (f-dirname (buffer-file-name))) 71 | (dap--put-if-absent conf :processId (string-to-number (read-string "Enter pid: " "2345")))))) 72 | 73 | (if (stringp (plist-get conf :args)) (plist-put conf :args (split-string (plist-get conf :args))) ()) 74 | 75 | (-> conf 76 | (dap--put-if-absent :dap-server-path dap-go-debug-program) 77 | (dap--put-if-absent :dlvToolPath dap-go-delve-path) 78 | (dap--put-if-absent :packagePathToGoModPathMap 79 | (ht<-alist `((,(f-dirname (buffer-file-name)) . ,(lsp-find-session-folder (lsp-session) (buffer-file-name)))))) 80 | (dap--put-if-absent :type "go") 81 | (dap--put-if-absent :name "Go Debug"))) 82 | 83 | (defun dap-go--populate-auto-args (conf) 84 | "Populate auto arguments." 85 | (dap--put-if-absent conf :program (buffer-file-name)) 86 | 87 | (if (string-suffix-p "_test.go" (buffer-file-name)) 88 | (plist-put conf :mode "test") 89 | (plist-put conf :mode "debug"))) 90 | 91 | (dap-register-debug-provider "go" 'dap-go--populate-default-args) 92 | (dap-register-debug-template "Go Launch File Configuration" 93 | (list :type "go" 94 | :request "launch" 95 | :name "Launch File" 96 | :mode "auto" 97 | :program nil 98 | :buildFlags nil 99 | :args nil 100 | :env nil 101 | :envFile nil)) 102 | (dap-register-debug-template "Go Launch Debug Package Configuration" 103 | (list :type "go" 104 | :request "launch" 105 | :name "Launch Debug Package" 106 | :mode "debug" 107 | :program nil 108 | :buildFlags nil 109 | :args nil 110 | :env nil 111 | :envFile nil)) 112 | (dap-register-debug-template "Go Launch Unoptimized Debug Package Configuration" 113 | (list :type "go" 114 | :request "launch" 115 | :name "Launch Unoptimized Debug Package" 116 | :mode "debug" 117 | :program nil 118 | :buildFlags "-gcflags '-N -l'" 119 | :args nil 120 | :env nil 121 | :envFile nil)) 122 | (dap-register-debug-template "Go Launch Executable Configuration" 123 | (list :type "go" 124 | :request "launch" 125 | :name "Launch Executable" 126 | :mode "exec" 127 | :program nil 128 | :args nil 129 | :env nil 130 | :envFile nil)) 131 | (dap-register-debug-template "Go Attach Executable Configuration" 132 | (list :type "go" 133 | :request "attach" 134 | :name "Attach to Executable" 135 | :mode "local" 136 | :program nil 137 | :args nil 138 | :env nil 139 | :envFile nil)) 140 | (dap-register-debug-template "Go Connect Remote dlv Configuration" 141 | (list :type "go" 142 | :request "launch" 143 | :name "Connect to Remote dlv" 144 | :mode "remote" 145 | :program nil 146 | :args nil 147 | :env nil 148 | :envFile nil)) 149 | 150 | (provide 'dap-go) 151 | ;;; dap-go.el ends here 152 | -------------------------------------------------------------------------------- /dap-hydra.el: -------------------------------------------------------------------------------- 1 | ;;; hydra-dap.el --- dap-mode integration with hydra -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2018 Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Defines hydra for `dap-mode' operations 23 | 24 | ;;; Code: 25 | (require 'hydra) 26 | (require 'dap-mode) 27 | (require 'dap-ui) 28 | 29 | (defhydra dap-hydra (:color pink :hint nil :foreign-keys run) 30 | " 31 | ^Stepping^ ^Switch^ ^Breakpoints^ ^Debug^ ^Eval 32 | ^^^^^^^^---------------------------------------------------------------------------------------------------------------- 33 | _n_: Next _ss_: Session _bb_: Toggle _dd_: Debug _ee_: Eval 34 | _i_: Step in _st_: Thread _bd_: Delete _dr_: Debug recent _er_: Eval region 35 | _o_: Step out _sf_: Stack frame _ba_: Add _dl_: Debug last _es_: Eval thing at point 36 | _c_: Continue _su_: Up stack frame _bc_: Set condition _de_: Edit debug template _ea_: Add expression. 37 | _r_: Restart frame _sd_: Down stack frame _bh_: Set hit count _ds_: Debug restart 38 | _Q_: Disconnect _sl_: List locals _bl_: Set log message 39 | _sb_: List breakpoints 40 | _sS_: List sessions 41 | " 42 | ("n" dap-next) 43 | ("i" dap-step-in) 44 | ("o" dap-step-out) 45 | ("c" dap-continue) 46 | ("r" dap-restart-frame) 47 | ("ss" dap-switch-session) 48 | ("st" dap-switch-thread) 49 | ("sf" dap-switch-stack-frame) 50 | ("su" dap-up-stack-frame) 51 | ("sd" dap-down-stack-frame) 52 | ("sl" dap-ui-locals) 53 | ("sb" dap-ui-breakpoints) 54 | ("sS" dap-ui-sessions) 55 | ("bb" dap-breakpoint-toggle) 56 | ("ba" dap-breakpoint-add) 57 | ("bd" dap-breakpoint-delete) 58 | ("bc" dap-breakpoint-condition) 59 | ("bh" dap-breakpoint-hit-condition) 60 | ("bl" dap-breakpoint-log-message) 61 | ("dd" dap-debug) 62 | ("dr" dap-debug-recent) 63 | ("ds" dap-debug-restart) 64 | ("dl" dap-debug-last) 65 | ("de" dap-debug-edit-template :exit t) 66 | ("ee" dap-eval) 67 | ("ea" dap-ui-expressions-add) 68 | ("er" dap-eval-region) 69 | ("es" dap-eval-thing-at-point) 70 | ("q" nil "quit" :color blue) 71 | ("Q" dap-disconnect :color red)) 72 | 73 | ;;;###autoload 74 | (defun dap-hydra () 75 | "Run `dap-hydra/body'." 76 | (interactive) 77 | (dap-hydra/body)) 78 | 79 | (provide 'dap-hydra) 80 | 81 | ;;; dap-hydra.el ends here 82 | -------------------------------------------------------------------------------- /dap-js.el: -------------------------------------------------------------------------------- 1 | ;;; dap-js.el --- Debug Adapter Protocol mode for Node -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Code: 22 | 23 | (require 'dap-mode) 24 | (require 'dap-utils) 25 | 26 | (defcustom dap-js-path (expand-file-name "js-debug" dap-utils-extension-path) 27 | "The path to the place at which the webfreak.debug extension. 28 | Link: https://marketplace.visualstudio.com/items?itemName=webfreak.debug ." 29 | :group 'dap-js 30 | :type 'string) 31 | 32 | (defcustom dap-js-debug-program `("node" ,(f-join dap-js-path "src" "dapDebugServer.js")) 33 | "The path to the JS debugger." 34 | :group 'dap-js 35 | :type '(repeat string)) 36 | 37 | (defun dap-js-setup (&optional forced) 38 | "Downloading webfreak.debug to path specified. 39 | With prefix, FORCED to redownload the extension." 40 | (interactive "P") 41 | (unless (and (not forced) (file-exists-p dap-js-path)) 42 | (lsp-download-install 43 | (lambda (&rest _) (lsp--info "Downloaded extension!")) 44 | (lambda (error) (lsp--error "Failed Downloaded extension %s!" error)) 45 | :url (lsp--find-latest-gh-release-url 46 | "https://api.github.com/repos/microsoft/vscode-js-debug/releases/latest" 47 | "js-debug-dap") 48 | :store-path dap-js-path 49 | :decompress :targz))) 50 | 51 | (defun dap-js--populate-start-file-args (conf) 52 | "Populate CONF with the required arguments." 53 | (let ((port (dap--find-available-port))) 54 | (-> conf 55 | (append 56 | (list :debugServer port 57 | :host "localhost" 58 | :type "pwa-node" 59 | :program-to-start (concat (s-join " " dap-js-debug-program) 60 | " " 61 | (number-to-string port)))) 62 | (dap--put-if-absent :cwd default-directory) 63 | (dap--put-if-absent :name "Node Debug")))) 64 | 65 | (dap-register-debug-provider "pwa-node" #'dap-js--populate-start-file-args) 66 | 67 | (dap-register-debug-template 68 | "Node Run Configuration (new)" 69 | (list :type "pwa-node" 70 | :cwd nil 71 | :request "launch" 72 | :program nil 73 | :name "Node::Run")) 74 | 75 | (provide 'dap-js) 76 | ;;; dap-js.el ends here 77 | -------------------------------------------------------------------------------- /dap-julia.el: -------------------------------------------------------------------------------- 1 | ;;; dap-julia.el --- Debug Adapter Protocol mode for Julia -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024 Michael Kovarik 4 | 5 | ;; Author: Michael Kovarik 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for https://github.com/julia-vscode/DebugAdapter.jl 23 | 24 | ;;; Code: 25 | 26 | (require 'dap-mode) 27 | (require 'dap-utils) 28 | 29 | (defun dap-julia--find-project-root (dir) 30 | "Search upwards from DIR to find Julia project root." 31 | (let ((parent (file-name-directory (directory-file-name dir)))) 32 | (cond 33 | ((or (file-exists-p (expand-file-name "Project.toml" dir)) 34 | (file-exists-p (expand-file-name "JuliaProject.toml" dir))) 35 | dir) 36 | ((or (null parent) (equal parent dir)) 37 | (error "No Project.toml or JuliaProject.toml found in any parent directories. Is this a Julia project?")) 38 | (t (dap-julia--find-project-root parent))))) 39 | 40 | (defun dap-julia--populate-start-file-args (conf) 41 | "Populate CONF with the required arguments." 42 | (let* ((project-root (dap-julia--find-project-root (file-name-directory (buffer-file-name)))) 43 | (port (dap--find-available-port)) 44 | (command (format "julia --project=%s -e \"import DebugAdapter: DebugSession; using Sockets; \ 45 | port = %d; server = listen(port); \ 46 | while true; conn = accept(server); @async begin; \ 47 | session = DebugSession(conn); run(session); close(conn); end; end;\"" project-root port))) 48 | (-> conf 49 | (dap--put-if-absent :cwd project-root) 50 | (dap--put-if-absent :name "Julia Debug") 51 | (dap--put-if-absent :debugServer port) 52 | (dap--put-if-absent :host "localhost") 53 | (dap--put-if-absent :type "Julia") 54 | (dap--put-if-absent :program (buffer-file-name)) 55 | (dap--put-if-absent :program-to-start command)))) 56 | 57 | (dap-register-debug-provider "Julia" #'dap-julia--populate-start-file-args) 58 | 59 | 60 | (dap-register-debug-template "Julia Run Configuration" 61 | (list :type "Julia" 62 | :cwd nil 63 | :request "launch" 64 | :name "Julia Debug" 65 | :sourceMaps t)) 66 | 67 | (provide 'dap-julia) 68 | ;;; dap-julia.el ends here 69 | -------------------------------------------------------------------------------- /dap-kotlin.el: -------------------------------------------------------------------------------- 1 | ;;; dap-kotlin.el --- Debug Adapter Protocol mode for Kotlin -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2019-2024 emacs-lsp maintainers 4 | 5 | ;; This program is free software; you can redistribute it and/or modify 6 | ;; it under the terms of the GNU General Public License as published by 7 | ;; the Free Software Foundation, either version 3 of the License, or 8 | ;; (at your option) any later version. 9 | 10 | ;; This program is distributed in the hope that it will be useful, 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;; GNU General Public License for more details. 14 | 15 | ;; You should have received a copy of the GNU General Public License 16 | ;; along with this program. If not, see . 17 | 18 | ;; Commentary: 19 | ;; Adapter for https://github.com/fwcd/kotlin-debug-adapter 20 | 21 | ;;; Code: 22 | 23 | (require 'lsp-kotlin) 24 | (require 'dap-mode) 25 | 26 | (defcustom dap-kotlin-enable-log nil 27 | "Turn on logging of debug adapter logs to file." 28 | :type 'boolean 29 | :group 'dap-kotlin) 30 | 31 | (defcustom dap-kotlin-log-path nil 32 | "Path to the debug adapter log file." 33 | :type 'string 34 | :group 'dap-kotlin) 35 | 36 | (defun dap-kotlin-populate-launch-args (conf) 37 | ;; we require mainClass to be filled in in the launch configuration. 38 | ;; dap-kotlin does currently not support a fallback if not defined 39 | (-> conf 40 | (dap--put-if-absent :request "launch") 41 | (dap--put-if-absent :name "Kotlin Launch") 42 | (dap--put-if-absent :projectRoot (lsp-workspace-root)) 43 | (dap--put-if-absent :enableJsonLogging (lsp-json-bool dap-kotlin-enable-log)) 44 | (dap--put-if-absent :jsonLogFile dap-kotlin-log-path))) 45 | 46 | (defun dap-kotlin-populate-attach-args (conf) 47 | (-> conf 48 | (dap--put-if-absent :request "attach") 49 | (dap--put-if-absent :name "Kotlin Attach") 50 | (dap--put-if-absent :projectRoot (lsp-workspace-root)) 51 | (dap--put-if-absent :hostName "localhost") 52 | (dap--put-if-absent :port 5005) 53 | (dap--put-if-absent :timeout 2000) 54 | (dap--put-if-absent :enableJsonLogging (lsp-json-bool dap-kotlin-enable-log)) 55 | (dap--put-if-absent :jsonLogFile dap-kotlin-log-path))) 56 | 57 | (defun dap-kotlin-populate-default-args (conf) 58 | (setq conf (pcase (plist-get conf :request) 59 | ("launch" (dap-kotlin-populate-launch-args conf)) 60 | ("attach" (dap-kotlin-populate-attach-args conf)) 61 | (_ (error "Unsupported dap-request")))) 62 | 63 | (-> conf 64 | (dap--put-if-absent :type "kotlin") 65 | (plist-put :dap-server-path (list lsp-kotlin-debug-adapter-path)))) 66 | 67 | (dap-register-debug-provider "kotlin" #'dap-kotlin-populate-default-args) 68 | 69 | (dap-register-debug-template "Kotlin Attach" 70 | (list :type "kotlin" 71 | :request "attach" 72 | :noDebug nil)) 73 | 74 | (provide 'dap-kotlin) 75 | ;;; dap-kotlin.el ends here 76 | -------------------------------------------------------------------------------- /dap-launch.el: -------------------------------------------------------------------------------- 1 | ;;; dap-launch.el --- support launch.json -*- lexical-binding: t -*- 2 | 3 | ;; Copyright (C) 2020 Nikita Bloshchanevich 4 | 5 | ;; Author: Nikita Bloshchanevich 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Extend dap-mode with support for launch.json files 23 | 24 | ;;; Code: 25 | 26 | (require 'lsp-mode) 27 | (require 'json) 28 | 29 | (declare-function dap-variables-find-vscode-config "dap-variables" (f root)) 30 | (defun dap-launch-find-launch-json () 31 | "Return the path to current project's launch.json file. 32 | Yields nil if it cannot be found or there is no project." 33 | (when-let ((root (lsp-workspace-root))) 34 | (require 'dap-variables) 35 | (dap-variables-find-vscode-config "launch.json" root))) 36 | 37 | (defun dap-launch-get-launch-json () 38 | "Parse the project's launch.json as json data and return the result." 39 | (require 'dap-utils) 40 | (when-let ((launch-json (dap-launch-find-launch-json)) 41 | (json-object-type 'plist) 42 | ;; Use 'vector instead of 'list. With 'list for array type, 43 | ;; json-encode-list interpreted a list with one plist element as 44 | ;; an alist. Using 'list, it turned the following value of 45 | ;; pathMappings: 46 | ;; 47 | ;; "pathMappings": [ 48 | ;; { 49 | ;; "localRoot": "${workspaceFolder}", 50 | ;; "remoteRoot": "." 51 | ;; } 52 | ;; ] 53 | ;; 54 | ;; into: 55 | ;; 56 | ;; ((:localRoot "${workspaceFolder}" :remoteRoot ".")) 57 | ;; 58 | ;; and then into: 59 | ;; 60 | ;; "pathMappings": { 61 | ;; "localRoot": [ 62 | ;; "${workspaceFolder}", 63 | ;; "remoteRoot", 64 | ;; "." 65 | ;; ] 66 | ;; } 67 | (json-array-type 'vector)) 68 | (with-temp-buffer 69 | ;; NOTE: insert-file-contents does not move point 70 | (insert-file-contents launch-json) 71 | (dap-utils-sanitize-json) 72 | ;; dap-launch-remove-comments does move point 73 | (goto-char (point-min)) 74 | 75 | (json-read)))) 76 | 77 | (defun dap-launch-configuration-get-name (conf) 78 | "Return the name of launch configuration CONF." 79 | (plist-get conf :name)) 80 | 81 | (defun dap-launch-configuration-prepend-name (conf) 82 | "Prepend the name of CONF to it as a string. 83 | Extract the name from the :name property." 84 | (push (dap-launch-configuration-get-name conf) conf)) 85 | 86 | (defun dap--launch-extract-environment (conf) 87 | "Transform environment config into dap-mode format. 88 | This handles a single configuration plist." 89 | (if (not (plist-get conf :environment)) 90 | ;; No environment specified, just return the old configuration 91 | conf 92 | ;; Standard format for the "environment" key is 93 | ;; {"name": "foo", "value": "bar"}, 94 | ;; which results in a (:name "foo" :value "bar) plist. 95 | ;; We need to transform this into a ("foo" . "bar") cons cell. 96 | (let ((environ-spec (mapcar 97 | (lambda (env-plist) 98 | (cons (plist-get env-plist :name) 99 | (plist-get env-plist :value))) 100 | (plist-get conf :environment)))) 101 | (plist-put conf :environment-variables environ-spec)))) 102 | 103 | (defun dap--launch-extract-environments (conflist) 104 | "Transform environment config into dap-mode format. 105 | This is intended to be run on a list of configurations." 106 | (mapcar #'dap--launch-extract-environment conflist)) 107 | 108 | (defun dap-launch-parse-launch-json (json) 109 | "Return a list of all launch configurations in JSON. 110 | JSON must have been acquired with `dap-launch--get-launch-json'." 111 | (mapcar #'dap-launch-configuration-prepend-name 112 | (dap--launch-extract-environments 113 | (or (plist-get json :configurations) (list json))))) 114 | 115 | (defun dap-launch-find-parse-launch-json () 116 | "Return a list of all launch configurations for the current project. 117 | Usable as a dap-launch-configuration-providers backend." 118 | (when-let ((launch-json (dap-launch-get-launch-json))) 119 | (dap-launch-parse-launch-json launch-json))) 120 | 121 | (provide 'dap-launch) 122 | ;;; dap-launch.el ends here 123 | -------------------------------------------------------------------------------- /dap-lldb.el: -------------------------------------------------------------------------------- 1 | ;;; dap-lldb.el --- Debug Adapter Protocol mode for LLDB -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2018 Daniel Martín 4 | 5 | ;; Author: Daniel Martín 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for https://github.com/llvm-mirror/lldb/tree/master/tools/lldb-vscode 23 | 24 | ;;; Code: 25 | 26 | (require 'dap-mode) 27 | 28 | (defcustom dap-lldb-debug-program `(,(expand-file-name "~/.vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin/lldb-vscode")) 29 | "The path to the LLDB debugger." 30 | :group 'dap-lldb 31 | :type '(repeat string)) 32 | 33 | (defcustom dap-lldb-debugged-program-function 'buffer-file-name 34 | "The function to get the path of the file to be debugged." 35 | :group 'dap-lldb 36 | :type 'symbol) 37 | 38 | (defun dap-lldb--populate-start-file-args (conf) 39 | "Populate CONF with the required arguments." 40 | (-> conf 41 | (dap--put-if-absent :dap-server-path dap-lldb-debug-program) 42 | (dap--put-if-absent :type "lldb-vscode") 43 | (dap--put-if-absent :cwd default-directory) 44 | (dap--put-if-absent :program (if (commandp dap-lldb-debugged-program-function) 45 | (call-interactively dap-lldb-debugged-program-function) 46 | (funcall dap-lldb-debugged-program-function))) 47 | (dap--put-if-absent :name "LLDB Debug"))) 48 | 49 | (eval-after-load "dap-mode" 50 | '(progn 51 | (dap-register-debug-provider "lldb-vscode" 'dap-lldb--populate-start-file-args) 52 | (dap-register-debug-template "LLDB (VS Code) :: Run Configuration" 53 | (list :type "lldb-vscode" 54 | :cwd nil 55 | :request "launch" 56 | :program nil 57 | :name "LLDB::Run")))) 58 | 59 | (provide 'dap-lldb) 60 | ;;; dap-lldb.el ends here 61 | -------------------------------------------------------------------------------- /dap-magik.el: -------------------------------------------------------------------------------- 1 | ;;; dap-magik.el --- Debug Adapter Protocol mode for Magik -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2022 Steven Looman 4 | 5 | ;; Author: Steven Looman 6 | ;; Keywords: dap, magik 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | 24 | ;; LSP client for the Magik programming language 25 | ;; https://github.com/StevenLooman/magik-tools 26 | 27 | ;;; Code: 28 | 29 | (require 'dap-mode) 30 | (require 'dap-utils) 31 | 32 | (defgroup dap-magik nil 33 | "DAP support for Magik." 34 | :link '(url-link "https://github.com/StevenLooman/magik-tools") 35 | :group 'dap-mode 36 | :tag "Dap Magik" 37 | :package-version '(dap-mode . "0.9.1")) 38 | 39 | (defcustom dap-magik-version "0.7.1" 40 | "Version of DAP server." 41 | :type 'string 42 | :group 'dap-magik 43 | :package-version '(dap-mode . "0.9.1")) 44 | 45 | (defcustom dap-magik-download-url (format "https://github.com/StevenLooman/magik-tools/releases/download/%s/magik-debug-adapter-%s.jar" dap-magik-version dap-magik-version) 46 | "URL of DAP server to download." 47 | :type 'string 48 | :group 'dap-magik 49 | :package-version '(dap-mode . "0.9.1")) 50 | 51 | (defcustom dap-magik-path (f-join dap-utils-extension-path (format "magik/magik-debug-adapter-%s.jar" dap-magik-version)) 52 | "Path of the debug adapter." 53 | :type 'string 54 | :group 'dap-magik 55 | :package-version '(dap . "0.9.1")) 56 | 57 | (defcustom dap-magik-java-path (cond ((eq system-type 'windows-nt) "$JAVA_HOME/bin/java") 58 | (t "java")) 59 | "Path of the java executable." 60 | :type 'string 61 | :group 'dap-magik 62 | :package-version '(dap-mode . "0.9.1")) 63 | 64 | (defcustom dap-magik-attach-host "127.0.0.1" 65 | "Host to connect to when attaching to a session." 66 | :type 'string 67 | :group 'dap-magik 68 | :package-version '(dap-mode . "0.9.1")) 69 | 70 | (defcustom dap-magik-attach-port 32000 71 | "Port to connect to when attaching to a session." 72 | :type 'integer 73 | :group 'dap-magik 74 | :package-version '(dap-mode . "0.9.1")) 75 | 76 | (defcustom dap-magik-path-mapping [] 77 | "Path mapping to apply." 78 | :type 'vector 79 | :group 'dap-magik 80 | :package-version '(dap-mode . "0.9.1")) 81 | 82 | (defun dap-magik-download-da () 83 | "Download the Magik Debug Adapter." 84 | (unless (file-exists-p (f-join dap-utils-extension-path "magik")) 85 | (make-directory (f-join dap-utils-extension-path "magik") t)) 86 | (unless (file-exists-p dap-magik-path) 87 | (url-copy-file dap-magik-download-url dap-magik-path 'overwrite) 88 | (message "%s: Downloading done!" "dap-magik"))) 89 | 90 | (dap-magik-download-da) 91 | 92 | (defun dap-magik--populate-attach-args (conf) 93 | "Populate CONF with the required arguments." 94 | (-> conf 95 | (dap--put-if-absent :dap-server-path (list dap-magik-java-path "-jar" dap-magik-path "--debug")) 96 | (dap--put-if-absent :type "magik") 97 | (dap--put-if-absent :request "attach") 98 | (dap--put-if-absent :connect (list :host dap-magik-attach-host 99 | :port dap-magik-attach-port)))) 100 | 101 | (dap-register-debug-template "Magik Attach Configuration" 102 | (list :type "magik" 103 | :request "attach" 104 | :name "Magik::Attach")) 105 | 106 | (dap-register-debug-provider "magik" #'dap-magik--populate-attach-args) 107 | 108 | (provide 'dap-magik) 109 | ;;; dap-magik.el ends here 110 | -------------------------------------------------------------------------------- /dap-mouse.el: -------------------------------------------------------------------------------- 1 | ;;; dap-mouse.el --- dap-mode mouse integration -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2019 Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski 6 | ;; Keywords: 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; 24 | 25 | ;;; Code: 26 | 27 | (require 'dap-mode) 28 | (require 'dap-ui) 29 | (require 'lsp-mode) 30 | (require 'lsp-treemacs) 31 | (require 'tooltip) 32 | 33 | (defface dap-mouse-eval-thing-face 34 | '((((class color) (background dark)) 35 | :background "grey10" :box (:line-width -1 :color "#2aa1ae"))) 36 | "Face used to display evaluation results at the end of line. 37 | If `dap-overlays-use-font-lock' is non-nil, this face is 38 | applied with lower priority than the syntax highlighting." 39 | :group 'dap 40 | :package-version '(dap "0.9.1")) 41 | 42 | (defvar dap-mouse--hide-timer nil) 43 | 44 | (defvar dap-mouse-posframe-properties 45 | (list :min-width 50 46 | :internal-border-width 2 47 | :internal-border-color (face-attribute 'tooltip :background) 48 | :width 50 49 | :min-height 10) 50 | "The properties which will be used for creating the `posframe'.") 51 | 52 | (defconst dap-mouse-buffer "*dap-mouse*" 53 | "Buffer name for `dap-mouse'.") 54 | 55 | (defun dap-mouse--hide-popup? () 56 | (let ((buffer-under-mouse (window-buffer (cl-first (window-list (cl-first (mouse-position)))))) 57 | (popup-buffer (get-buffer dap-mouse-buffer))) 58 | (not (or (and (eq (current-buffer) popup-buffer) 59 | (eq buffer-under-mouse popup-buffer)) 60 | (eq buffer-under-mouse popup-buffer))))) 61 | 62 | (defcustom dap-mouse-popup-timeout 0.3 63 | "The time to wait after command before hiding the popup." 64 | :type 'float 65 | :group 'dap-mouse) 66 | 67 | ;;;###autoload 68 | (define-minor-mode dap-tooltip-mode 69 | "Toggle the display of GUD tooltips." 70 | :global t 71 | :group 'dap-mouse 72 | :group 'tooltip (require 'tooltip) 73 | (cond 74 | (dap-tooltip-mode 75 | (add-hook 'tooltip-functions 'dap-tooltip-tips) 76 | (add-hook 'lsp-mode-hook 'dap-tooltip-update-mouse-motions-if-enabled) 77 | (define-key lsp-mode-map [mouse-movement] 'dap-tooltip-mouse-motion)) 78 | ((not tooltip-mode) 79 | (remove-hook 'tooltip-functions 'dap-tooltip-tips) 80 | (define-key lsp-mode-map [mouse-movement] 'ignore) 81 | (remove-hook 'lsp-mode-hook 'dap-tooltip-update-mouse-motions-if-enabled))) 82 | (dap-tooltip-update-mouse-motions-if-enabled)) 83 | 84 | (defcustom dap-tooltip-echo-area nil 85 | "Use the echo area instead of frames for DAP tooltips." 86 | :type 'boolean 87 | :group 'dap-mouse 88 | :group 'tooltip) 89 | 90 | ;;; Reacting on mouse movements 91 | 92 | (defun dap-tooltip-update-mouse-motions-if-enabled () 93 | "Reconsider for all buffers whether mouse motion events are desired." 94 | (remove-hook 'post-command-hook 95 | 'dap-tooltip-update-mouse-motions-if-enabled) 96 | (dolist (buffer (buffer-list)) 97 | (with-current-buffer buffer 98 | (if (and dap-tooltip-mode lsp-mode) 99 | (dap-tooltip-activate-mouse-motions t) 100 | (dap-tooltip-activate-mouse-motions nil))))) 101 | 102 | (defvar dap-tooltip-mouse-motions-active nil 103 | "Locally t in a buffer if tooltip processing of mouse motion is enabled.") 104 | 105 | (defun dap-tooltip-activate-mouse-motions (activatep) 106 | "Activate/deactivate mouse motion events for the current buffer. 107 | ACTIVATEP non-nil means activate mouse motion events." 108 | (if activatep 109 | (progn 110 | (set (make-local-variable 'dap-tooltip-mouse-motions-active) t) 111 | (set (make-local-variable 'track-mouse) t)) 112 | (when dap-tooltip-mouse-motions-active 113 | (kill-local-variable 'dap-tooltip-mouse-motions-active) 114 | (kill-local-variable 'track-mouse)))) 115 | 116 | (defun dap-tooltip-mouse-motion (event) 117 | "Command handler for mouse movement events in `dap-mode-map'. 118 | EVENT is the last mouse movement event." 119 | (interactive "e") 120 | (tooltip-hide) 121 | (when (car (mouse-pixel-position)) 122 | (tooltip-start-delayed-tip) 123 | (setq tooltip-last-mouse-motion-event event))) 124 | 125 | (defun dap-tooltip-thing-bounds (point) 126 | "Return the thing at POINT that will be introspected. 127 | If there is an active selection - return it." 128 | (if (and (region-active-p) 129 | (< (region-beginning) point (region-end))) 130 | (cons (region-beginning) (region-end)) 131 | (save-excursion 132 | (goto-char point) 133 | (bounds-of-thing-at-point 'symbol)))) 134 | 135 | (defvar-local dap--tooltip-overlay nil) 136 | (defun dap-tooltip-post-tooltip () 137 | "Clean tooltip properties." 138 | 139 | (when dap-mouse--hide-timer 140 | (cancel-timer dap-mouse--hide-timer)) 141 | (when (dap-mouse--hide-popup?) 142 | (setq 143 | dap-mouse--hide-timer 144 | (run-at-time 145 | dap-mouse-popup-timeout nil 146 | (lambda () 147 | (when (dap-mouse--hide-popup?) 148 | (posframe-hide dap-mouse-buffer) 149 | (when dap--tooltip-overlay 150 | (delete-overlay dap--tooltip-overlay) 151 | ;; restore the selection 152 | (when (region-active-p) 153 | (let ((start (overlay-start dap--tooltip-overlay)) 154 | (end (overlay-end dap--tooltip-overlay))) 155 | (run-with-idle-timer 156 | 0.0 157 | nil 158 | (lambda () 159 | (let ((point (point))) 160 | (push-mark start t t) 161 | (goto-char end) 162 | (unless (= point (point)) 163 | (exchange-point-and-mark)))))))) 164 | (setq dap-mouse--hide-timer nil) 165 | (remove-hook 'post-command-hook #'dap-tooltip-post-tooltip))))))) 166 | 167 | (defun dap-tooltip-at-point (&optional pos) 168 | "Show information about the variable under point. 169 | The result is displayed in a `treemacs' `posframe'. POS, 170 | defaulting to `point', specifies where the cursor is and 171 | consequently where to show the `posframe'." 172 | (interactive) 173 | (let ((debug-session (dap--cur-session)) 174 | (mouse-point (or pos (point)))) 175 | (when (and (dap--session-running debug-session) 176 | mouse-point) 177 | (-when-let* ((active-frame-id (-some->> debug-session 178 | dap--debug-session-active-frame 179 | (gethash "id"))) 180 | (bounds (dap-tooltip-thing-bounds mouse-point)) 181 | ((start . end) bounds) 182 | (expression (s-trim (buffer-substring start end)))) 183 | (dap--send-message 184 | (dap--make-request "evaluate" 185 | (list :expression expression 186 | :frameId active-frame-id 187 | :context "hover")) 188 | (dap--resp-handler 189 | (-lambda ((&hash "body" (&hash? "result" 190 | "variablesReference" variables-reference))) 191 | (setq dap--tooltip-overlay 192 | (-doto (make-overlay start end) 193 | (overlay-put 'mouse-face 'dap-mouse-eval-thing-face))) 194 | ;; Show a dead buffer so that the `posframe' size is consistent. 195 | (when (get-buffer dap-mouse-buffer) 196 | (kill-buffer dap-mouse-buffer)) 197 | (unless (and (zerop variables-reference) (string-empty-p result)) 198 | (apply #'posframe-show dap-mouse-buffer 199 | :position start 200 | :accept-focus t 201 | dap-mouse-posframe-properties) 202 | (with-current-buffer (get-buffer-create dap-mouse-buffer) 203 | (dap-ui-render-value debug-session expression 204 | result variables-reference))) 205 | (add-hook 'post-command-hook 'dap-tooltip-post-tooltip)) 206 | ;; TODO: hover failure will yield weird errors involving process 207 | ;; filters, so I resorted to this hack; we should proably do proper 208 | ;; error handling, with a whitelist of allowable errors. 209 | #'ignore) 210 | debug-session))))) 211 | 212 | (defun dap-tooltip-tips (event) 213 | "Show tip for identifier or selection under the mouse. 214 | The mouse must either point at an identifier or inside a selected 215 | region for the tip window to be shown. In the case of a C program 216 | controlled by GDB, show the associated #define directives when 217 | program is not executing. 218 | 219 | This function must return nil if it doesn't handle EVENT." 220 | (when (and (eventp event) dap-tooltip-mode) 221 | (dap-tooltip-at-point (posn-point (event-end event))))) 222 | 223 | (provide 'dap-mouse) 224 | ;;; dap-mouse.el ends here 225 | -------------------------------------------------------------------------------- /dap-node.el: -------------------------------------------------------------------------------- 1 | ;;; dap-node.el --- Debug Adapter Protocol mode for Node -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2019 Kien Nguyen 4 | 5 | ;; Author: Kien Nguyen 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Code: 22 | 23 | (require 'dap-mode) 24 | (require 'dap-utils) 25 | 26 | (defcustom dap-node-debug-path (expand-file-name "vscode/ms-vscode.node-debug2" 27 | dap-utils-extension-path) 28 | "The path to node vscode extension." 29 | :group 'dap-node 30 | :type 'string) 31 | 32 | (defcustom dap-node-debug-program `("node" 33 | ,(f-join dap-node-debug-path "extension/out/src/nodeDebug.js")) 34 | "The path to the node debugger." 35 | :group 'dap-node 36 | :type '(repeat string)) 37 | 38 | (dap-utils-openvsx-setup-function "dap-node" "ms-vscode" "node-debug2" 39 | dap-node-debug-path) 40 | 41 | (defun dap-node--populate-start-file-args (conf) 42 | "Populate CONF with the required arguments." 43 | (let ((conf (-> conf 44 | (dap--put-if-absent :dap-server-path dap-node-debug-program) 45 | (dap--put-if-absent :type "node") 46 | (dap--put-if-absent :cwd default-directory) 47 | (dap--put-if-absent :name "Node Debug")))) 48 | (if (plist-get conf :args) 49 | conf 50 | (dap--put-if-absent 51 | conf :program (read-file-name "Select the file to run:" nil (buffer-file-name) t))))) 52 | 53 | (dap-register-debug-provider "node" #'dap-node--populate-start-file-args) 54 | 55 | (dap-register-debug-template "Node Run Configuration" 56 | (list :type "node" 57 | :cwd nil 58 | :request "launch" 59 | :program nil 60 | :name "Node::Run")) 61 | 62 | (provide 'dap-node) 63 | ;;; dap-node.el ends here 64 | -------------------------------------------------------------------------------- /dap-ocaml.el: -------------------------------------------------------------------------------- 1 | ;;; dap-mode/dap-ocaml.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2018 Austin Theriault 4 | 5 | ;; Author: Austin Theriault 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for OCaml Earlybird (https://github.com/hackwaly/ocamlearlybird) 23 | 24 | ;;; Code: 25 | 26 | (require 'dap-mode) 27 | 28 | (defcustom dap-ocaml-executable "ocamlearlybird" 29 | "Path to the OCaml Earlybird executable." 30 | :group 'dap-ocaml 31 | :risky t 32 | :type 'file) 33 | 34 | (defun dap-ocaml--populate-start-file-args (conf) 35 | "Populate CONF with the start file argument." 36 | (-> conf 37 | (dap--put-if-absent :console "internalConsole") ;; integratedTerminal doesn't work 38 | (dap--put-if-absent :dap-server-path (list dap-ocaml-executable "debug")))) 39 | 40 | (dap-register-debug-provider "ocaml.earlybird" 'dap-ocaml--populate-start-file-args) 41 | (dap-register-debug-template "OCaml Debug Template" 42 | (list :type "ocaml.earlybird" 43 | :request "launch" 44 | :name "OCaml::Run" 45 | :program nil 46 | :arguments nil)) 47 | 48 | 49 | (provide 'dap-ocaml) 50 | ;;; dap-ocaml.el ends here 51 | -------------------------------------------------------------------------------- /dap-overlays.el: -------------------------------------------------------------------------------- 1 | ;;; dap-overlays.el --- Managing DAP overlays -*- lexical-binding: t; -*- 2 | 3 | ;; Coppied from cider 4 | ;; Author: Artur Malabarba 5 | 6 | ;; This program is free software; you can redistribute it and/or modify 7 | ;; it under the terms of the GNU General Public License as published by 8 | ;; the Free Software Foundation, either version 3 of the License, or 9 | ;; (at your option) any later version. 10 | 11 | ;; This program is distributed in the hope that it will be useful, 12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ;; GNU General Public License for more details. 15 | 16 | ;; You should have received a copy of the GNU General Public License 17 | ;; along with this program. If not, see . 18 | 19 | ;;; Commentary: 20 | ;; Use `dap-overlays--make-overlay' to place a generic overlay at point. Or use 21 | ;; `dap-overlays--make-result-overlay' to place an interactive eval result overlay at 22 | 23 | ;;; Code: 24 | 25 | (require 'subr-x) 26 | (require 'cl-lib) 27 | 28 | 29 | ;;; Customization 30 | (defface dap-result-overlay-face 31 | '((((class color) (background light)) 32 | :background "grey90" :box (:line-width -1 :color "yellow")) 33 | (((class color) (background dark)) 34 | :background "grey10" :box (:line-width -1 :color "black"))) 35 | "Face used to display evaluation results at the end of line. 36 | If `dap-overlays-use-font-lock' is non-nil, this face is 37 | applied with lower priority than the syntax highlighting." 38 | :group 'dap 39 | :package-version '(dap "0.9.1")) 40 | 41 | (defcustom dap-overlays-use-font-lock t 42 | "If non-nil, results overlays are font-locked as code. 43 | If nil, apply `dap-result-overlay-face' to the entire overlay instead of 44 | font-locking it." 45 | :group 'dap 46 | :type 'boolean 47 | :package-version '(dap . "0.10.0")) 48 | 49 | (defcustom dap-overlays-use-overlays 'both 50 | "Whether to display evaluation results with overlays. 51 | If t, use overlays. If nil, display on the echo area. If both, display on 52 | both places. 53 | 54 | Only applies to evaluation commands. To configure the debugger overlays, 55 | see `dap-debug-use-overlays'." 56 | :type '(choice (const :tag "End of line" t) 57 | (const :tag "Bottom of screen" nil) 58 | (const :tag "Both" both)) 59 | :group 'dap 60 | :package-version '(dap . "0.10.0")) 61 | 62 | (defcustom dap-overlays-eval-result-prefix "=> " 63 | "The prefix displayed in the minibuffer before a result value." 64 | :type 'string 65 | :group 'dap 66 | :package-version '(dap . "0.5.0")) 67 | 68 | (defcustom dap-overlays-eval-result-duration 'command 69 | "Duration, in seconds, of DAP's eval-result overlays. 70 | If nil, overlays last indefinitely. 71 | If the symbol `command', they're erased after the next command. 72 | Also see `dap-overlays-use-overlays'." 73 | :type '(choice (integer :tag "Duration in seconds") 74 | (const :tag "Until next command" command) 75 | (const :tag "Last indefinitely" nil)) 76 | :group 'dap 77 | :package-version '(dap . "0.10.0")) 78 | 79 | 80 | ;;; Overlay logic 81 | (defun dap-overlays--delete-overlay (ov &rest _) 82 | "Safely delete overlay OV. 83 | Never throws errors, and can be used in an overlay's modification-hooks." 84 | (ignore-errors (delete-overlay ov))) 85 | 86 | (defun dap-overlays--make-overlay (l r type &rest props) 87 | "Place an overlay between L and R and return it. 88 | TYPE is a symbol put on the overlay's category property. It is used to 89 | easily remove all overlays from a region with: 90 | (remove-overlays start end `category TYPE) 91 | PROPS is a plist of properties and values to add to the overlay." 92 | (let ((o (make-overlay l (or r l) (current-buffer)))) 93 | (overlay-put o 'category type) 94 | (overlay-put o 'dap-temporary t) 95 | (while props (overlay-put o (pop props) (pop props))) 96 | (push #'dap-overlays--delete-overlay (overlay-get o 'modification-hooks)) 97 | o)) 98 | 99 | (defun dap-overlays--remove-result-overlay () 100 | "Remove result overlay from current buffer. 101 | This function also removes itself from `post-command-hook'." 102 | (remove-hook 'post-command-hook #'dap-overlays--remove-result-overlay 'local) 103 | (remove-overlays nil nil 'category 'result)) 104 | 105 | (defun dap-overlays--remove-result-overlay-after-command () 106 | "Add `dap-overlays--remove-result-overlay' locally to `post-command-hook'. 107 | This function also removes itself from `post-command-hook'." 108 | (remove-hook 'post-command-hook #'dap-overlays--remove-result-overlay-after-command 'local) 109 | (add-hook 'post-command-hook #'dap-overlays--remove-result-overlay nil 'local)) 110 | 111 | (cl-defun dap-overlays--make-result-overlay (value &rest props &key where duration (type 'result) 112 | (format (concat " " dap-overlays-eval-result-prefix "%s ")) 113 | (prepend-face 'dap-result-overlay-face) 114 | &allow-other-keys) 115 | "Place an overlay displaying VALUE at the end of line. 116 | VALUE is used as the overlay's after-string property, meaning it is 117 | displayed at the end of the overlay. The overlay itself is placed from 118 | beginning to end of current line. 119 | Return nil if the overlay was not placed or if it might not be visible, and 120 | return the overlay otherwise. 121 | 122 | Return the overlay if it was placed successfully, and nil if it failed. 123 | 124 | This function takes some optional keyword arguments: 125 | 126 | If WHERE is a number or a marker, apply the overlay over 127 | the entire line at that place (defaulting to `point'). If 128 | it is a cons cell, the car and cdr determine the start and 129 | end of the overlay. 130 | DURATION takes the same possible values as the 131 | `dap-overlays-eval-result-duration' variable. 132 | TYPE is passed to `dap-overlays--make-overlay' (defaults to `result'). 133 | FORMAT is a string passed to `format'. It should have 134 | exactly one %s construct (for VALUE). 135 | 136 | All arguments beyond these (PROPS) are properties to be used on the 137 | overlay." 138 | (declare (indent 1)) 139 | (while (keywordp (car props)) 140 | (setq props (cdr (cdr props)))) 141 | ;; If the marker points to a dead buffer, don't do anything. 142 | (let ((buffer (cond 143 | ((markerp where) (marker-buffer where)) 144 | ((markerp (car-safe where)) (marker-buffer (car where))) 145 | (t (current-buffer))))) 146 | (with-current-buffer buffer 147 | (save-excursion 148 | (when (number-or-marker-p where) 149 | (goto-char where)) 150 | ;; Make sure the overlay is actually at the end of the sexp. 151 | (skip-chars-backward "\r\n[:blank:]") 152 | (let* ((beg (if (consp where) 153 | (car where) 154 | (save-excursion 155 | (backward-sexp 1) 156 | (point)))) 157 | (end (if (consp where) 158 | (cdr where) 159 | (line-end-position))) 160 | (display-string (format format value)) 161 | (o nil)) 162 | (remove-overlays beg end 'category type) 163 | (funcall (if dap-overlays-use-font-lock 164 | #'font-lock-prepend-text-property 165 | #'put-text-property) 166 | 0 (length display-string) 167 | 'face prepend-face 168 | display-string) 169 | ;; If the display spans multiple lines or is very long, display it at 170 | ;; the beginning of the next line. 171 | (when (or (string-match "\n." display-string) 172 | (> (string-width display-string) 173 | (- (window-width) (current-column)))) 174 | (setq display-string (concat " \n" display-string))) 175 | ;; Put the cursor property only once we're done manipulating the 176 | ;; string, since we want it to be at the first char. 177 | (put-text-property 0 1 'cursor 0 display-string) 178 | (when (> (string-width display-string) (* 3 (window-width))) 179 | (setq display-string 180 | (concat (substring display-string 0 (* 3 (window-width))) 181 | (substitute-command-keys 182 | "...\nResult truncated. Type `\\[dap-inspect-last-result]' to inspect it.")))) 183 | ;; Create the result overlay. 184 | (setq o (apply #'dap-overlays--make-overlay 185 | beg end type 186 | 'after-string display-string 187 | props)) 188 | (pcase duration 189 | ((pred numberp) (run-at-time duration nil #'dap-overlays--delete-overlay o)) 190 | (`command 191 | ;; If inside a command-loop, tell `dap-overlays--remove-result-overlay' 192 | ;; to only remove after the *next* command. 193 | (if this-command 194 | (add-hook 'post-command-hook 195 | #'dap-overlays--remove-result-overlay-after-command 196 | nil 'local) 197 | (dap-overlays--remove-result-overlay-after-command)))) 198 | (when-let (win (get-buffer-window buffer)) 199 | ;; Left edge is visible. 200 | (when (and (<= (window-start win) (point) (window-end win)) 201 | ;; Right edge is visible. This is a little conservative 202 | ;; if the overlay contains line breaks. 203 | (or (< (+ (current-column) (string-width value)) 204 | (window-width win)) 205 | (not truncate-lines))) 206 | o))))))) 207 | 208 | 209 | ;;; Displaying eval result 210 | (defun dap-overlays--display-interactive-eval-result (value &optional point) 211 | "Display the result VALUE of an interactive eval operation. 212 | VALUE is syntax-highlighted and displayed in the echo area. 213 | If POINT and `dap-use-overlays' are non-nil, it is also displayed in an 214 | overlay at the end of the line containing POINT. 215 | Note that, while POINT can be a number, it's preferable to be a marker, as 216 | that will better handle some corner cases where the original buffer is not 217 | focused." 218 | (let* ((font-value value) 219 | (used-overlay (when (and point dap-overlays-use-overlays) 220 | (dap-overlays--make-result-overlay font-value 221 | :where point 222 | :duration dap-overlays-eval-result-duration)))) 223 | (message 224 | "%s" 225 | (propertize (format "%s%s" dap-overlays-eval-result-prefix font-value) 226 | ;; The following hides the message from the echo-area, but 227 | ;; displays it in the Messages buffer. We only hide the message 228 | ;; if the user wants to AND if the overlay succeeded. 229 | 'invisible (and used-overlay 230 | (not (eq dap-overlays-use-overlays 'both))))))) 231 | 232 | (provide 'dap-overlays) 233 | ;;; dap-overlays.el ends here 234 | -------------------------------------------------------------------------------- /dap-php.el: -------------------------------------------------------------------------------- 1 | ;;; dap-php.el --- Debug Adapter Protocol mode for Php -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2018 Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski 6 | ;; Author: Thomas Regner 7 | ;; Keywords: languages 8 | 9 | ;; This program is free software; you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; This program is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | ;;; Commentary: 23 | ;; Adapter for https://github.com/felixfbecker/vscode-php-debug 24 | 25 | ;;; Code: 26 | 27 | (require 'dap-mode) 28 | (require 'dap-utils) 29 | 30 | (defcustom dap-php-debug-path (expand-file-name "vscode/xdebug.php-debug" dap-utils-extension-path) 31 | "The path to php-debug vscode extension." 32 | :group 'dap-php 33 | :type 'string) 34 | 35 | (defcustom dap-php-debug-program `("node" 36 | ,(f-join dap-php-debug-path "extension/out/phpDebug.js")) 37 | "The path to the php debugger." 38 | :group 'dap-php 39 | :type '(repeat string)) 40 | 41 | (dap-utils-vscode-setup-function "dap-php" "xdebug" "php-debug" dap-php-debug-path) 42 | 43 | (defun dap-php--populate-start-file-args (conf) 44 | "Populate CONF with the required arguments." 45 | (-> conf 46 | (dap--put-if-absent :dap-server-path dap-php-debug-program) 47 | (dap--put-if-absent :type "node") 48 | (dap--put-if-absent :cwd (lsp-find-session-folder (lsp-session) (buffer-file-name))) 49 | (dap--put-if-absent :name "Php Debug"))) 50 | 51 | (dap-register-debug-provider "php" 'dap-php--populate-start-file-args) 52 | 53 | (dap-register-debug-template "Php Run Configuration" 54 | (list :type "php" 55 | :cwd nil 56 | :request "launch" 57 | :name "Php Debug" 58 | :args '("--server=4711") 59 | :sourceMaps t)) 60 | 61 | (dap-register-debug-template "Php Stop On Entry" 62 | (list :type "php" 63 | :cwd nil 64 | :request "launch" 65 | :name "Php SOE Debug" 66 | :stopOnEntry t 67 | :sourceMaps t)) 68 | 69 | (provide 'dap-php) 70 | ;;; dap-php.el ends here 71 | -------------------------------------------------------------------------------- /dap-pwsh.el: -------------------------------------------------------------------------------- 1 | ;;; dap-pwsh.el --- Debug Adapter Protocol mode for Pwsh -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2019 Kien Nguyen 4 | 5 | ;; Author: Kien Nguyen 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;;; Code: 24 | 25 | (require 'dap-mode) 26 | (require 'lsp-pwsh) 27 | (require 'f) 28 | (require 'dash) 29 | 30 | (defgroup dap-pwsh nil 31 | "Debugger support for PowerShell." 32 | :group 'dap-mode 33 | :package-version '(dap-mode . "0.2")) 34 | 35 | (defcustom dap-pwsh-program 36 | `(,lsp-pwsh-exe "-NoProfile" "-NonInteractive" "-NoLogo" 37 | ,@(if (eq system-type 'windows-nt) '("-ExecutionPolicy" "Bypass")) 38 | "-OutputFormat" "Text" 39 | "-File" 40 | ,(f-join lsp-pwsh-dir "PowerShellEditorServices/Start-EditorServices.ps1") 41 | "-HostName" "'Emacs Host'" 42 | "-HostProfileId" "'Emacs.LSP'" 43 | "-HostVersion" "0.1" 44 | "-LogPath" ,(f-join lsp-pwsh-log-path "emacs-powershell-debug.log") 45 | "-LogLevel" ,lsp-pwsh-developer-editor-services-log-level 46 | "-SessionDetailsPath" 47 | ,(format "%s/PSES-VSCode-%d-Debug" lsp-pwsh-log-path lsp-pwsh--sess-id) 48 | ;; "-AdditionalModules" "@('PowerShellEditorServices.VSCode')" 49 | "-Stdio" 50 | "-DebugServiceOnly" 51 | "-BundledModulesPath" ,lsp-pwsh-dir 52 | "-FeatureFlags" "@()") 53 | "The command to run the pwsh debugger." 54 | :group 'dap-pwsh 55 | :type '(repeat string)) 56 | 57 | (defun dap-pwsh--populate-start-file-args (conf) 58 | "Populate CONF with the required arguments." 59 | (-> conf 60 | (dap--put-if-absent :dap-server-path dap-pwsh-program) 61 | (dap--put-if-absent :type "PowerShell") 62 | (dap--put-if-absent :cwd (lsp-find-session-folder (lsp-session) (buffer-file-name))) 63 | (dap--put-if-absent :script (read-file-name "Select the file to run:" nil (buffer-file-name) t)) 64 | (dap--put-if-absent :name "PowerShell: Debug") 65 | (dap--put-if-absent :args []))) 66 | 67 | (dap-register-debug-provider "PowerShell" #'dap-pwsh--populate-start-file-args) 68 | 69 | (dap-register-debug-template "PowerShell: Launch Script" 70 | (list :type "PowerShell" 71 | :cwd nil 72 | :request "launch" 73 | :script nil 74 | :args nil 75 | :name "PowerShell: Launch Script")) 76 | 77 | (provide 'dap-pwsh) 78 | ;;; dap-pwsh.el ends here 79 | -------------------------------------------------------------------------------- /dap-ruby.el: -------------------------------------------------------------------------------- 1 | ;;; dap-ruby.el --- Debug Adapter Protocol mode for Ruby -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2018 Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for https://github.com/rubyide/vscode-ruby 23 | 24 | ;;; Code: 25 | 26 | (require 'dap-mode) 27 | (require 'dap-utils) 28 | 29 | (defcustom dap-ruby-debug-path (expand-file-name "vscode/rebornix.Ruby" dap-utils-extension-path) 30 | "The path to ruby vscode extension." 31 | :group 'dap-ruby 32 | :type 'string) 33 | 34 | (defcustom dap-ruby-debug-program `("node" 35 | ,(f-join dap-ruby-debug-path "extension/dist/debugger/main.js")) 36 | "The path to the ruby debugger." 37 | :group 'dap-ruby 38 | :type '(repeat string)) 39 | 40 | (dap-utils-vscode-setup-function "dap-ruby" "rebornix" "Ruby" dap-ruby-debug-path) 41 | 42 | (defun dap-ruby--populate-start-file-args (conf) 43 | "Populate CONF with the required arguments." 44 | (-> conf 45 | (dap--put-if-absent :dap-server-path dap-ruby-debug-program) 46 | (dap--put-if-absent :type "Ruby") 47 | (dap--put-if-absent :cwd default-directory) 48 | (dap--put-if-absent :program (buffer-file-name)) 49 | (dap--put-if-absent :name "Ruby Debug"))) 50 | 51 | (dap-register-debug-provider "Ruby" 'dap-ruby--populate-start-file-args) 52 | (dap-register-debug-template "Ruby Run Configuration" 53 | (list :type "Ruby" 54 | :cwd nil 55 | :request "launch" 56 | :program nil 57 | :name "Ruby::Run")) 58 | 59 | (provide 'dap-ruby) 60 | ;;; dap-ruby.el ends here 61 | -------------------------------------------------------------------------------- /dap-swi-prolog.el: -------------------------------------------------------------------------------- 1 | ;;; dap-swi-prolog.el --- Debug Adapter Protocol mode for SWI-Prolog -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2022 Eshel Yaron 4 | 5 | ;; Author: Eshel Yaron 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for https://www.swi-prolog.org 23 | 24 | ;;; Code: 25 | 26 | (require 'dap-mode) 27 | 28 | (defcustom dap-swi-prolog-debug-program 29 | '("swipl" "-g" "[library(debug_adapter/main)]" "-t" "halt") 30 | "The path to the SWI-Prolog debug adapter." 31 | :group 'dap-swi-prolog 32 | :type '(repeat string)) 33 | 34 | (defun dap-swi-prolog--populate-start-file-args (conf) 35 | "Populate CONF with the required arguments." 36 | (let ((conf (-> conf 37 | (dap--put-if-absent :dap-server-path dap-swi-prolog-debug-program) 38 | (dap--put-if-absent :type "swi-prolog") 39 | (dap--put-if-absent :cwd default-directory) 40 | (dap--put-if-absent :module (buffer-file-name)) 41 | (dap--put-if-absent :goal (read-string "?- " nil nil "true")) 42 | (dap--put-if-absent :name "SWI-Prolog Debug")))) 43 | conf)) 44 | 45 | (dap-register-debug-provider "swi-prolog" #'dap-swi-prolog--populate-start-file-args) 46 | 47 | (dap-register-debug-template "SWI-Prolog Run Configuration" 48 | (list :type "swi-prolog" 49 | :request "launch" 50 | :name "SWI-Prolog::Run")) 51 | (dap-register-debug-template "SWI-Prolog Start Terminal" 52 | (list :type "swi-prolog" 53 | :goal "$run_in_terminal" 54 | :request "launch" 55 | :name "SWI-Prolog::Terminal")) 56 | 57 | (defun dap-swi-prolog--populate-start-tcp-args (conf) 58 | "Populate CONF with the required arguments." 59 | (let ((conf (-> conf 60 | (dap--put-if-absent :host "localhost") 61 | (dap--put-if-absent :debugServer 3443) 62 | (dap--put-if-absent :request "attach") 63 | (dap--put-if-absent :name "SWI-Prolog::Connected")))) 64 | conf)) 65 | 66 | (dap-register-debug-provider "swi-prolog-tcp" #'dap-swi-prolog--populate-start-tcp-args) 67 | 68 | (provide 'dap-swi-prolog) 69 | ;;; dap-swi-prolog.el ends here 70 | -------------------------------------------------------------------------------- /dap-tasks.el: -------------------------------------------------------------------------------- 1 | ;;; dap-tasks.el --- support tasks.json -*- lexical-binding: t -*- 2 | 3 | ;; Copyright (C) 2022 Ellis Kenyo 4 | 5 | ;; Author: Ellis Kenyo 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Extend dap-mode with support for tasks.json files 23 | 24 | ;;; Code: 25 | 26 | (require 'lsp-mode) 27 | (require 'json) 28 | 29 | (declare-function dap-variables-find-vscode-config "dap-variables" (f root)) 30 | (defun dap-tasks-find-tasks-json () 31 | "Return the path to current project's launch.json file. 32 | Yields nil if it cannot be found or there is no project." 33 | (when-let ((root (lsp-workspace-root))) 34 | (require 'dap-variables) 35 | (dap-variables-find-vscode-config "tasks.json" root))) 36 | 37 | (defun dap-tasks-get-tasks-json () 38 | "Parse the project's launch.json as json data and return the result." 39 | (when-let ((tasks-json (dap-tasks-find-tasks-json)) 40 | (json-object-type 'plist) 41 | ;; Use 'vector instead of 'list. With 'list for array type, 42 | ;; json-encode-list interpreted a list with one plist element as 43 | ;; an alist. Using 'list, it turned the following value of 44 | ;; pathMappings: 45 | ;; 46 | ;; "pathMappings": [ 47 | ;; { 48 | ;; "localRoot": "${workspaceFolder}", 49 | ;; "remoteRoot": "." 50 | ;; } 51 | ;; ] 52 | ;; 53 | ;; into: 54 | ;; 55 | ;; ((:localRoot "${workspaceFolder}" :remoteRoot ".")) 56 | ;; 57 | ;; and then into: 58 | ;; 59 | ;; "pathMappings": { 60 | ;; "localRoot": [ 61 | ;; "${workspaceFolder}", 62 | ;; "remoteRoot", 63 | ;; "." 64 | ;; ] 65 | ;; } 66 | (json-array-type 'vector)) 67 | (require 'dap-utils) 68 | (with-temp-buffer 69 | ;; NOTE: insert-file-contents does not move point 70 | (insert-file-contents tasks-json) 71 | (dap-utils-sanitize-json) 72 | ;; dap-tasks-remove-comments does move point 73 | (goto-char (point-min)) 74 | 75 | (json-read)))) 76 | 77 | (defun dap-tasks--get-key (key conf) 78 | "Given a KEY, attempt to get a value from a debug CONF. 79 | The order of presedence within vscode is: 80 | - OS properties 81 | - Global properties 82 | - Local properties" 83 | (or (plist-get (plist-get conf (dap-utils-string-to-keyword (dap-utils-get-os-key))) key) 84 | (plist-get (dap-tasks-configuration-get-all) key) 85 | (plist-get conf key))) 86 | 87 | (defun dap-tasks-configuration-get-name (conf) 88 | "Return the name of launch configuration CONF." 89 | (plist-get conf :label)) 90 | 91 | (defun dap-tasks-configuration-get-command (conf) 92 | "Get the command to be run for the task configuration." 93 | (if (string= "npm" (plist-get conf :type)) 94 | (concat "npm run " (plist-get conf :script)) 95 | (concat 96 | (dap-tasks--get-key :command conf) 97 | " " 98 | (mapconcat #'identity (dap-tasks--get-key :args conf) " ")))) 99 | 100 | (defun dap-tasks-get-configuration-by-label (label) 101 | "Given a LABEL, return a task or nil if no task was found in TASKS." 102 | (-first (lambda (task) 103 | (string= label (dap-tasks-configuration-get-name task))) (dap-tasks-configuration-get-all))) 104 | 105 | (defun dap-tasks-configuration-get-depends (conf) 106 | "Given a debug CONF, get an ordered list of all the dependant tasks." 107 | (cl-labels ((loop-fn (confs tasks) 108 | "Loop through TASKS to find all dependants." 109 | (-when-let* ((deps (-mapcat (lambda (task) 110 | (-if-let* (((&plist :dependsOn) task)) 111 | (if (stringp dependsOn) 112 | (loop-fn 113 | (list (dap-tasks-get-configuration-by-label dependsOn)) 114 | (append (list (dap-tasks-get-configuration-by-label dependsOn)) tasks)) 115 | (loop-fn 116 | (cl-map 'list #'dap-tasks-get-configuration-by-label (append dependsOn nil)) 117 | (append (cl-map 'list #'dap-tasks-get-configuration-by-label (append dependsOn nil)) tasks))) 118 | task)) 119 | confs))) 120 | (cl-remove-duplicates 121 | (append deps tasks) 122 | :test (lambda (lhs rhs) 123 | (string= (plist-get lhs :label) (plist-get rhs :label))))))) 124 | (-filter #'listp (loop-fn `(,conf) `(,conf))))) 125 | 126 | (defun dap-tasks-configuration-prepend-name (conf) 127 | "Prepend the name of CONF to it as a string. 128 | Extract the name from the :name property." 129 | (push (dap-tasks-configuration-get-name conf) conf)) 130 | 131 | (defun dap-tasks-parse-tasks-json (json) 132 | "Return a list of all task configurations in JSON. 133 | JSON must have been acquired with `dap-tasks--get-tasks-json'." 134 | (plist-get json :tasks)) 135 | 136 | (defun dap-tasks-find-parse-tasks-json () 137 | "Return a list of all task configurations for the current project. 138 | Usable as a dap-tasks-configuration-providers backend." 139 | (when-let ((tasks-json (dap-tasks-get-tasks-json))) 140 | (dap-tasks-parse-tasks-json tasks-json))) 141 | 142 | (defun dap-tasks-configuration-get-all () 143 | "Get all applicable tasks from `dap-tasks-configuration-providers'." 144 | (cl-map 'list #'dap-variables-expand-in-launch-configuration (-mapcat #'funcall dap-tasks-configuration-providers))) 145 | 146 | (provide 'dap-tasks) 147 | ;;; dap-tasks.el ends here 148 | -------------------------------------------------------------------------------- /dap-unity.el: -------------------------------------------------------------------------------- 1 | ;;; dap-unity.el --- Debug Adapter Protocol mode for Unity -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2022 Owen Robertson 4 | 5 | ;; Author: Owen Robertson 6 | ;; Keywords: languages 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | ;; Adapter for https://marketplace.visualstudio.com/items?itemName=Unity.unity-debug 23 | 24 | ;;; Code: 25 | 26 | (require 'dap-mode) 27 | (require 'dap-utils) 28 | 29 | (defcustom dap-unity-debug-path (expand-file-name "vscode/Unity.unity-debug" 30 | dap-utils-extension-path) 31 | "The path to unity-debug vscode extension." 32 | :group 'dap-unity 33 | :type 'string) 34 | 35 | (defcustom dap-unity-debug-program (expand-file-name "extension/bin/UnityDebug.exe" 36 | dap-unity-debug-path) 37 | "The path to the unity debugger." 38 | :group 'dap-unity 39 | :type 'string) 40 | 41 | (dap-utils-vscode-setup-function "dap-unity" "Unity" "unity-debug" 42 | dap-unity-debug-path 43 | nil 44 | (lambda () ;; After adapter is downloaded, flag the debugger as executable 45 | (unless (eq system-type 'windows-nt) 46 | (shell-command 47 | (concat "chmod u+x " dap-unity-debug-program))))) 48 | 49 | (defun dap-unity--populate-start-file-args (conf) 50 | "Populate CONF with the required arguments." 51 | (setq conf (-> conf 52 | (plist-put :type "unity") 53 | (plist-put :dap-server-path (list dap-unity-debug-program))))) 54 | 55 | (dap-register-debug-provider "unity" #'dap-unity--populate-start-file-args) 56 | 57 | (dap-register-debug-template "Unity Editor" 58 | (list :type "unity" 59 | :request "launch" 60 | :name "Unity Editor")) 61 | 62 | (provide 'dap-unity) 63 | ;;; dap-unity.el ends here 64 | -------------------------------------------------------------------------------- /docs/page/adding-debug-server.md: -------------------------------------------------------------------------------- 1 | # Extending DAP with new Debug servers 2 | 3 | There are two methods that are used for registering remote extensions: 4 | 5 | - `dap-register-debug-provider` - register a method to call for 6 | populating startup parameters. It should either populate 7 | `:debugPort` and `:host` in case of TCP Debug Adapter Server or 8 | `:dap-server-path` when STD out must be used for Debug Adapter 9 | Server communication. 10 | - `dap-register-debug-template` register a debug template which will 11 | be available when `dap-debug` is called. The debug template must 12 | specify `:type` key which will be used to determine the provider to 13 | be called to populate missing fields. 14 | 15 | Example 16 | 17 | For full example you may check `dap-java.el`. 18 | 19 | ``` elisp 20 | (dap-register-debug-provider 21 | "programming-language-name" 22 | (lambda (conf) 23 | (plist-put conf :debugPort 1234) 24 | (plist-put conf :host "localhost") 25 | conf)) 26 | 27 | (dap-register-debug-template "Example Configuration" 28 | (list :type "java" 29 | :request "launch" 30 | :args "" 31 | :name "Run Configuration")) 32 | ``` 33 | -------------------------------------------------------------------------------- /docs/page/clojure.md: -------------------------------------------------------------------------------- 1 | Clojure debugging and introspecting Java Code 2 | ============================================== 3 | 4 | One of the limitations of Cider is that it does not support debugging Java(or it is not very easy to do so). This page provides information on how to do that using `dap-mode` 5 | As a bonus, it will also enable navigation through java code like finding definitions, references, implementations, etc. 6 | 7 | ## Java code navigation 8 | 9 | 1. Follow the guides on installing `lsp-java`. If you are `Spacemacs` user you need to add the following layers `dap`,`lsp`, `(lsp-java :variables java-backend 'lsp)`. `lsp-java` automatically downloads all required server-side components(`JDT Language Server`, `Java Debug Adapter` and `JUnit Test Runner`). 10 | 2. Go to the root of your project and do 11 | ``` bash 12 | lein pom 13 | ``` 14 | 3. Open a file from your project and do `C-u`- `M-x` - `lsp` which will prompt you to select a server to start, select `jdtls` server. Once the server has started(the initialization may take some time since JDT LS is downloading sources) you may call `xref-appropos` and open type a Java Type like `ArrayList` or `PersistentList`. When you are in java file you can inspect documentation, look for class implementations, references and so on. 15 | 4. Invoke `xref-apropos`, type a Java class name and then you can set breakpoints, go to definitions, find references, etc. 16 | 17 | ### Implementations of `clojure.lang.IReduce` 18 | ![Debug cider](../screenshots/implementations.png) 19 | 20 | ## Debugging 21 | 1. Configure cider to start nrepl with remote debugging enabled and do `cider-jack-in` 22 | 23 | ```emacs-lisp 24 | (setenv "JAVA_OPTS" "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044") 25 | ``` 26 | 27 | 2. Call `dap-debug` and select `Java Attach configuration` and enter port 1044 (the same port as the port above.). 28 | 3. Go to java class and place a breakpoint using `dap-breakpoint-toggle`. 29 | 30 | ### Debugging in progress 31 | ![Debug cider](../screenshots/debug.png) 32 | 33 | -------------------------------------------------------------------------------- /docs/page/features.md: -------------------------------------------------------------------------------- 1 | Features 2 | ======== 3 | 4 | - Launch/Attach 5 | - Breakpoints 6 | - Exceptions 7 | - Pause & Continue 8 | - Step In/Out/Over 9 | - Callstacks 10 | - Threads 11 | - Multiple simultaneous debug sessions 12 | - Evaluating statements 13 | - Debug/Run configurations (also with launch.json files) 14 | - Expressions 15 | 16 | ## Debugger commands 17 | 18 | | Command | Description | 19 | | ------------------------------ | --------------------------------------------------------------- | 20 | | `dap-breakpoint-toggle` | Toggle breakpoint at line | 21 | | `dap-breakpoint-delete` | Delete breakpoint at line | 22 | | `dap-breakpoint-add` | Add breakpoint at line | 23 | | `dap-breakpoint-condition` | Set/unset breakpoint condition | 24 | | `dap-breakpoint-hit-condition` | Set/unset breakpoint hit condition | 25 | | `dap-breakpoint-log-message` | Set/unset breakpoint log message | 26 | | `dap-eval` | Eval string | 27 | | `dap-eval-region` | Eval region string | 28 | | `dap-eval-thing-at-point` | Eval symbol at point | 29 | | `dap-step-in` | Debug step in | 30 | | `dap-next` | Debug next | 31 | | `dap-step-out` | Debug step out | 32 | | `dap-stop-thread` | Stop thread | 33 | | `dap-restart-frame` | Restart frame | 34 | | `dap-continue` | Debug continue | 35 | | `dap-disconnect` | Cancel current debug session | 36 | | `dap-switch-stack-frame` | Switch active stack frame | 37 | | `dap-switch-thread` | Switch active thread | 38 | | `dap-switch-session` | Switch active session | 39 | | `dap-debug-edit-template` | Generate run command | 40 | | `dap-debug` | Create and run new configuration using the available templates | 41 | | `dap-debug-last` | Debug previous configuration | 42 | | `dap-debug-recent` | Select configuration to run from the previously started command | 43 | | `dap-go-to-output-buffer` | Go output buffer | 44 | 45 | ## Windows 46 | 47 | | Command | Description | 48 | | -------------------- | ------------------------------------ | 49 | | `dap-ui-sessions` | Show active/terminated sessions view | 50 | | `dap-ui-locals` | Show locals view | 51 | | `dap-ui-expressions` | Show expressions view | 52 | | `dap-ui-breakpoints` | Show breakpoints view | 53 | | `dap-ui-repl` | DAP UI REPL | 54 | 55 | ## Sessions 56 | 57 | The session view is shown after invoking `dap-ui-sessions` . It 58 | represents the list of the active sessions. 59 | 60 | ## Locals 61 | 62 | Locals can be viewed after invoking `dap-ui-locals`. 63 | 64 | ## Expressions 65 | 66 | Watch expressions can be viewed after invoking `dap-ui-expressions`. You 67 | could add remove watch expressions via `dap-ui-expressions-add` and 68 | `dap-ui-expressions-remove`. 69 | 70 | ## Breakpoints 71 | 72 | Breakpoints can be viewed after invoking `dap-ui-breakpoints`. 73 | 74 | 1. Keybindings 75 | 76 | | Command | Description | Keybindings | 77 | | ------------------------------------ | ------------------------------ | ----------- | 78 | | `dap-ui-breakpoints-goto` | Go to breakpoint under cursor | \ | 79 | | `dap-ui-breakpoints-delete` | Delete breakpoint under cursor | d | 80 | | `dap-ui-breakpoints-delete-selected` | Delete selected breakpoints | D | 81 | | `bui-list-mark` | Mark breakpoint under point | m | 82 | | `bui-list-unmark` | Unmark breakpoint under point | u | 83 | | `bui-list-unmark-all` | Unmark breakpoint under point | U | 84 | 85 | 86 | ## Loaded sources 87 | 88 | Loaded sources can be viewed by invoking `dap-ui-loaded-sources`. 89 | 90 | ## DAP debug REPL 91 | 92 | DAP provides a debug shell to execute commands when the program has hit 93 | breakpoints. The REPL has the same features as regular emacs shells 94 | (e.g. command history, `C-p/n` navigation through history, etc.) in 95 | addition to optional `company-mode` autocompletion. 96 | ![](screenshots/dap-ui-repl.png) 97 | 98 | ## launch.json support 99 | 100 | DAP supports `launch.json` files out of the box, and there is nothing that needs 101 | to be enabled. All that needs to be done is to add a `launch.json` file at the 102 | project root or the `.vscode` directory within the project root 103 | and to run `dap-debug`. All configurations stored in the 104 | `launch.json` will automatically show up in the selection. `launch.json` files in 105 | DAP are just like in VSCode and even support variables. See: 106 | 107 | - [launch.json](https://code.visualstudio.com/docs/editor/debugging) 108 | - [launch.json variables](https://code.visualstudio.com/docs/editor/variables-reference) 109 | 110 | ## Compiling the project before debugging 111 | 112 | Many modern IDEs, for example Eclipse and VSCode (`preLaunchTask`), provide 113 | functionality to compile the project before starting the debug session. 114 | 115 | `dap-mode` also has such a feature: the `:dap-compilation` property of launch 116 | configurations ("dap-compilation" in `launch.json`) specifies a shell command 117 | that needs to execute successfully before the debug session is started. 118 | `:dap-compilation-dir` can be used to control where the compilation is started. 119 | 120 | In the future, we want to support VSCode's `preLaunchTask` instead, but 121 | currently there is no tasks.json-compatible task runner for Emacs. 122 | -------------------------------------------------------------------------------- /docs/page/gallery.md: -------------------------------------------------------------------------------- 1 | Gallery 2 | ======= 3 | 4 | ## Java 5 | 6 | ![Java](../screenshots/MultiSession.png) 7 | 8 | ## Flutter 9 | 10 | ![Flutter](../screenshots/flutter-debug.gif) 11 | 12 | ## Swift 13 | 14 | ![Swift](../screenshots/Swift.png) 15 | 16 | ## RUST 17 | 18 | ![RUST via Native Debug](../screenshots/rust.png) 19 | 20 | ## Go 21 | 22 | ![Go](../screenshots/go.png) 23 | 24 | ## Javascript 25 | 26 | ![Javascript via Firefox debugger](../screenshots/javascript.png) 27 | 28 | ## Erlang 29 | 30 | ![Erlang via Erlang LS](../screenshots/erlang.png) 31 | 32 | ## SWI-Prolog 33 | 34 | ![SWI-Prolog](../screenshots/swi-prolog.png) 35 | -------------------------------------------------------------------------------- /docs/page/how-to.md: -------------------------------------------------------------------------------- 1 | How to 2 | ====== 3 | 4 | ## Activate minor modes when stepping through code 5 | 6 | You may want to activate minor modes, e.g. `read-only-mode`, when the debugger is active in a buffer. If so, you could use a trick like this: 7 | 8 | ```elisp 9 | ;; -*- lexical-binding: t -*- 10 | (define-minor-mode +dap-running-session-mode 11 | "A mode for adding keybindings to running sessions" 12 | nil 13 | nil 14 | (make-sparse-keymap) 15 | (evil-normalize-keymaps) ;; if you use evil, this is necessary to update the keymaps 16 | ;; The following code adds to the dap-terminated-hook 17 | ;; so that this minor mode will be deactivated when the debugger finishes 18 | (when +dap-running-session-mode 19 | (let ((session-at-creation (dap--cur-active-session-or-die))) 20 | (add-hook 'dap-terminated-hook 21 | (lambda (session) 22 | (when (eq session session-at-creation) 23 | (+dap-running-session-mode -1))))))) 24 | 25 | ;; Activate this minor mode when dap is initialized 26 | (add-hook 'dap-session-created-hook '+dap-running-session-mode) 27 | 28 | ;; Activate this minor mode when hitting a breakpoint in another file 29 | (add-hook 'dap-stopped-hook '+dap-running-session-mode) 30 | 31 | ;; Activate this minor mode when stepping into code in another file 32 | (add-hook 'dap-stack-frame-changed-hook (lambda (session) 33 | (when (dap--session-running session) 34 | (+dap-running-session-mode 1)))) 35 | ``` 36 | 37 | ## Stop and delete sessions 38 | 39 | To kill a running debug session (and its inferior process), use the command `M-x 40 | dap-disconnect`. This will still show it as a dead (grayed out) debug session in 41 | `dap-ui-sessions`, and you will still be able to browse its output. If you want 42 | to kill the debug session and remove it from the session list, use `M-x 43 | dap-delete-session` instead. The latter command removes the last debug session 44 | (dead or alive) from the session list: if you run `dap-disconnect`, the last 45 | session will be a dead one, which you would remove by running `M-x 46 | dap-delete-session`. Sessions can be selectively deleted by putting the cursor 47 | on one of the sessions in `dap-ui-sessions` and pressing `D`. 48 | -------------------------------------------------------------------------------- /docs/page/python-poetry-pyenv.md: -------------------------------------------------------------------------------- 1 | Debugging Python when using Poetry and Pyenv 2 | ============================================== 3 | 4 | This guide is based on [this guide on reddit](https://www.reddit.com/r/emacs/comments/k5dsar/emacs_ide_for_python_setting_up_the_debugger_with/) 5 | 6 | One seemingly sane stack for Python development is [Poetry](https://github.com/python-poetry/poetry) + [Pyenv](https://github.com/pyenv/pyenv). 7 | To debug a project using poetry, start by running 8 | ``` bash 9 | poetry config virtualenvs.in-project true 10 | poetry add --group dev debugpy 11 | poetry install 12 | ``` 13 | Then, in emacs-land, install [with-venv](https://github.com/10sr/with-venv-el/tree/4a59ef8251f10ea772d4f504beeab08edf1f223e) 14 | and add the following snippet wherever you tend to add snippets: 15 | ``` emacs-lisp 16 | (use-package dap-mode 17 | :after lsp-mode 18 | :commands dap-debug 19 | :hook ((python-mode . dap-ui-mode) (python-mode . dap-mode)) 20 | :config 21 | (require 'dap-python) 22 | (setq dap-python-debugger 'debugpy) 23 | (defun dap-python--pyenv-executable-find (command) 24 | (with-venv (executable-find "python"))) 25 | 26 | (add-hook 'dap-stopped-hook 27 | (lambda (arg) (call-interactively #'dap-hydra)))) 28 | ``` 29 | 30 | You should now be able to debug your projects by calling `dap-hydra` as normal. 31 | -------------------------------------------------------------------------------- /docs/stylesheets/extra.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --md-primary-fg-color: #573688; 3 | --md-accent-fg-color: #923EBE; 4 | --md-default-fg-color--light: #7B58B0; 5 | } 6 | 7 | .md-footer { 8 | --md-default-fg-color: #573688; 9 | } 10 | 11 | .md-grid { 12 | max-width: 70rem; 13 | } 14 | 15 | .md-typeset a { 16 | color: #7B58B0; 17 | } 18 | -------------------------------------------------------------------------------- /features/BreakpointUI.feature: -------------------------------------------------------------------------------- 1 | Feature: Breakpoint UI tests 2 | 3 | Background: 4 | Given I have maven project "m" in "tmp" 5 | And I add project "m" folder "tmp" to the list of workspace folders 6 | And I open a java file "tmp/m/src/main/java/temp/App.java" 7 | And I clear the buffer 8 | And I insert: 9 | """ 10 | package temp; 11 | 12 | class App { 13 | public static void main(String[] args) { 14 | System.out.print(123); 15 | foo(); 16 | bar(); 17 | } 18 | 19 | static int foo() { 20 | new App(); 21 | return 10; 22 | } 23 | 24 | static int bar() { 25 | new App(); 26 | return 10; 27 | } 28 | 29 | } 30 | """ 31 | And I call "save-buffer" 32 | And I start lsp-java 33 | And The server status must become "^LSP[jdtls:[0-9]+]$" 34 | And I call "dap-ui-mode" 35 | 36 | @Breakpoints @UI 37 | Scenario: Inactive breakpoint 38 | When I place the cursor before "System" 39 | And I call "dap-toggle-breakpoint" 40 | Then I should see the following overlay "dap-ui-pending-breakpoint-face" 41 | 42 | @UI @Breakpoints 43 | Scenario: Cursor placement 44 | When I place the cursor before "System" 45 | And I call "dap-toggle-breakpoint" 46 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 47 | And I call "dap-java-debug" 48 | And The hook handler "breakpoint" would be called 49 | Then I should see the following overlay "dap-ui-marker-face" 50 | 51 | @UI @Breakpoints 52 | Scenario: Cursor removed - continue 53 | When I place the cursor before "System" 54 | And I call "dap-toggle-breakpoint" 55 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 56 | And I call "dap-java-debug" 57 | And The hook handler "breakpoint" would be called 58 | And I call "dap-continue" 59 | Then I should not see the following overlay "dap-ui-marker-face" 60 | 61 | @UI @Breakpoints 62 | Scenario: Cursor removed - next 63 | When I place the cursor before "System" 64 | Then I should not see the following overlay "dap-ui-marker-face" 65 | And I call "dap-toggle-breakpoint" 66 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 67 | And I call "dap-java-debug" 68 | And The hook handler "breakpoint" would be called 69 | And I call "dap-next" 70 | Then I should not see the following overlay "dap-ui-marker-face" 71 | 72 | @UI @Breakpoints 73 | Scenario: Cursor removed - step-in 74 | When I place the cursor before "System" 75 | And I call "dap-toggle-breakpoint" 76 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 77 | And I call "dap-java-debug" 78 | And The hook handler "breakpoint" would be called 79 | And I call "dap-step-in" 80 | Then I should not see the following overlay "dap-ui-marker-face" 81 | 82 | @UI @Breakpoints 83 | Scenario: Cursor removed - step-out 84 | When I place the cursor before "System" 85 | And I call "dap-toggle-breakpoint" 86 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 87 | And I call "dap-java-debug" 88 | And The hook handler "breakpoint" would be called 89 | And I call "dap-step-out" 90 | Then I should not see the following overlay "dap-ui-marker-face" 91 | 92 | @Breakpoints @UI @WIP 93 | Scenario: Verified breakpoint 94 | Given I place the cursor before "System" 95 | And I call "dap-toggle-breakpoint" 96 | And I place the cursor before "foo" 97 | And I call "dap-toggle-breakpoint" 98 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 99 | And I call "dap-java-debug" 100 | And The hook handler "breakpoint" would be called 101 | When I place the cursor before "foo" 102 | Then I should see the following overlay "dap-ui-verified-breakpoint-face" 103 | 104 | @Breakpoints @UI 105 | Scenario: Enabled breakpoint 106 | When I place the cursor before "System" 107 | And I call "dap-toggle-breakpoint" 108 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 109 | And I call "dap-java-debug" 110 | And The hook handler "breakpoint" would be called 111 | Then I should see the following overlay "dap-ui-verified-breakpoint-face" 112 | 113 | @Breakpoints @UI 114 | Scenario: Disable breakpoints after session shutdown 115 | When I place the cursor before "System" 116 | And I call "dap-toggle-breakpoint" 117 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 118 | And I call "dap-java-debug" 119 | And The hook handler "breakpoint" would be called 120 | And I attach handler "terminated" to hook "dap-terminated-hook" 121 | When I call "dap-continue" 122 | Then The hook handler "terminated" would be called 123 | And I should see the following overlay "dap-ui-pending-breakpoint-face" 124 | 125 | @Breakpoints @UI 126 | Scenario: Filter dead sessions. 127 | And I attach handler "terminated" to hook "dap-terminated-hook" 128 | And I call "dap-java-debug" 129 | Then The hook handler "terminated" would be called 130 | When I place the cursor before "System" 131 | And I call "dap-toggle-breakpoint" 132 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 133 | And I call "dap-java-debug" 134 | And The hook handler "breakpoint" would be called 135 | -------------------------------------------------------------------------------- /features/Breakpoints.feature: -------------------------------------------------------------------------------- 1 | Feature: Breakpoint tests 2 | 3 | Background: 4 | And I open a project file "test-project/src/main/java/temp/App.java" 5 | And The server status must become "^LSP[jdtls:[0-9]+]$" 6 | 7 | @Breakpoints 8 | Scenario: Breakpoint + continue 9 | When I place the cursor before "System" 10 | And I call "dap-breakpoint-toggle" 11 | And I go to beginning of buffer 12 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 13 | And I call "dap-java-debug" 14 | Then The hook handler "breakpoint" would be called 15 | And the cursor should be before " System" 16 | And I call "dap-continue" 17 | And I should see buffer "*out*" with content "123" 18 | 19 | @Breakpoints 20 | Scenario: Next 21 | When I place the cursor before "System" 22 | And I call "dap-breakpoint-add" 23 | And I go to beginning of buffer 24 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 25 | And I call "dap-java-debug" 26 | Then The hook handler "breakpoint" would be called 27 | And I attach handler "terminated" to hook "dap-terminated-hook" 28 | And I call "dap-java-debug" 29 | Then The hook handler "breakpoint" would be called 30 | And the cursor should be before " System" 31 | And I call "dap-disconnect" 32 | Then The hook handler "terminated" would be called 33 | 34 | @Breakpoints 35 | Scenario: Step out 36 | When I place the cursor before "new App" 37 | And I call "dap-breakpoint-add" 38 | And I go to beginning of buffer 39 | And I attach handler "stopped" to hook "dap-stopped-hook" 40 | And I call "dap-java-debug" 41 | Then The hook handler "stopped" would be called 42 | And the cursor should be before " new App" 43 | And I call "dap-step-out" 44 | Then The hook handler "stopped" would be called 45 | And the cursor should be before " foo()" 46 | And I call "dap-continue" 47 | And I should see buffer "*out*" with content "123" 48 | 49 | @Breakpoints 50 | Scenario: Two breakpoints 51 | When I place the cursor before "foo()" 52 | And I call "dap-breakpoint-toggle" 53 | And I place the cursor before "bar()" 54 | And I call "dap-breakpoint-toggle" 55 | And I go to beginning of buffer 56 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 57 | And I call "dap-java-debug" 58 | Then The hook handler "breakpoint" would be called 59 | And the cursor should be before " foo()" 60 | When I call "dap-continue" 61 | Then The hook handler "breakpoint" would be called 62 | And the cursor should be before " bar()" 63 | When I call "dap-continue" 64 | And I should see buffer "*out*" with content "123" 65 | 66 | @Breakpoints 67 | Scenario: Toggle(disable) breakpoint 68 | When I place the cursor before "System" 69 | And I call "dap-breakpoint-toggle" 70 | And I call "dap-breakpoint-toggle" 71 | And I call "dap-java-debug" 72 | And I should see buffer "*out*" with content "123" 73 | 74 | @Breakpoints 75 | Scenario: Toggle(disable) breakpoint when running 76 | When I place the cursor before "foo()" 77 | And I call "dap-breakpoint-toggle" 78 | And I place the cursor before "bar()" 79 | And I call "dap-breakpoint-toggle" 80 | And I go to beginning of buffer 81 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 82 | And I call "dap-java-debug" 83 | Then The hook handler "breakpoint" would be called 84 | And the cursor should be before " foo()" 85 | And I place the cursor before " bar()" 86 | And I call "dap-breakpoint-toggle" 87 | When I call "dap-continue" 88 | And I should see buffer "*out*" with content "123" 89 | 90 | @Breakpoints 91 | Scenario: Two breakpoints (enable second after starting) 92 | When I place the cursor before "foo()" 93 | And I call "dap-breakpoint-toggle" 94 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 95 | And I call "dap-java-debug" 96 | Then The hook handler "breakpoint" would be called 97 | And the cursor should be before " foo()" 98 | And I place the cursor before "bar()" 99 | And I call "dap-breakpoint-toggle" 100 | When I call "dap-continue" 101 | Then The hook handler "breakpoint" would be called 102 | And the cursor should be before " bar()" 103 | When I call "dap-continue" 104 | And I should see buffer "*out*" with content "123" 105 | 106 | @Breakpoints @Persistence 107 | Scenario: Toggle(disable) breakpoint when running 108 | When I place the cursor before "System" 109 | And I call "dap-breakpoint-toggle" 110 | And I kill buffer "App.java" 111 | And I open a project file "test-project/src/main/java/temp/App.java" 112 | And I start lsp-java 113 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 114 | And I call "dap-java-debug" 115 | Then The hook handler "breakpoint" would be called 116 | And the cursor should be before " System" 117 | And I call "dap-continue" 118 | And I should see buffer "*out*" with content "123" 119 | -------------------------------------------------------------------------------- /features/BreakpointsMultipleFilesUI.feature: -------------------------------------------------------------------------------- 1 | Feature: Breakpoint UI tests 2 | Background: 3 | Given I have maven project "m" in "tmp" 4 | And I add project "m" folder "tmp" to the list of workspace folders 5 | And I open a java file "tmp/m/src/main/java/temp/App.java" 6 | And I clear the buffer 7 | And I insert: 8 | """ 9 | package temp; 10 | 11 | class App { 12 | public static void main(String[] args) { 13 | System.out.print(123); 14 | } 15 | } 16 | """ 17 | And I call "save-buffer" 18 | And I start lsp-java 19 | And I open a java file "tmp/m/src/main/java/temp/Foo.java" 20 | And I clear the buffer 21 | And I insert: 22 | """ 23 | package temp; 24 | 25 | class Foo { 26 | public static void bar() { 27 | System.out.print(123); 28 | } 29 | } 30 | """ 31 | And I call "save-buffer" 32 | And I start lsp-java 33 | And The server status must become "^LSP[jdtls:[0-9]+]$" 34 | And I call "dap-ui-mode" 35 | 36 | @Breakpoints @UI 37 | Scenario: Open/close file workspace started/without debug session running. 38 | Given I switch to buffer "App.java" 39 | And I place the cursor before "System" 40 | And I call "dap-toggle-breakpoint" 41 | And I kill buffer "App.java" 42 | And I open a java file "tmp/m/src/main/java/temp/App.java" 43 | And I start lsp-java 44 | And I call "dap-ui-mode" 45 | When I place the cursor before "System" 46 | Then I should see the following overlay "dap-ui-pending-breakpoint-face" 47 | 48 | @Breakpoints @UI 49 | Scenario: Open/close file workspace started/with debug session running. 50 | Given I switch to buffer "App.java" 51 | And I place the cursor before "System" 52 | And I call "dap-toggle-breakpoint" 53 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 54 | And I call "dap-java-debug" 55 | And The hook handler "breakpoint" would be called 56 | And I kill buffer "App.java" 57 | And I open a java file "tmp/m/src/main/java/temp/App.java" 58 | And I start lsp-java 59 | And I call "dap-ui-mode" 60 | When I place the cursor before "System" 61 | Then I should see the following overlay "dap-ui-verified-breakpoint-face" 62 | -------------------------------------------------------------------------------- /features/BreakpointsTwoFiles.feature: -------------------------------------------------------------------------------- 1 | Feature: Breakpoint tests which require multiple files 2 | 3 | Background: 4 | Given I have maven project "m" in "tmp" 5 | And I add project "m" folder "tmp" to the list of workspace folders 6 | And I open a java file "tmp/m/src/main/java/temp/App.java" 7 | And I clear the buffer 8 | And I insert: 9 | """ 10 | package temp; 11 | 12 | class App { 13 | public static void main(String[] args) { 14 | Foo.bar(); 15 | } 16 | } 17 | """ 18 | And I call "save-buffer" 19 | And I start lsp-java 20 | And I open a java file "tmp/m/src/main/java/temp/Foo.java" 21 | And I clear the buffer 22 | And I insert: 23 | """ 24 | package temp; 25 | 26 | class Foo { 27 | public static void bar() { 28 | System.out.println(123); 29 | } 30 | } 31 | """ 32 | And I call "save-buffer" 33 | 34 | And I start lsp-java 35 | And The server status must become "^LSP[jdtls:[0-9]+]$" 36 | 37 | @Breakpoints 38 | Scenario: Breakpoints in two files 39 | Given I switch to buffer "App.java" 40 | And I place the cursor before "Foo.bar()" 41 | And I call "dap-toggle-breakpoint" 42 | Given I switch to buffer "Foo.java" 43 | And I place the cursor before "System" 44 | And I call "dap-toggle-breakpoint" 45 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 46 | And I call "dap-java-debug" 47 | Then The hook handler "breakpoint" would be called 48 | When I go in active window 49 | And the cursor should be before "Foo.bar()" 50 | When I call "dap-continue" 51 | Then The hook handler "breakpoint" would be called 52 | When I go in active window 53 | Then I should be in buffer "Foo.java" 54 | And the cursor should be before "System" 55 | And I call "dap-disconnect" 56 | -------------------------------------------------------------------------------- /features/DebugRun.feature: -------------------------------------------------------------------------------- 1 | Feature: Running without breakpoints 2 | 3 | @Running 4 | Scenario: Run without breakpoints 5 | Given I have maven project "m" in "tmp" 6 | And I add project "m" folder "tmp" to the list of workspace folders 7 | And I open a java file "tmp/m/src/main/java/temp/App.java" 8 | And I clear the buffer 9 | And I insert: 10 | """ 11 | package temp; 12 | 13 | class App { 14 | public static void main(String[] args) { 15 | System.out.print(123); 16 | } 17 | } 18 | """ 19 | And I call "save-buffer" 20 | And I start lsp-java 21 | And The server status must become "^LSP[jdtls:[0-9]+]$" 22 | And I attach handler "terminated" to hook "dap-terminated-hook" 23 | When I call "dap-java-debug" 24 | Then The hook handler "terminated" would be called 25 | And I should see buffer "*out*" with content "123" 26 | 27 | @Running 28 | Scenario: Run without breakpoints - select class to execute 29 | Given I have maven project "m" in "tmp" 30 | And I add project "m" folder "tmp" to the list of workspace folders 31 | And I open a java file "tmp/m/src/main/java/temp/App1.java" 32 | And I clear the buffer 33 | And I insert: 34 | """ 35 | package temp; 36 | 37 | class App1 { 38 | public static void main(String[] args) { 39 | System.out.print(1); 40 | } 41 | } 42 | """ 43 | And I call "save-buffer" 44 | And I start lsp-java 45 | And I open a java file "tmp/m/src/main/java/temp/App2.java" 46 | And I clear the buffer 47 | And I insert: 48 | """ 49 | package temp; 50 | 51 | class App2 { 52 | public static void main(String[] args) { 53 | System.out.print(2); 54 | } 55 | } 56 | """ 57 | And I call "save-buffer" 58 | And I start lsp-java 59 | And The server status must become "^LSP[jdtls:[0-9]+]$" 60 | And I attach handler "terminated" to hook "dap-terminated-hook" 61 | And I start an action chain 62 | And I press "M-x" 63 | When I type "dap-java-debug" 64 | And I press "" 65 | When I type "temp.App2" 66 | And I press "" 67 | And I execute the action chain 68 | Then The hook handler "terminated" would be called 69 | And I should see buffer "*out*" with content "2" 70 | And I start an action chain 71 | And I press "M-x" 72 | When I type "dap-java-debug" 73 | And I press "" 74 | When I type "temp.App1" 75 | And I press "" 76 | And I execute the action chain 77 | Then The hook handler "terminated" would be called 78 | And I should see buffer "*out*<2>" with content "1" 79 | 80 | @Running @WIP 81 | Scenario: Run last configuration 82 | Given I have maven project "m" in "tmp" 83 | And I add project "m" folder "tmp" to the list of workspace folders 84 | And I open a java file "tmp/m/src/main/java/temp/App1.java" 85 | And I clear the buffer 86 | And I insert: 87 | """ 88 | package temp; 89 | 90 | class App1 { 91 | public static void main(String[] args) { 92 | System.out.print(1); 93 | } 94 | } 95 | """ 96 | And I call "save-buffer" 97 | And I start lsp-java 98 | And I open a java file "tmp/m/src/main/java/temp/App2.java" 99 | And I clear the buffer 100 | And I insert: 101 | """ 102 | package temp; 103 | 104 | class App2 { 105 | public static void main(String[] args) { 106 | System.out.print(2); 107 | } 108 | } 109 | """ 110 | And I call "save-buffer" 111 | And I start lsp-java 112 | And The server status must become "^LSP[jdtls:[0-9]+]$" 113 | And I attach handler "terminated" to hook "dap-terminated-hook" 114 | And I start an action chain 115 | And I press "M-x" 116 | When I type "dap-java-debug" 117 | And I press "" 118 | When I type "temp.App2" 119 | And I press "" 120 | And I execute the action chain 121 | Then The hook handler "terminated" would be called 122 | And I should see buffer "*out*" with content "2" 123 | When I call "dap-debug-last-configuration" 124 | Then The hook handler "terminated" would be called 125 | And I should see buffer "*out*<2>" with content "2" 126 | -------------------------------------------------------------------------------- /features/Eval.feature: -------------------------------------------------------------------------------- 1 | Feature: Running without debug 2 | 3 | Background: 4 | Given I have maven project "m" in "tmp" 5 | And I add project "m" folder "tmp" to the list of workspace folders 6 | And I open a java file "tmp/m/src/main/java/temp/App.java" 7 | And I clear the buffer 8 | And I insert: 9 | """ 10 | package temp; 11 | 12 | class App { 13 | public static void main(String[] args) { 14 | String toEvaluate = "Evaluated"; 15 | System.out.print(toEvaluate); 16 | } 17 | 18 | } 19 | """ 20 | And I call "save-buffer" 21 | And I start lsp-java 22 | And The server status must become "^LSP[jdtls:[0-9]+]$" 23 | 24 | @Eval 25 | Scenario: Eval successfull 26 | When I place the cursor before "System" 27 | And I call "dap-toggle-breakpoint" 28 | And I go to beginning of buffer 29 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 30 | And I call "dap-java-debug" 31 | Then The hook handler "breakpoint" would be called 32 | And the cursor should be before "System" 33 | And I attach handler "executed" to hook "dap-executed-hook" 34 | And I start an action chain 35 | When I press "M-x" 36 | When I type "dap-eval" 37 | And I press "" 38 | When I type "toEvaluate" 39 | And I press "" 40 | And I execute the action chain 41 | Then The hook handler "executed" would be called 42 | And I should see message matching regexp "\"Evaluated\".*" 43 | 44 | @Eval 45 | Scenario: Eval failed 46 | When I place the cursor before "System" 47 | And I call "dap-toggle-breakpoint" 48 | And I go to beginning of buffer 49 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 50 | And I call "dap-java-debug" 51 | Then The hook handler "breakpoint" would be called 52 | And the cursor should be before "System" 53 | And I attach handler "executed" to hook "dap-executed-hook" 54 | And I start an action chain 55 | When I press "M-x" 56 | When I type "dap-eval" 57 | And I press "" 58 | When I type "missingVariable" 59 | And I press "" 60 | And I execute the action chain 61 | Then The hook handler "executed" would be called 62 | And I should see message "missingVariable cannot be resolved to a variable" 63 | -------------------------------------------------------------------------------- /features/JUnit.feature: -------------------------------------------------------------------------------- 1 | Feature: JUnit tests 2 | 3 | Background: 4 | And I open a project file "test-project/src/test/java/temp/AppTest.java" 5 | And The server status must become "^LSP[jdtls:[0-9]+]$" 6 | 7 | @JUnit 8 | Scenario: Debug JUnit class 9 | When I place the cursor before "testAMarker" 10 | And I call "dap-breakpoint-toggle" 11 | And I go to beginning of buffer 12 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 13 | And I call "dap-java-debug-test-class" 14 | Then The hook handler "breakpoint" would be called 15 | And the cursor should be before " System" 16 | And I call "dap-continue" 17 | And I should see buffer "*compilation*" which contains "testAMarker" 18 | 19 | @JUnit 20 | Scenario: Debug JUnit method 21 | When I place the cursor before "testAMarker" 22 | And I call "dap-breakpoint-toggle" 23 | And I go to beginning of buffer 24 | And I place the cursor before "public void testA" 25 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 26 | And I call "dap-java-debug-test-class" 27 | Then The hook handler "breakpoint" would be called 28 | And the cursor should be before " System" 29 | And I call "dap-continue" 30 | And I should see buffer "*compilation*" which contains "testAMarker" 31 | -------------------------------------------------------------------------------- /features/LocalVariables.feature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/features/LocalVariables.feature -------------------------------------------------------------------------------- /features/MultiProject.feature: -------------------------------------------------------------------------------- 1 | Feature: Switching active session 2 | 3 | Background: 4 | Given I have maven project "projectA" in "tmp" 5 | And I add project "projectA" folder "tmp" to the list of workspace folders 6 | And I open a java file "tmp/projectA/src/main/java/projectA/ProjectA.java" 7 | And I clear the buffer 8 | And I insert: 9 | """ 10 | package projectA; 11 | 12 | class ProjectA { 13 | public static void main(String[] args) { 14 | Integer toEvaluate = 123; 15 | System.out.print(toEvaluate); 16 | } 17 | 18 | } 19 | """ 20 | And I call "save-buffer" 21 | Given I have maven project "projectB" in "tmp" 22 | And I add project "projectB" folder "tmp" to the list of workspace folders 23 | And I open a java file "tmp/projectB/src/main/java/projectB/ProjectB.java" 24 | And I clear the buffer 25 | And I insert: 26 | """ 27 | package projectB; 28 | 29 | class ProjectB { 30 | public static void main(String[] args) { 31 | Integer toEvaluate = 123; 32 | System.out.print(toEvaluate); 33 | } 34 | 35 | } 36 | """ 37 | And I call "save-buffer" 38 | And I start lsp-java 39 | And I call "dap-ui-mode" 40 | And I switch to buffer "ProjectA.java" 41 | And I start lsp-java 42 | And I call "dap-ui-mode" 43 | And The server status must become "LSP::Started" 44 | 45 | @MultiProject @SwitchSession @MultiSession @WIP 46 | Scenario: No active session 47 | Given I attach handler "breakpoint" to hook "dap-stopped-hook" 48 | # place breakpoints 49 | And I switch to buffer "ProjectA.java" 50 | And I place the cursor before "System" 51 | And I call "dap-toggle-breakpoint" 52 | And I switch to buffer "ProjectB.java" 53 | And I place the cursor before "System" 54 | And I call "dap-toggle-breakpoint" 55 | And I attach handler "terminated" to hook "dap-terminated-hook" 56 | # Start ProjectA 57 | And I start an action chain 58 | And I press "M-x" 59 | And I type "dap-java-debug" 60 | And I press "" 61 | And I type "projectA" 62 | And I press "TAB" 63 | And I press "RET" 64 | And I execute the action chain 65 | And The hook handler "breakpoint" would be called 66 | # Start ProjectB 67 | And I start an action chain 68 | And I press "M-x" 69 | And I type "dap-java-debug" 70 | And I press "" 71 | And I type "projectB" 72 | And I press "TAB" 73 | And I press "RET" 74 | And I execute the action chain 75 | And The hook handler "breakpoint" would be called 76 | 77 | # Switch session 78 | And I call "dap-switch-session" 79 | Then I should be in buffer "ProjectA.java" 80 | And I should see the following overlay "dap-ui-verified-breakpoint-face" 81 | And I should see the following overlay "dap-ui-marker-face" 82 | 83 | # Check markers the other buffer 84 | And I switch to buffer "ProjectB.java" 85 | And I should see the following overlay "dap-ui-verified-breakpoint-face" 86 | And I should not see the following overlay "dap-ui-marker-face" 87 | -------------------------------------------------------------------------------- /features/MultiSession.feature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/features/MultiSession.feature -------------------------------------------------------------------------------- /features/MultiThreads.feature: -------------------------------------------------------------------------------- 1 | Feature: Multiple threads 2 | 3 | @Threads 4 | Scenario: Switching threads when multiple stopped threads. 5 | Given I have maven project "m" in "tmp" 6 | And I add project "m" folder "tmp" to the list of workspace folders 7 | And I open a java file "tmp/m/src/main/java/temp/App.java" 8 | And I clear the buffer 9 | And I insert: 10 | """ 11 | package temp; 12 | 13 | import java.util.concurrent.Executors; 14 | 15 | public class App { 16 | public static void main(String[] args) { 17 | Executors.newSingleThreadExecutor().execute(new Runnable() { 18 | @Override 19 | public void run() { 20 | System.out.println(999); 21 | } 22 | }); 23 | System.out.println(888); 24 | } 25 | } 26 | """ 27 | And I call "save-buffer" 28 | And I start lsp-java 29 | And The server status must become "^LSP[jdtls:[0-9]+]$" 30 | And I place the cursor before "888" 31 | And I call "dap-toggle-breakpoint" 32 | And I place the cursor before "999" 33 | And I call "dap-toggle-breakpoint" 34 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 35 | And I attach handler "minibuffer" to hook "minibuffer-setup-hook" 36 | And I call "dap-java-debug" 37 | And The hook handler "breakpoint" would be called 38 | And I start an action chain 39 | And I press "M-x" 40 | And I type "dap-switch-thread" 41 | And I press "" 42 | And I press "M-x" 43 | And I type "dap-steps--wait-minibuffer" 44 | And I press "" 45 | When I type "Thread [pool-1-thread-1]" 46 | And I press "" 47 | And I execute the action chain 48 | And The hook handler "breakpoint" would be called 49 | Then the cursor should be before "System.out.println(999);" 50 | And I start an action chain 51 | And I press "M-x" 52 | And I type "dap-switch-thread" 53 | And I press "" 54 | And I press "M-x" 55 | And I type "dap-steps--wait-minibuffer" 56 | And I press "" 57 | When I type "Thread [main]" 58 | And I press "" 59 | And I execute the action chain 60 | And The hook handler "breakpoint" would be called 61 | Then the cursor should be before "System.out.println(888);" 62 | -------------------------------------------------------------------------------- /features/StackFrames.feature: -------------------------------------------------------------------------------- 1 | Feature: Stack traces 2 | 3 | Background: 4 | Given I have maven project "m" in "tmp" 5 | And I add project "m" folder "tmp" to the list of workspace folders 6 | And I open a java file "tmp/m/src/main/java/temp/App.java" 7 | And I clear the buffer 8 | And I insert: 9 | """ 10 | package temp; 11 | 12 | public class App { 13 | public static void main(String[] args) { 14 | String inMainMethod = "inMainMethod"; 15 | foo(); 16 | } 17 | 18 | private static void foo() { 19 | String inFooMethod = "inFooMethod"; 20 | System.out.println(); 21 | } 22 | } 23 | """ 24 | And I call "save-buffer" 25 | And I start lsp-java 26 | And The server status must become "LSP::Started" 27 | 28 | @StackFrames 29 | Scenario: Eval multiple frames 30 | When I place the cursor before "System" 31 | And I call "dap-toggle-breakpoint" 32 | And I go to beginning of buffer 33 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 34 | And I call "dap-java-debug" 35 | Then The hook handler "breakpoint" would be called 36 | And I attach handler "executed" to hook "dap-executed-hook" 37 | And I start an action chain 38 | When I press "M-x" 39 | When I type "dap-eval" 40 | And I press "" 41 | When I type "inFooMethod" 42 | And I press "" 43 | And I execute the action chain 44 | Then The hook handler "executed" would be called 45 | And I should see message matching regexp "\"inFooMethod\".*" 46 | And I start an action chain 47 | When I press "M-x" 48 | When I type "dap-switch-stack-frame" 49 | And I press "" 50 | When I type "App.main" 51 | And I press "" 52 | And I execute the action chain 53 | And the cursor should be before " foo();" 54 | -------------------------------------------------------------------------------- /features/SwitchSession.feature: -------------------------------------------------------------------------------- 1 | Feature: Switching active session 2 | 3 | Background: 4 | Given I have maven project "m" in "tmp" 5 | And I add project "m" folder "tmp" to the list of workspace folders 6 | And I open a java file "tmp/m/src/main/java/temp/App.java" 7 | And I clear the buffer 8 | And I insert: 9 | """ 10 | package temp; 11 | 12 | class App { 13 | public static void main(String[] args) { 14 | Integer toEvaluate = 123123; 15 | System.out.print(toEvaluate); 16 | } 17 | 18 | } 19 | """ 20 | And I call "save-buffer" 21 | And I start lsp-java 22 | And The server status must become "^LSP[jdtls:[0-9]+]$" 23 | 24 | @SwitchSession 25 | Scenario: No active session 26 | And I invoke "dap-switch-session" I should see error message "No active session to switch to" 27 | 28 | @SwitchSession 29 | Scenario: One running session 30 | When I place the cursor before "System" 31 | And I call "dap-toggle-breakpoint" 32 | And I go to beginning of buffer 33 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 34 | And I call "dap-java-debug" 35 | Then The hook handler "breakpoint" would be called 36 | And I invoke "dap-switch-session" I should see error message "No active session to switch to" 37 | 38 | @SwitchSession 39 | Scenario: Switch current session. 40 | Given I attach handler "breakpoint" to hook "dap-stopped-hook" 41 | And I place the cursor before "Integer" 42 | And I call "dap-toggle-breakpoint" 43 | And I place the cursor before "System" 44 | And I call "dap-toggle-breakpoint" 45 | And I call "dap-java-debug" 46 | And The hook handler "breakpoint" would be called 47 | And I call "dap-continue" 48 | And The hook handler "breakpoint" would be called 49 | And I call "dap-java-debug" 50 | Then The hook handler "breakpoint" would be called 51 | And the cursor should be before "Integer" 52 | And I call "dap-switch-session" 53 | And the cursor should be before "System" 54 | 55 | @SwitchSession @UI 56 | Scenario: Switch current session - overlays 57 | Given I attach handler "breakpoint" to hook "dap-stopped-hook" 58 | And I call "dap-ui-mode" 59 | And I place the cursor before "Integer" 60 | And I call "dap-toggle-breakpoint" 61 | And I place the cursor before "System" 62 | And I call "dap-toggle-breakpoint" 63 | And I call "dap-java-debug" 64 | And The hook handler "breakpoint" would be called 65 | And I call "dap-continue" 66 | And The hook handler "breakpoint" would be called 67 | And I call "dap-java-debug" 68 | Then The hook handler "breakpoint" would be called 69 | And the cursor should be before "Integer" 70 | And I call "dap-switch-session" 71 | And the cursor should be before "System" 72 | Then I should see the following overlay "dap-ui-marker-face" 73 | When I place the cursor before "Integer" 74 | Then I should not see the following overlay "dap-ui-marker-face" 75 | -------------------------------------------------------------------------------- /features/TODO.org: -------------------------------------------------------------------------------- 1 | * Sessions 2 | ** DONE Switch session 3 | CLOSED: [2018-06-23 Sat 21:52] 4 | *** DONE EVAL 5 | CLOSED: [2018-06-23 Sat 21:52] 6 | *** DONE Continue 7 | CLOSED: [2018-06-23 Sat 21:52] 8 | *** DONE Visual indication 9 | CLOSED: [2018-06-23 Sat 21:52] 10 | **** TODO Session stopped 11 | **** TODO session deleted 12 | **** TODO Thread active 13 | **** TODO Stack frame active 14 | ** DONE Switch frame 15 | CLOSED: [2018-06-16 Sat 10:03] 16 | *** EVAL 17 | *** Continue 18 | ** DONE Persistence of debug configurations 19 | CLOSED: [2018-07-04 Wed 08:26] 20 | ** DONE Terminate to kill the tcp process. 21 | CLOSED: [2018-06-20 Wed 22:47] 22 | ** DONE Run in terminal 23 | CLOSED: [2018-09-08 Sat 00:00] 24 | ** DONE Run no debug 25 | CLOSED: [2018-09-08 Sat 00:00] 26 | ** DONE Run last configurations 27 | CLOSED: [2018-09-09 Sun 11:14] 28 | ** DONE Add option to specify environment variables in launch props 29 | CLOSED: [2018-09-08 Sat 00:00] 30 | ** DONE Attach. 31 | CLOSED: [2018-07-18 Wed 21:53] 32 | * Beakpoints 33 | ** DONE Visual indication 34 | CLOSED: [2018-06-10 Sun 11:55] 35 | ** DONE Enable/disable 36 | CLOSED: [2018-06-10 Sun 11:55] 37 | ** DONE Persistence 38 | CLOSED: [2018-06-16 Sat 09:56] 39 | ** DONE Session selection and breakpoints 40 | CLOSED: [2018-06-18 Mon 21:09] 41 | ** DONE Persist breakpoints using marker indicator. 42 | CLOSED: [2018-09-09 Sun 11:14] 43 | ** DONE Breakpoint conditions 44 | CLOSED: [2018-07-29 Sun 23:19] 45 | ** DONE Breakpoints hit count 46 | CLOSED: [2018-07-29 Sun 23:19] 47 | ** TODO Exception breakpoints. 48 | ** DONE update breakpoint visualization when there is condition/hit count/debug message 49 | CLOSED: [2018-09-06 Thu 22:40] 50 | ** DONE cleanup of conditions 51 | CLOSED: [2018-09-06 Thu 22:31] 52 | * Stepping 53 | ** DONE Visual indication 54 | CLOSED: [2018-06-16 Sat 09:57] 55 | ** DONE Invalidation 56 | CLOSED: [2018-06-23 Sat 21:53] 57 | ** DONE Multiple breakpoints hit 58 | CLOSED: [2018-06-16 Sat 23:56] 59 | ** DONE Switching 60 | CLOSED: [2018-06-23 Sat 21:54] 61 | - Frames [Done] 62 | - Session [Done] 63 | - Threads [Done] 64 | * Breakpoints list 65 | ** DONE implementation 66 | CLOSED: [2018-07-29 Sun 22:19] 67 | ** TODO Edit breakpoint properties 68 | * Inspect variable/value 69 | ** DONE Implement ... 70 | CLOSED: [2018-07-18 Wed 21:54] 71 | ** TODO Update local value 72 | ** TODO Paging of multiple results 73 | * Run configurations management 74 | ** DONE Persistence 75 | CLOSED: [2018-07-18 Wed 21:54] 76 | * Java 77 | ** TODO Build before runnning 78 | * DONE Python 79 | CLOSED: [2018-08-08 Wed 19:19] 80 | * DONE Rust language 81 | CLOSED: [2020-01-09 Thu 09:39] 82 | * General 83 | ** DONE Error handlers 84 | CLOSED: [2018-06-23 Sat 21:54] 85 | ** TODO Request timeouts 86 | ** TODO Checking server supports the call. 87 | ** TODO Initialized message 88 | *** TODO - prohibit operations that are not permitted. 89 | ** TODO Support for STD OUT dap servers 90 | * DONE Watches 91 | CLOSED: [2020-01-09 Thu 09:39] 92 | ** TODO full implementation 93 | * DONE Locals 94 | CLOSED: [2018-07-18 Wed 21:54] 95 | ** DONE full implementation 96 | CLOSED: [2018-07-18 Wed 21:54] 97 | * TODO Debug console 98 | * DONE Set breakpoints 99 | CLOSED: [2018-07-29 Sun 23:20] 100 | * DONE Integration with other DAP servers 101 | CLOSED: [2020-01-09 Thu 09:39] 102 | ** TODO Python 103 | ** TODO Rust 104 | * TODO Testing 105 | * DONE Melpa 106 | CLOSED: [2018-09-06 Thu 22:48] 107 | -------------------------------------------------------------------------------- /features/Threads.feature: -------------------------------------------------------------------------------- 1 | Feature: Threads 2 | Background: 3 | Given I have maven project "m" in "tmp" 4 | And I add project "m" folder "tmp" to the list of workspace folders 5 | And I open a java file "tmp/m/src/main/java/temp/App.java" 6 | And I clear the buffer 7 | And I insert: 8 | """ 9 | package temp; 10 | 11 | class App { 12 | public static void main(String[] args) { 13 | foo(); 14 | } 15 | public static void foo() { 16 | System.out.print(123); 17 | } 18 | } 19 | """ 20 | And I call "save-buffer" 21 | And I start lsp-java 22 | And The server status must become "^LSP[jdtls:[0-9]+]$" 23 | And I place the cursor before "System" 24 | And I call "dap-breakpoint-toggle" 25 | And I go to beginning of buffer 26 | And I attach handler "breakpoint" to hook "dap-stopped-hook" 27 | And I call "dap-java-debug" 28 | And The hook handler "breakpoint" would be called 29 | And the cursor should be before "System" 30 | 31 | @Threads 32 | Scenario: Listing sessions 33 | When I call "dap-ui-sessions" 34 | Then I should be in buffer "*sessions*" 35 | Then I should see: 36 | """ 37 | [+] temp.App (m) (running) 38 | """ 39 | 40 | @Threads 41 | Scenario: Listing sessions - listing threads 42 | When I call "dap-ui-sessions" 43 | Then I should be in buffer "*sessions*" 44 | And I should see: 45 | """ 46 | [+] temp.App (m) (running) 47 | """ 48 | When I place the cursor before "temp" 49 | And I attach handler "threads-expanded" to hook "dap-ui-stack-frames-loaded" 50 | And I call "tree-mode-expand-level" 51 | Then I should see: 52 | """ 53 | [-] temp.App (m) (running) 54 | ‘-Loading... 55 | """ 56 | And The hook handler "threads-expanded" would be called 57 | Then I should see: 58 | """ 59 | [-] temp.App (m) (running) 60 | |-[+] Thread [Signal Dispatcher] 61 | |-[+] Thread [Finalizer] 62 | |-[+] Thread [Reference Handler] 63 | ‘-[+] Thread [main] 64 | """ 65 | 66 | @Threads @UI @Stackframes 67 | Scenario: Stackframes 68 | When I call "dap-ui-sessions" 69 | Then I should be in buffer "*sessions*" 70 | And I should see: 71 | """ 72 | [+] temp.App (m) (running) 73 | """ 74 | When I place the cursor before "temp" 75 | And I attach handler "threads-expanded" to hook "dap-ui-stack-frames-loaded" 76 | And I call "tree-mode-expand-level" 77 | And The hook handler "threads-expanded" would be called 78 | And I should see: 79 | """ 80 | [-] temp.App (m) (running) 81 | |-[+] Thread [Signal Dispatcher] 82 | |-[+] Thread [Finalizer] 83 | |-[+] Thread [Reference Handler] 84 | ‘-[+] Thread [main] (stopped) 85 | """ 86 | When I place the cursor before "main" 87 | And I call "tree-mode-expand-level" 88 | And I should see: 89 | """ 90 | [-] temp.App (m) (running) 91 | |-[+] Thread [Signal Dispatcher] 92 | |-[+] Thread [Finalizer] 93 | |-[+] Thread [Reference Handler] 94 | ‘-[-] Thread [main] (stopped) 95 | |-App.foo() (App.java:8) 96 | ‘-App.main(String[]) (App.java:5) 97 | """ 98 | -------------------------------------------------------------------------------- /features/fixtures/test-project/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | test-project1 5 | test-project 6 | 1.0-SNAPSHOT 7 | jar 8 | test-project 9 | http://maven.apache.org 10 | 11 | 12 | UTF-8 13 | 1.8 14 | 1.8 15 | 16 | 17 | 18 | junit 19 | junit 20 | 4.8.1 21 | test 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /features/fixtures/test-project/src/main/java/temp/App.java: -------------------------------------------------------------------------------- 1 | package temp; 2 | 3 | class App { 4 | public static void main(final String[] args) { 5 | System.out.println("Next line will throw..."); 6 | throw new RuntimeException("Error message!"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /features/fixtures/test-project/src/test/java/temp/AppTest.java: -------------------------------------------------------------------------------- 1 | package temp; 2 | 3 | import org.junit.Test; 4 | 5 | public class AppTest { 6 | @Test 7 | public void testA() { 8 | System.out.println("Entering testA..."); 9 | foo(); 10 | } 11 | 12 | @Test 13 | public void testB() { 14 | System.out.println("Entering testB...\n"); 15 | foo(); 16 | } 17 | 18 | private void foo() { 19 | System.out.println("Foo called."); 20 | } 21 | 22 | private void foo2() { 23 | System.out.println("Foo called."); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /features/step-definitions/dap-java-steps.el: -------------------------------------------------------------------------------- 1 | ;;; dap-java-steps.el --- Step definitions for dap-java -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2018 Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski 6 | 7 | ;; This program is free software; you can redistribute it and/or modify 8 | ;; it under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation, either version 3 of the License, or 10 | ;; (at your option) any later version. 11 | 12 | ;; This program is distributed in the hope that it will be useful, 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ;; GNU General Public License for more details. 16 | 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with this program. If not, see . 19 | 20 | 21 | ;;; Code: 22 | 23 | (require 'f) 24 | (require 's) 25 | (require 'dap-java) 26 | 27 | (defun dap-java-steps-async-wait (pred callback) 28 | "Call CALLBACK when PRED becomes true." 29 | (let (timer 30 | (retry-count 0)) 31 | (setq timer (run-with-timer 32 | 1 33 | 1 34 | (lambda (&rest rest) 35 | (if (funcall pred) 36 | (progn 37 | (cancel-timer timer) 38 | (funcall callback)) 39 | (setq retry-count (1+ retry-count)) 40 | (message "The function failed, attempt %s" retry-count))))))) 41 | 42 | (Given "^I have maven project \"\\([^\"]+\\)\" in \"\\([^\"]+\\)\"$" 43 | (lambda (project-name dir-name) 44 | (setq default-directory dap-java-test-root) 45 | 46 | ;; create directory structure 47 | (mkdir (expand-file-name 48 | (f-join dir-name project-name "src" "main" "java" "temp")) t) 49 | 50 | ;; add pom.xml 51 | (with-temp-file (expand-file-name "pom.xml" (f-join dir-name project-name)) 52 | (insert (format " 53 | 55 | 4.0.0 56 | test 57 | %s 58 | jar 59 | 1 60 | test-project 61 | http://maven.apache.org 62 | 63 | 64 | 1.8 65 | 1.8 66 | 67 | " project-name))))) 68 | 69 | (And "^I open a java file \"\\([^\"]+\\)\"$" 70 | (lambda (file-name) 71 | (setq default-directory dap-java-test-root) 72 | (message "making directory %s" (f-dirname file-name)) 73 | (mkdir (f-dirname file-name) t) 74 | (find-file file-name) 75 | (save-buffer))) 76 | 77 | (And "^I open a project file \"\\([^\"]+\\)\"$" 78 | (lambda (file-name) 79 | (find-file (f-join dap-java-maven-project-root file-name)))) 80 | 81 | (And "^I add project \"\\([^\"]+\\)\" folder \"\\([^\"]+\\)\" to the list of workspace folders$" 82 | (lambda (project dir-name) 83 | (lsp-workspace-folders-add (f-join dap-java-test-root dir-name project)))) 84 | 85 | (And "^I start lsp-java$" 86 | (lambda () 87 | (lsp))) 88 | 89 | (Then "^The server status must become \"\\([^\"]+\\)\"$" 90 | (lambda (status callback) 91 | (dap-java-steps-async-wait 92 | (lambda () 93 | (if (s-matches? status (s-trim (lsp-mode-line))) 94 | t 95 | (progn 96 | (message "Server status is %s" (lsp-mode-line)) 97 | nil))) 98 | callback))) 99 | 100 | (When "^I invoke \"\\([^\"]+\\)\" I should see error message \"\\([^\"]+\\)\"$" 101 | (lambda (command message) 102 | (condition-case err 103 | (progn 104 | (funcall (intern command)) 105 | (cl-assert nil t (format "Command %s should have failed." command))) 106 | (error (cl-assert (string= message (error-message-string err)) t (error-message-string err)))))) 107 | 108 | (Then "^I should see buffer \"\\([^\"]+\\)\" with content \"\\([^\"]+\\)\"$" 109 | (lambda (buffer-name buffer-content callback) 110 | (dap-java-steps-async-wait 111 | (lambda () 112 | (when-let (buffer (get-buffer buffer-name)) 113 | (with-current-buffer buffer 114 | (string= (buffer-string) buffer-content)))) 115 | callback))) 116 | 117 | (Then "^I should see buffer \"\\([^\"]+\\)\" which contains \"\\([^\"]+\\)\"$" 118 | (lambda (buffer-name buffer-content callback) 119 | (dap-java-steps-async-wait 120 | (lambda () 121 | (when-let (buffer (get-buffer buffer-name)) 122 | (with-current-buffer buffer 123 | (s-contains? buffer-content (buffer-string))))) 124 | callback))) 125 | 126 | 127 | (And "^I attach handler \"\\([^\"]+\\)\" to hook \"\\([^\"]+\\)\"$" 128 | (lambda (handler-name hook-name) 129 | (add-hook 130 | (intern hook-name) 131 | (lambda (&rest args) 132 | (puthash handler-name 'called dap-handlers-called))))) 133 | 134 | (Then "^The hook handler \"\\([^\"]+\\)\" would be called$" 135 | (lambda (handler-name callback) 136 | (dap-java-steps-async-wait 137 | (lambda () 138 | (let ((result (eql 'called (gethash handler-name dap-handlers-called)))) 139 | ;; clear the hash 140 | (remhash handler-name dap-handlers-called) 141 | result)) 142 | callback))) 143 | 144 | (When "^I go in active window" 145 | (lambda () (select-window (car (window-list ))))) 146 | 147 | (Then "^I should see message matching regexp \"\\(.+\\)\"$" 148 | "Asserts that MESSAGE has been printed." 149 | (lambda (message) 150 | (let ((msg "Expected '%s' to be included in the list of printed messages, but was not.")) 151 | (setq message (s-replace "\\\"" "\"" message)) 152 | (cl-assert (--find (string-match message it) (-map 's-trim ecukes-message-log)) nil msg message)))) 153 | 154 | (Then "^I should see the following overlay \"\\([^\"]+\\)\"$" 155 | (lambda (face) 156 | (let ((overlay-faces (--map (plist-get (overlay-properties it) 'face) 157 | (overlays-in (save-mark-and-excursion 158 | (beginning-of-line) 159 | (point)) 160 | (save-mark-and-excursion 161 | (end-of-line) 162 | (point)))))) 163 | (cl-assert (cl-find (intern face) overlay-faces) 164 | t 165 | (format "Actual %s" overlay-faces))))) 166 | 167 | (Then "^I should not see the following overlay \"\\([^\"]+\\)\"$" 168 | (lambda (face) 169 | (let ((overlay-faces (--map (plist-get (overlay-properties it) 'face) 170 | (overlays-in (save-mark-and-excursion 171 | (beginning-of-line) 172 | (point)) 173 | (save-mark-and-excursion 174 | (end-of-line) 175 | (point)))))) 176 | (cl-assert (not (cl-find (intern face) overlay-faces)) 177 | t 178 | (format "Actual %s" overlay-faces))))) 179 | 180 | (And "^I call:$" 181 | (lambda (fn-to-call) 182 | (call-interactively (intern fn-to-call)))) 183 | 184 | (And "^I kill buffer \"\\([^\"]+\\)\"$" 185 | (lambda (buffer-name) 186 | (kill-buffer buffer-name))) 187 | 188 | (provide 'dap-java-steps) 189 | ;;; dap-java-steps.el ends here 190 | -------------------------------------------------------------------------------- /features/support/env.el: -------------------------------------------------------------------------------- 1 | (require 'f) 2 | 3 | (require 'undercover nil t) 4 | ;; (undercover "*.el" (:exclude "*-test.el")) 5 | 6 | (defun dap-steps--wait-minibuffer() 7 | (interactive) 8 | (sit-for 1)) 9 | 10 | (defvar dap-java-support-path (f-dirname load-file-name)) 11 | (defvar dap-java-features-path (f-parent dap-java-support-path)) 12 | (defvar dap-handlers-called (make-hash-table :test 'equal)) 13 | (defvar dap-java-maven-project-root (f-join dap-java-support-path "../fixtures/")) 14 | (defvar dap-java-root-path (f-parent dap-java-features-path)) 15 | (defvar dap-java-test-root (f-join temporary-file-directory "tests")) 16 | 17 | (add-to-list 'load-path dap-java-root-path) 18 | 19 | ;; Ensure that we don't load old byte-compiled versions 20 | (let ((load-prefer-newer t)) 21 | (require 'espuds) 22 | (require 'ert) 23 | (require 'dap-mode) 24 | (require 'dap-java) 25 | (require 'lsp-java) 26 | (require 'dap-ui)) 27 | 28 | (add-hook 'java-mode-hook 'lsp) 29 | 30 | (defun dap--get-sessions () 31 | "Get sessions for WORKSPACE." 32 | (lsp-workspace-get-metadata "debug-sessions")) 33 | 34 | (Setup 35 | (setq lsp-java-workspace-dir (make-temp-file "test-dir" t) 36 | lsp-java-workspace-cache-dir (f-join dap-java-test-root "workspace-cache/") 37 | lsp-java-server-install-dir (locate-user-emacs-file "eclipse.jdt.ls/server/") 38 | dap-print-io t 39 | dap-inhibit-io nil 40 | dap-auto-show-output nil 41 | lsp-response-timeout 60) 42 | 43 | (lsp-java-update-server) 44 | (when (file-exists-p dap-java-test-root) 45 | (delete-directory dap-java-test-root t)) 46 | (mkdir lsp-java-workspace-dir t) 47 | (mkdir lsp-java-workspace-cache-dir t) 48 | 49 | (dap-turn-on-dap-mode) 50 | (lsp-workspace-folders-add (f-join dap-java-maven-project-root "test-project")) 51 | 52 | (find-file (f-join dap-java-maven-project-root "pom.xml")) 53 | (lsp) 54 | (toggle-debug-on-error)) 55 | 56 | (Before) 57 | 58 | (After 59 | (with-current-buffer "pom.xml" 60 | (dap-breakpoint-delete-all) 61 | (dap-delete-all-sessions)) 62 | 63 | (when (get-buffer "*out*") 64 | (kill-buffer "*out*"))) 65 | 66 | (Teardown) 67 | -------------------------------------------------------------------------------- /icons/eclipse/collapsed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/eclipse/collapsed.png -------------------------------------------------------------------------------- /icons/eclipse/expanded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/eclipse/expanded.png -------------------------------------------------------------------------------- /icons/eclipse/inspect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/eclipse/inspect.png -------------------------------------------------------------------------------- /icons/eclipse/project-running.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/eclipse/project-running.png -------------------------------------------------------------------------------- /icons/eclipse/project-stopped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/eclipse/project-stopped.png -------------------------------------------------------------------------------- /icons/eclipse/scope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/eclipse/scope.png -------------------------------------------------------------------------------- /icons/eclipse/stack-frame-running.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/eclipse/stack-frame-running.png -------------------------------------------------------------------------------- /icons/eclipse/stack-frame-stopped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/eclipse/stack-frame-stopped.png -------------------------------------------------------------------------------- /icons/eclipse/thread-running.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/eclipse/thread-running.png -------------------------------------------------------------------------------- /icons/eclipse/thread-stopped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/eclipse/thread-stopped.png -------------------------------------------------------------------------------- /icons/eclipse/variable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/eclipse/variable.png -------------------------------------------------------------------------------- /icons/vscode/close-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/close-all.png -------------------------------------------------------------------------------- /icons/vscode/continue-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/continue-disabled.png -------------------------------------------------------------------------------- /icons/vscode/continue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/continue.png -------------------------------------------------------------------------------- /icons/vscode/disconnect-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/disconnect-disabled.png -------------------------------------------------------------------------------- /icons/vscode/disconnect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/disconnect.png -------------------------------------------------------------------------------- /icons/vscode/pause-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/pause-disabled.png -------------------------------------------------------------------------------- /icons/vscode/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/pause.png -------------------------------------------------------------------------------- /icons/vscode/restart-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/restart-disabled.png -------------------------------------------------------------------------------- /icons/vscode/restart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/restart.png -------------------------------------------------------------------------------- /icons/vscode/reverse-continue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/reverse-continue.png -------------------------------------------------------------------------------- /icons/vscode/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/start.png -------------------------------------------------------------------------------- /icons/vscode/step-back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/step-back.png -------------------------------------------------------------------------------- /icons/vscode/step-into-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/step-into-disabled.png -------------------------------------------------------------------------------- /icons/vscode/step-into.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/step-into.png -------------------------------------------------------------------------------- /icons/vscode/step-out-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/step-out-disabled.png -------------------------------------------------------------------------------- /icons/vscode/step-out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/step-out.png -------------------------------------------------------------------------------- /icons/vscode/step-over-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/step-over-disabled.png -------------------------------------------------------------------------------- /icons/vscode/step-over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/step-over.png -------------------------------------------------------------------------------- /icons/vscode/stop-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/stop-disabled.png -------------------------------------------------------------------------------- /icons/vscode/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/stop.png -------------------------------------------------------------------------------- /icons/vscode/toggle-breakpoints.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/icons/vscode/toggle-breakpoints.png -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: DAP Mode 2 | site_url: https://emacs-lsp.github.io/dap-mode 3 | 4 | nav: 5 | - Home: README.md 6 | - Features: page/features.md 7 | - Configuration: page/configuration.md 8 | - How to: page/how-to.md 9 | - Tutorials: 10 | - Clojure: page/clojure.md 11 | - Python, debbuging with poetry + pyenv: page/python-poetry-pyenv.md 12 | - Gallery: 13 | - page/gallery.md 14 | - Adding a new debug server: page/adding-debug-server.md 15 | - Changelog: 16 | - CHANGELOG.md 17 | - LSP Mode: 18 | - LSP Mode: https://emacs-lsp.github.io/lsp-mode 19 | 20 | extra_css: 21 | - stylesheets/extra.css 22 | 23 | theme: 24 | name: material 25 | logo: screenshots/logo.png 26 | favicon: screenshots/logo.png 27 | icon: 28 | repo: fontawesome/brands/github 29 | features: 30 | - navigation.tabs 31 | 32 | extra: 33 | social: 34 | - icon: fontawesome/brands/github-alt 35 | link: https://github.com/emacs-lsp/dap-mode 36 | - icon: fontawesome/brands/twitter 37 | link: https://twitter.com/yonchovski 38 | - icon: fontawesome/brands/gitter 39 | link: https://gitter.im/emacs-lsp/lsp-mode 40 | 41 | repo_name: emacs-lsp/dap-mode 42 | repo_url: https://github.com/emacs-lsp/dap-mode 43 | 44 | markdown_extensions: 45 | - pymdownx.superfences 46 | - codehilite 47 | - toc: 48 | permalink: '#' 49 | - pymdownx.emoji: 50 | emoji_index: !!python/name:materialx.emoji.twemoji 51 | emoji_generator: !!python/name:materialx.emoji.to_svg 52 | 53 | plugins: 54 | - search 55 | - awesome-pages 56 | - git-revision-date-localized 57 | 58 | google_analytics: 59 | - UA-165661257-2 60 | - auto 61 | -------------------------------------------------------------------------------- /screenshots/MultiSession.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/MultiSession.png -------------------------------------------------------------------------------- /screenshots/Swift.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/Swift.png -------------------------------------------------------------------------------- /screenshots/cider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/cider.png -------------------------------------------------------------------------------- /screenshots/dap-ui-repl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/dap-ui-repl.png -------------------------------------------------------------------------------- /screenshots/debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/debug.png -------------------------------------------------------------------------------- /screenshots/erlang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/erlang.png -------------------------------------------------------------------------------- /screenshots/flutter-debug.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/flutter-debug.gif -------------------------------------------------------------------------------- /screenshots/go.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/go.png -------------------------------------------------------------------------------- /screenshots/implementations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/implementations.png -------------------------------------------------------------------------------- /screenshots/javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/javascript.png -------------------------------------------------------------------------------- /screenshots/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/logo.png -------------------------------------------------------------------------------- /screenshots/rust.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/rust.png -------------------------------------------------------------------------------- /screenshots/swi-prolog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/dap-mode/b97756665709bea37b9ffe262c5fa9196f1b4577/screenshots/swi-prolog.png --------------------------------------------------------------------------------