Commit graph

638 commits

Author SHA1 Message Date
Mathias Fussenegger
3c3e0a8245 Set empty capabilities when session is created
Mostly to match the emmylua type annotations
2022-09-22 17:06:29 +02:00
William Boman
bbd3e7e15a
Fix evaluate error message handling in REPL (#689) 2022-09-21 18:05:47 +02:00
Mathias Fussenegger
e12496beb5 Print errors using format/variables from error response if available 2022-09-19 20:31:06 +02:00
Mathias Fussenegger
58d7097f07 Set terminal window options with scope = local
Should help ensure the global value is left unmodified.
2022-09-18 14:23:55 +02:00
Mathias Fussenegger
2cfd77058d Add an id to sessions
Mostly just as a debugging aid to implement multi-session support and
identify sessions
2022-09-17 13:16:36 +02:00
Mathias Fussenegger
d9b315a816 Expose json_decode for overrides in ext.vscode
Closes https://github.com/mfussenegger/nvim-dap/issues/650
2022-09-08 10:52:29 +02:00
koopa
ea25d6d787
Allow sign customization without importing dap first (#664)
if a sign is already set in some user config we do not overwrite the
value and skip it. This enables sign configuration by the user
regardless where the user requires the dap plugin
2022-08-29 23:23:25 +02:00
Mathias Fussenegger
57003a082a Add third param to fn.input mocks
Otherwise lua-language-server gets confused and reports warnings about
vim.fn.input calls with more than 2 arguments
2022-08-28 10:13:29 +02:00
Mathias Fussenegger
11c51ef603 Support using more than one input var within one property 2022-08-27 14:05:08 +02:00
Mathias Fussenegger
57f5a11b0e Support using ${input:...} within arrays or dicts in launch.json 2022-08-27 14:05:08 +02:00
Mathias Fussenegger
cc44f047f3 Add support for inputs in vscode/launch.json 2022-08-27 14:05:08 +02:00
Mathias Fussenegger
bba0354d0e Add a DapLoadLaunchJSON command 2022-08-27 14:05:08 +02:00
Roberto Pommella Alegro
618c068e42
Clear debugPC sign on dap.close() (#657) 2022-08-24 18:18:55 +02:00
Mathias Fussenegger
ad8b0de205 Increase amount of connect retries; expose setting
Should solve https://github.com/mfussenegger/nvim-dap/issues/641
2022-08-15 10:17:07 +02:00
Mathias Fussenegger
66d33b7585 Ensure repl autocompletion doesn't trigger in other buffers 2022-08-05 15:19:26 +02:00
Mathias Fussenegger
4f63bdaf3f repl: Avoid interleaved prompt in expression output 2022-08-05 15:19:26 +02:00
Mathias Fussenegger
172d4b1661 Update test matrix and document supported Neovim versions 2022-08-03 19:38:03 +02:00
Mathias Fussenegger
c545cbc247 Add some more context to error messages from debug adapters 2022-08-03 19:20:54 +02:00
Mathias Fussenegger
82335575c3 Clear callbacks after client closed 2022-08-03 19:20:54 +02:00
Mathias Fussenegger
458c5f5c3f Support presentationHint.lazy in widgets showing variables 2022-08-03 16:12:14 +02:00
Mathias Fussenegger
3aa863c4ca Clear visual mode before showing hover window 2022-08-02 19:49:35 +02:00
Mathias Fussenegger
fed27e740b Support multiple refresh listeners per widget 2022-08-01 19:58:36 +02:00
Mathias Fussenegger
a13d6cb9ea Improve error message on empty adapter.command
It was easy to miss that the command was empty:

    Error running : ENOENT: no such file or directory
2022-07-28 19:49:32 +02:00
Mathias Fussenegger
8eccebd78f Schedule pick_one callback to ensure error messages are visible
Error messages reported by `error` or `assert` calls could go unnoticed
depending on the `vim.ui.select` implementation.

Scheduling the callback should avoid that.
2022-07-28 19:49:32 +02:00
Mathias Fussenegger
8ad2d9ecb4 Make ui.pick* coroutine aware 2022-07-28 19:20:39 +02:00
Mathias Fussenegger
0b713b7acc Make session:request coroutine aware
If running within a coroutine the callback argument can now be omitted
to get the result as return value.

This can be utilized to avoid nesting via multiple callbacks if a method
requires multiple requests.
2022-07-28 19:20:39 +02:00
Mathias Fussenegger
b3998a9a18 Deprecate get_visual_selection_text and visual_selection_range 2022-07-26 20:54:45 +02:00
Mathias Fussenegger
ec7b2b5602 Set bufhidden=delete for preview window buffer
Closing the preview window via `CTLR-w z` / `:pclose` shouldn't leave
stale buffers.
2022-07-26 20:39:19 +02:00
Mathias Fussenegger
2a52cf6079 Use selection as expression if calling hover or preview in visual mode
Makes sure `vim.keymap.set('v', lhs, require('dap.ui.widgets').hover)`
works as expected and makes it unnecessary to use something like this
instead:

    [[<ESC><CMD>lua require'dap.ui.widgets'.hover(require("dap.utils").get_visual_selection_text)<CR>]]
2022-07-25 20:26:34 +02:00
Mathias Fussenegger
d2fcb949cd Support changing breakpoint verified state via breakpoint event 2022-07-24 20:05:45 +02:00
Mathias Fussenegger
3ec739523a Don't mark threads as dirty if a known thread starts
Can avoid an extra threads request on a following stopped event.
2022-07-23 17:08:28 +02:00
Mathias Fussenegger
912f43b5dd Avoid keeping a session reference in breakpoint detach handlers
`detach_handlers` is global and by the time a buffer is deleted a new
session might be active.
2022-07-23 15:53:40 +02:00
Mathias Fussenegger
06237474e8 Add a dap-type buffer variable to terminal buffers with the config.type value
This can be used by scripts or similar to process the terminal buffers
output depending on the config type. If a session ended, the information
is otherwise no longer available.

For example, one could parse the output of `python unittest` into the
quickfix list with something like this:

    local efms = {
      python = [[%C %.%#,%A  File "%f"\, line %l%.%#,%Z%[%^ ]%\@=%m]],
    }

    function M.load()
      local buf = api.nvim_get_current_buf()
      local ft = vim.b[buf]['dap-type'] or vim.bo.filetype
      local efm = efms[ft] or vim.bo.errorformat or vim.g.errorformat
      local lines = api.nvim_buf_get_lines(buf, 0, -1, true)
      vim.fn.setqflist({}, 'r', { efm = efm, lines = lines })
    end
2022-07-23 15:39:10 +02:00
Mathias Fussenegger
674ca42694 Prevent timed-out disconnects from clearing a new session
If a user called disconnect multiple times and then started a new
session, the disconnect callback would fire after a timeout and close
the new session, leaving the client in a inconsistent state.

Also removes a duplicate test case
2022-07-23 11:23:13 +02:00
Mathias Fussenegger
e2b7e85be7 Make pick_process coroutine aware and use vim.ui.select 2022-07-23 10:31:43 +02:00
Mathias Fussenegger
4f1f1d59ca Support coroutine values in configuration evaluation
This would allow using stuff like `vim.ui.select` within the
configuration values.

The requirements are:

- The function must return a coroutine
- The coroutine must resume the **outer** coroutine with the result

An example:

```
foo = function()
  return coroutine.create(function(dap_run_co)
    local items = {'one', 'two'}
    vim.ui.select(items, { label = 'foo> '}, function(choice)
      coroutine.resume(dap_run_co, choice)
    end)
  end)
end,
```
2022-07-23 10:31:43 +02:00
Mathias Fussenegger
c0dc1a81d1 Add a preview widget function to show expressions in the preview window 2022-07-23 10:15:07 +02:00
Mathias Fussenegger
69efa4d40e Fix lua-language-server callbacks warnings in dap.session 2022-07-21 23:06:40 +02:00
Mathias Fussenegger
44990e306f Add thread selection on step if no paused thread has focus
Should resolve https://github.com/mfussenegger/nvim-dap/issues/575
2022-07-21 23:06:40 +02:00
Mathias Fussenegger
c0f43f43b3 Keep cursor position if already at jump location
If you position the cursor over a variable in anticipation of hitting
the breakpoint to inspect it, it's a bit annoying if it jumps to the
first column.
2022-07-21 11:01:17 +02:00
Mathias Fussenegger
f9cac91213 Fix goto_ handling (clear stopped flags)
Closes https://github.com/mfussenegger/nvim-dap/issues/609
2022-07-19 09:22:39 +02:00
Rónán Carrigan
4fb5596fb5
Disable bd mapping for integrated terminal until process completes (#607) 2022-07-19 08:42:04 +02:00
Mathias Fussenegger
b857fc1ffb Extend server adapter definition to support spawning executable's
This makes the adapter definition for adapters that don't support STDIO
but only TCP a bit easier. For example, for delve it reduces the adapter
definition to:

    dap.adapters.delve = {
      type = 'server',
      port = '${port}',
      executable = {
        command = 'dlv',
        args = {'dap', '-l', '127.0.0.1:${port}'},
      }
    }
2022-07-16 17:51:09 +02:00
Lukas
b9328b0cbd
Change load_launchjs to merge configurations by name 2022-07-13 19:33:45 +02:00
Mathias Fussenegger
193e833dc0 Fix Invalid channel id errors if terminal buffer is deleted
Debugging something and deleting the terminal buffer before the
process exits caused `Invalid channel id` errors because the output of
the process can no longer be sent to the terminal buffer.

This mutes the messages.
2022-07-13 19:32:20 +02:00
Mathias Fussenegger
f4a3be57f6 Adjust vim.filetype.match call to changed API 2022-06-29 21:23:36 +02:00
Mathias Fussenegger
3b5e4b77e8 Workaround lua-language-server vim.notify warning
The monkey patching in the test messed with lua-language-server, leading
to false warnings about the number of parameters.
2022-06-25 12:54:42 +02:00
Mathias Fussenegger
06101f720e Avoid table.concat call in integrated terminal
Looks like this might be a workaround for https://github.com/mfussenegger/nvim-dap/issues/589
2022-06-25 12:04:50 +02:00
Mathias Fussenegger
2420042482 Remove notify call on allThreadsStopped
The notify was intended for edge cases, assuming that there would be no
jump action, but 688cb52d8b changed that
and made it more common.
2022-06-24 13:47:14 +02:00
Mathias Fussenegger
014ebd5361 Adjust filetype.match usage to nightly changes
filetype.match no longer sets the filetype itself: https://github.com/neovim/neovim/pull/18894
2022-06-10 11:38:09 +02:00