diff --git a/CHANGELOG.develop b/CHANGELOG.develop index d395344e8..14d5e8a4d 100644 --- a/CHANGELOG.develop +++ b/CHANGELOG.develop @@ -2001,6 +2001,7 @@ Other: for ~SPC m c f~ to format project files (thanks to Luke Alexander Stein) - Added ~SPC m c v~ to run "cargo check" command (thanks to Victor Polevoy) - Added rust lsp completion with company and bindings (thanks to Justin) +- Added debugger integration via =dap= layer **** Scala - Move =ensime= to the =java= layer (Tor Hedin Bronner) - Key bindings: @@ -2174,7 +2175,7 @@ Other: Kramer) - Fixed jump handling with multiple backends (thanks to Aaron Jensen) - Fixed =typescript/jump-to-type-def= for npm modules (thanks to Jam Risser) -- Added the same setup to tsx files as to ts files (thanks to Trapez Breen) +- Added the same setup to tsx files as to ts files (thanks to Trapez Breen) **** Vagrant - Key bindings: - move key bindings prefix to ~SPC a V~ (thanks to Thomas de BeauchĂȘne) diff --git a/layers/+lang/rust/README.org b/layers/+lang/rust/README.org index de2e08b66..73352e00c 100644 --- a/layers/+lang/rust/README.org +++ b/layers/+lang/rust/README.org @@ -10,9 +10,11 @@ - [[#backends][Backends]] - [[#racer][Racer]] - [[#lsp][LSP]] + - [[#debugger-dap-integration][Debugger (dap integration)]] - [[#cargo][Cargo]] - [[#rustfmt][Rustfmt]] - [[#key-bindings][Key bindings]] + - [[#debugger][debugger]] * Description This layer supports [[https://www.rust-lang.org][Rust]] development in Spacemacs. @@ -45,6 +47,9 @@ Consult the installation command for the desired language server found at [[http To enable auto-completion, ensure that the =auto-completion= layer is enabled. +**** Debugger (dap integration) +To install the debug adapter you may run =M-x dap-gdb-lldb-setup= when you are on Linux or download it manually from [[https://marketplace.visualstudio.com/items?itemName=webfreak.debug][Native Debug]] and adjust =dap-gdb-lldb-path=. + ** Cargo [[http://doc.crates.io/index.html][Cargo]] is a project management command line tool for Rust. Installation instructions can be found on the main page of [[http://doc.crates.io/index.html][Cargo]]. @@ -82,3 +87,50 @@ To enable automatic buffer formatting on save, set the variable =rust-format-on- | ~SPC m g g~ | jump to definition | | ~SPC m h h~ | describe symbol at point | | ~SPC m t~ | run tests with Cargo | + +** debugger + +| Key binding | Description | +|---------------+---------------------------------| +| ~SPC m d d d~ | start debugging | +| ~SPC m d d l~ | debug last configuration | +| ~SPC m d d r~ | debug recent configuration | +|---------------+---------------------------------| +| ~SPC m d c~ | continue | +| ~SPC m d i~ | step in | +| ~SPC m d o~ | step out | +| ~SPC m d s~ | next step | +| ~SPC m d v~ | inspect value at point | +| ~SPC m d r~ | restart frame | +|---------------+---------------------------------| +| ~SPC m d .~ | debug transient state | +|---------------+---------------------------------| +| ~SPC m d a~ | abandon current session | +| ~SPC m d A~ | abandon all process | +|---------------+---------------------------------| +| ~SPC m d e e~ | eval | +| ~SPC m d e r~ | eval region | +| ~SPC m d e t~ | eval value at point | +|---------------+---------------------------------| +| ~SPC m d S s~ | switch session | +| ~SPC m d S t~ | switch thread | +| ~SPC m d S f~ | switch frame | +|---------------+---------------------------------| +| ~SPC m d I i~ | inspect | +| ~SPC m d I r~ | inspect region | +| ~SPC m d I t~ | inspect value at point | +|---------------+---------------------------------| +| ~SPC m d b b~ | toggle a breakpoint | +| ~SPC m d b c~ | change breakpoint condition | +| ~SPC m d b l~ | change breakpoint log condition | +| ~SPC m d b h~ | change breakpoint hit count | +| ~SPC m d b a~ | add a breakpoint | +| ~SPC m d b d~ | delete a breakpoint | +| ~SPC m d b D~ | clear all breakpoints | +|---------------+---------------------------------| +| ~SPC m d '_~ | Run debug REPL | +|---------------+---------------------------------| +| ~SPC m d w l~ | list local variables | +| ~SPC m d w o~ | goto output buffer if present | +| ~SPC m d w s~ | list sessions | +| ~SPC m d w b~ | list breakpoints | diff --git a/layers/+lang/rust/funcs.el b/layers/+lang/rust/funcs.el index 5140721e7..2b62a4912 100755 --- a/layers/+lang/rust/funcs.el +++ b/layers/+lang/rust/funcs.el @@ -36,7 +36,12 @@ using `cargo-process-run'." "Setup lsp backend" (if (configuration-layer/layer-used-p 'lsp) (lsp) - (message "`lsp' layer is not installed, please add `lsp' layer to your dotfile."))) + (message "`lsp' layer is not installed, please add `lsp' layer to your dotfile.")) + (if (configuration-layer/layer-used-p 'dap) + (progn + (require 'dap-gdb-lldb) + (spacemacs/dap-bind-keys-for-mode 'rust-mode)) + (message "`dap' layer is not installed, please add `dap' layer to your dotfile."))) (defun spacemacs//rust-setup-racer () "Setup racer backend"