Commit graph

638 commits

Author SHA1 Message Date
Mathias Fussenegger
cf8d6e2885 Add path option for utils.pick_file 2024-05-23 11:22:03 +02:00
Andreas Schneider
fa226c4125
Add utils.pick_file() (#1190)
This implements a file picker, to pick the file you want to execute with
the debugger.

Fixes #1130

Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2024-05-23 09:37:25 +02:00
Mathias Fussenegger
5a2f712186 Fix nvim 0.11 deprecation warnings 2024-05-16 17:21:43 +02:00
Mathias Fussenegger
e1330ec3b2 Tweak buffer settings for variable diff view; lower max_level to 1
10 levels can take a huge amount of time to load, and there's currently
no way to interrupt it.

modified=false and bufhidden=wipe should make it easier to get rid of
the buffers after being done viewing the diff.
2024-05-16 13:39:13 +02:00
Mathias Fussenegger
559d0bbdbc Add type annotations & param validation for toggle_breakpoint 2024-05-14 17:31:22 +02:00
Mathias Fussenegger
615a1b2046 Close stdio handles after process exits
Some debug adapters don't like it if dap closes stdin eagerly.
An example is gdb: https://github.com/mfussenegger/nvim-dap/issues/1206
2024-05-10 12:22:19 +02:00
Mathias Fussenegger
6ae8a14828 Allow to configure max wait timeout for pipe adapter
5000ms can be too short.
See https://github.com/mfussenegger/nvim-dap/discussions/1147
2024-04-18 11:30:22 +02:00
Ole
405df1dcc2
Fix link to dap.continue within dap-configuration docs section (#1177) 2024-03-25 17:04:34 +01:00
Mathias Fussenegger
c1695e500c Allow to override output event handler 2024-03-17 21:02:49 +01:00
dubrayn
c43c2473ec
Fix typo in doc/dap.txt (#1174) 2024-03-15 11:41:50 +01:00
Mathias Fussenegger
fc880e8205 Use async.run in event_stopped for error handler 2024-02-17 11:41:38 +01:00
Mathias Fussenegger
e48c8116ea Try to fetch frames in frames widget if they're missing 2024-02-17 11:41:38 +01:00
Mathias Fussenegger
0406598c80 Update threads at most once on stopped events 2024-02-15 15:47:54 +01:00
Mathias Fussenegger
3b4bdea2c0 Ensure dap.status() shows start progress
nvim-dap reports `Launching debug adapter` before evaluating a adapter
function:

    progress.report('Launching debug adapter')

But that message was never shown in `dap.status()` because at that point
no session is active and `status()` returned a `''`.

If the adapter function takes a long time, it gave
the impression that nothing was happening.

Solution:

Always show the last message in `status()`, and send a `""` if a session
closes.
2024-02-13 20:14:51 +01:00
Dennis Rall
780fd4dd06
Add missing comma to launch.json example in docs (#1151) 2024-02-06 18:59:32 +01:00
Mathias Fussenegger
9adbfdca13 Only activate repl auto scroll on 0G or G 2024-01-13 14:18:40 +01:00
Mathias Fussenegger
aad46274f0 Don't ignore count for G keymap in repl
Fixes https://github.com/mfussenegger/nvim-dap/issues/1131
2024-01-09 19:51:47 +01:00
Mathias Fussenegger
f0dca670fa Evaluate inputs in launch.json config only once per config use
Closes https://github.com/mfussenegger/nvim-dap/issues/1112
2023-12-20 19:21:17 +01:00
Nicholas Mata
e64ebf3309
Move filtering logic from pick_process to get_processes (#1097)
Closes https://github.com/mfussenegger/nvim-dap/issues/1096
2023-12-14 16:53:10 +01:00
Mathias Fussenegger
bbe2c6f343 Add omnifunc tests 2023-12-08 15:45:41 +01:00
Mathias Fussenegger
d7749eb3d9 Set context to hover in evaluate request for hover widget
If the adapter has the `supportsEvaluateForHovers` capability
2023-12-02 19:16:09 +01:00
Mathias Fussenegger
62b0beadbc Start seq number at 1
From the spec:

> Sequence number of the message (also known as message ID). The `seq` for
> the first message sent by a client or debug adapter is 1, and for each
> subsequent message is 1 greater than the previous message sent by that
> actor.
2023-12-02 14:11:45 +01:00
Mathias Fussenegger
13ce59d485 Evaluate config on run_last if adapter supports restart
Fixes https://github.com/mfussenegger/nvim-dap/issues/1101
2023-11-29 20:12:09 +01:00
Mathias Fussenegger
6693dfafe8 Add widget function to show diff of two expressions 2023-11-29 18:44:06 +01:00
Andrew Collins
20af8b580a
Fix clientID / clientName case in initialize request (#1100)
https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Initialize
2023-11-28 18:50:42 +01:00
Mathias Fussenegger
e154fdb6d7 Add some more type annotations 2023-11-17 17:09:07 +01:00
Mathias Fussenegger
9d81c11fd1 Add docs for dap-session and request method 2023-11-08 14:25:54 +01:00
Mathias Fussenegger
4048f37bc8 Change text for breakpoint unverified log entries
Closes https://github.com/mfussenegger/nvim-dap/issues/1007
2023-11-01 15:25:31 +01:00
Mathias Fussenegger
ef21207972 Add dap.ABORT to allow config functions to abort session
Closes https://github.com/mfussenegger/nvim-dap/issues/1036
2023-11-01 15:18:37 +01:00
Mathias Fussenegger
5f68498b4f Use vim.ui.input for launch.json promptString
Closes https://github.com/mfussenegger/nvim-dap/issues/1040
2023-11-01 14:13:31 +01:00
Mathias Fussenegger
4cba91ea09 Prioritize evaluate in expression widget over variable lookup
This makes the behavior consistent with the REPL
2023-11-01 13:20:44 +01:00
Mathias Fussenegger
79dbc70eb7 Eagerly load lazy variables when expanding children
As described in https://github.com/mfussenegger/nvim-dap/issues/1062
Some debug adapters heavily use the lazy hint.

For example, a collapsed list is initially displayed as:

    settings: ArrayList@50 size=1

That's good. But after expanding, the contained items looke like this:

    settings: ArrayList@50 size=1
      0: Assignment@66

Each individual item had to be expanded to show the value:

    settings: ArrayList@50 size=1
      0: Assignment@66 "Assignment{column='stats.jobs_log_size', expressions=[1024]}"

This removes the intermediate step, to go from:

    settings: ArrayList@50 size=1

Straight to:

    settings: ArrayList@50 size=1
      0: Assignment@66 "Assignment{column='stats.jobs_log_size', expressions=[1024]}"
2023-10-27 13:56:50 +02:00
Niko Steinhoff
3eb26a63a3 Stop always replacing with last scope
`lnum` and `end_` need to be set to `nil` when appending additional
scopes to the widget, otherwise the final scope overwrites all previous
ones. In the case of `lldb`, where you have 'Local', 'Global', and
'Registers', only the last scope 'Registers' would be drawn to the
widget.
2023-10-25 14:21:32 +02:00
Jongwook Choi
b595c82001 Show error messages when the coroutine in trigger_run throws an error
Problem: Any exceptions thrown inside coroutine-wrapped `trigger_run`
inside `dap.run()` are silenced. Dap session won't start silently
without any error messages displayed to users.

Solution: Protect the call of `trigger_run` and show error messages with
stacktrace, if any errors happened.
2023-10-22 11:06:22 +02:00
Kei Takahashi
70642a222b
Fix repl expressions leave an empty prompt in the middle (#1063)
Fixes #1052.

Explanation:

* REPL buffer is based on `buftype=prompt`, where nvim makes sure that
there is always a prompt at the end of buffer in insert mode (`dap> ` ).
* When a new command is entered, `exec` function in `repl.lua` is
executed (registered via `vim.fn.prompt_setcallback`). nvim does not put
the next prompt until callback returns, so, within the callback, new
lines can simply be appendend at the end of the buffer. (e.g. `.help`
command does not leave an empty prompt in the middle).
* Things get a bit tricky with expression command because when a DAP
server request comes back, nvim-dap is aldready outside of the callback,
and there is an empty prompt at the end of the buffer. Two options here
so not to leave an empty prompt in the middle,
  1. insert the new line(s) right in front of the empty prompt
  2. overwrite the last line with the new line(s)
* `append` function inside `repl.lua` is updated to apply the first
option. `evaluate_handler` now calls this function instead of
`layer.render` where possible.
* The second opton is used where `tree.render` is called inside
`evaluate_handler`.
2023-10-22 09:13:31 +02:00
TheLeoP
92dc531eea
Do not append text each time a widgets is opened (#1043)
Fixes #1042
2023-10-12 13:28:07 +02:00
Mathias Fussenegger
e79007c6d7 Update uv_stream_t type annotation
Requires uv. prefix in neovim nightly
2023-10-08 09:20:01 +02:00
Mathias Fussenegger
c28a22f25c Ensure threads floating win closes on frame selection
`_frame_set` changes the buffer and then `vim.bo.bufhidden` returned the
wrong value.
2023-10-08 09:19:36 +02:00
Mathias Fussenegger
27d65bd630 Expose repl.execute
For mappings like:

    dap.repl.open()
    dap.repl.execute(vim.fn.expand("<cexpr>"))

`widgets.hover()` is nice to zoom in on a single variable, but sometimes
you want to compare the values of several variables. Having their output
displayed in the REPL next to each other makes that easier.
2023-10-07 15:00:06 +02:00
Aeceon
b3d4408e29
Use sighup signal on windows to prevent exit code warnings (#969) 2023-09-14 13:32:10 +02:00
Mathias Fussenegger
47cd1226c4 Handle length/start in completions response in repl.omnifunc
Doesn't handle mixed cases yet but should fix the cpptools case
mentioned in https://github.com/mfussenegger/nvim-dap/issues/1037
2023-09-14 10:27:58 +02:00
Maria José Solano
0e6b7c47dd
Add semicolon to pick_process select prompt (#1032) 2023-09-07 09:55:21 +02:00
Niko Steinhoff
31e1ece773
Stop terminating "attached" debugees when exiting Vim (#1024)
If connecting to a process that's started externally, nvim shouldn't terminate the process on exit.
2023-08-31 11:29:27 +02:00
Mathias Fussenegger
fe15b35268 Show info about state if frames are missing in frames widget 2023-08-31 11:19:57 +02:00
Jens Claes
4377a05b94
Increase priority of signs (#1016)
When severity_sort is enabled, diagnostic sign priority can be raised
above 10 (1 per severity). And so by putting it at 21 and 22, dap
breakpoints are always shown, even when there are diagnostics

(Related to #197 )
2023-08-24 09:12:10 +02:00
Mathias Fussenegger
897c433ff2 Add type annotation for step_into opts; correct docs 2023-08-21 17:17:49 +02:00
Mathias Fussenegger
1c63f37f95 Prioritize focused window in switchbuf useopen/usetab
If the same buffer is open in multiple windows and one of them is
focused, use the focused window.
2023-08-01 17:19:58 +02:00
Mathias Fussenegger
5a39d1fe39 Add listener option to preview widget 2023-07-31 18:33:20 +02:00
Mathias Fussenegger
2f28ea843b Add support for unix domain sockets and named pipes
For adapters like cmake which don't support stdin or TCP

Closes https://github.com/mfussenegger/nvim-dap/issues/924

For example:

    local dap = require("dap")
    dap.adapters.cmake = {
      type = "pipe",
      pipe = "${pipe}",
      executable = {
        command = "cmake",
        args = {"--debugger", "--debugger-pipe", "${pipe}"}
      }
    }
    dap.configurations.cmake = {
      {
        name = "Build",
        type = "cmake",
        request = "launch",
      }
    }
2023-07-27 09:49:50 +02:00
Maria José Solano
9abbf79136
Use ps -U instead of ps -u (#994)
Fixes #993
2023-07-27 07:18:35 +02:00