Skip to content

Commit f7d75cc

Browse files
authored
feat: use external nio (#311)
BREAKING CHANGE: Requires https://github.com/nvim-neotest/nvim-nio to be installed
1 parent d548de8 commit f7d75cc

34 files changed

+124
-5290
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,28 @@ good out of the box configuration.
99

1010
## Installation
1111

12-
Install with your favourite package manager alongside nvim-dap
12+
Install with your favourite package manager alongside nvim-dap and nvim-nio
1313

1414
[**dein**](https://github.com/Shougo/dein.vim):
1515

1616
```vim
1717
call dein#add("mfussenegger/nvim-dap")
18+
call dein#add("nvim-neotest/nvim-nio")
1819
call dein#add("rcarriga/nvim-dap-ui")
1920
```
2021

2122
[**vim-plug**](https://github.com/junegunn/vim-plug)
2223

2324
```vim
2425
Plug 'mfussenegger/nvim-dap'
26+
Plug 'nvim-neotest/nvim-nio'
2527
Plug 'rcarriga/nvim-dap-ui'
2628
```
2729

2830
[**packer.nvim**](https://github.com/wbthomason/packer.nvim)
2931

3032
```lua
31-
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} }
33+
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap", "nvim-neotest/nvim-nio"} }
3234
```
3335

3436
It is highly recommended to use [neodev.nvim](https://github.com/folke/neodev.nvim) to enable type checking for nvim-dap-ui to get

doc/nvim-dap-ui.txt

Lines changed: 0 additions & 326 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ nvim-dap-ui *nvim-dap-ui*
1111
Watch Expressions...................................|dapui.elements.watches|
1212
Breakpoints.....................................|dapui.elements.breakpoints|
1313
Console.............................................|dapui.elements.console|
14-
Async Library..................................................|dapui.async|
1514

1615
A UI for nvim-dap which provides a good out of the box configuration.
1716
nvim-dap-ui is built on the idea of "elements". These elements are windows
@@ -431,329 +430,4 @@ dapui.elements.console *dapui.elements.console*
431430
The console window used by nvim-dap for the integrated terminal.
432431

433432

434-
==============================================================================
435-
dapui.async *dapui.async*
436-
437-
438-
The API is heavily inspired by Python's asyncio module and is currently
439-
experimental meaning that interfaces may change without warning.
440-
Users of nvim-dap-ui should not need to use this module directly.
441-
442-
*dapui.async.run()*
443-
`run`({func}, {cb})
444-
445-
Run a function in an async context. This is the entrypoint to all async
446-
functionality.
447-
>lua
448-
local async = require("dapui").async
449-
async.run(function()
450-
async.sleep(10)
451-
print("Hello world")
452-
end)
453-
<
454-
Parameters~
455-
{func} `(function)`
456-
Return~
457-
`(dapui.async.tasks.Task)`
458-
459-
*dapui.async.wrap()*
460-
`wrap`({func}, {argc})
461-
462-
Creates an async function with a callback style function.
463-
>lua
464-
local async = require("dapui").async
465-
local sleep = async.wrap(function(ms, cb)
466-
vim.defer_fn(cb, ms)
467-
end, 2)
468-
469-
async.run(function()
470-
sleep(10)
471-
print("Slept for 10ms")
472-
end)
473-
<
474-
Parameters~
475-
{func} `(function)` A callback style function to be converted. The last argument must be the callback.
476-
{argc} `(integer)` The number of arguments of func. Must be included.
477-
Return~
478-
`(function)` Returns an async function
479-
480-
*dapui.async.gather()*
481-
`gather`({functions})
482-
483-
Run a collection of async functions concurrently and return when
484-
all have finished.
485-
If any of the functions fail, all pending tasks will be cancelled and the
486-
error will be re-raised
487-
488-
Parameters~
489-
{functions} `(function[])`
490-
Return~
491-
`(any[][])` Packed results of all functions
492-
493-
*dapui.async.first()*
494-
`first`({functions})
495-
496-
Run a collection of async functions concurrently and return the result of
497-
the first to finish.
498-
499-
Parameters~
500-
{functions} `(function[])`
501-
Return~
502-
`(any)`
503-
504-
*dapui.async.sleep()*
505-
`sleep`({ms})
506-
507-
Suspend the current task for given time.
508-
Parameters~
509-
{ms} `(number)` Time in milliseconds
510-
511-
*dapui.async.scheduler()*
512-
`scheduler`()
513-
514-
Yields to the Neovim scheduler to be able to call the API.
515-
516-
517-
dapui.async.api *dapui.async.api*
518-
519-
Safely proxies calls to the vim.api module while in an async context.
520-
521-
dapui.async.fn *dapui.async.fn*
522-
523-
Safely proxies calls to the vim.fn module while in an async context.
524-
525-
Async versions of vim.ui functions
526-
527-
528-
==============================================================================
529-
dapui.async.control *dapui.async.control*
530-
531-
532-
Provides primitives for flow control to be used in async functions
533-
534-
535-
An event can signal to multiple listeners to resume execution
536-
The event can be set from a non-async context.
537-
*dapui.async.control.Event*
538-
Fields~
539-
{set} `(fun(max_woken?: integer): nil)` Set the event and signal to all (or limited number of) listeners that the event has occurred. If max_woken is provided and there are more listeners then the event is cleared immediately
540-
{wait} `(async fun(): nil)` Wait for the event to occur, returning immediately if
541-
already set
542-
{clear} `(fun(): nil)` Clear the event
543-
{is_set} `(fun(): boolean)` Returns true if the event is set
544-
545-
*dapui.async.control.event()*
546-
`event`()
547-
548-
Create a new event
549-
Return~
550-
`(dapui.async.control.Event)`
551-
552-
553-
An future represents a value that will be available in the future.
554-
The future result can be set from a non-async context.
555-
*dapui.async.control.Future*
556-
Fields~
557-
{set} `(fun(value): nil)` Set the future value and wake all waiters.
558-
{set_error} `(fun(message): nil)` Set the error for this future to raise to
559-
waiters
560-
{wait} `(async fun(): any)` Wait for the value to be set, returning immediately if already set
561-
562-
*dapui.async.control.future()*
563-
`future`()
564-
565-
Create a new future
566-
Return~
567-
`(dapui.async.control.Future)`
568-
569-
570-
A FIFO queue with async support.
571-
*dapui.async.control.Queue*
572-
Fields~
573-
{size} `(fun(): number)` Returns the number of items in the queue
574-
{max_size} `(fun(): number|nil)` Returns the maximum number of items in the queue
575-
{get} `(async fun(): any)` Get a value from the queue, blocking if the queue is empty
576-
{get_nowait} `(fun(): any)` Get a value from the queue, erroring if queue is empty.
577-
{put} `(async fun(value: any): nil)` Put a value into the queue
578-
{put_nowait} `(fun(value: any): nil)` Put a value into the queue, erroring if queue is full.
579-
580-
*dapui.async.control.queue()*
581-
`queue`({max_size})
582-
583-
Create a new queue
584-
Parameters~
585-
{max_size?} `(integer)` The maximum number of items in the queue, defaults to no limit
586-
Return~
587-
`(dapui.async.control.Queue)`
588-
589-
590-
An async semaphore that allows up to a given number of acquisitions.
591-
*dapui.async.control.Semaphore*
592-
Fields~
593-
{with} `(async fun(callback: fun(): nil): nil)` Run the callback with the semaphore acquired
594-
595-
*dapui.async.control.semaphore()*
596-
`semaphore`({value})
597-
598-
Create a new semaphore
599-
Parameters~
600-
{value} `(integer)` The number of allowed concurrent acquisitions
601-
602-
603-
==============================================================================
604-
dapui.async.uv *dapui.async.uv*
605-
606-
607-
Provides asynchronous versions of vim.loop functions.
608-
See corresponding function documentation for parameter and return
609-
information.
610-
611-
Fields~
612-
{close} `(async fun(handle: dapui.async.uv.Handle))`
613-
{fs_open} `(async fun(path: any, flags: any, mode: any): (string|nil,integer|nil))`
614-
{fs_read} `(async fun(fd: integer, size: integer, offset?: integer): (string|nil,string|nil))`
615-
{fs_close} `(async fun(fd: integer): (string|nil,boolean|nil))`
616-
{fs_unlink} `(async fun(path: string): (string|nil,boolean|nil))`
617-
{fs_write} `(async fun(fd: any, data: any, offset?: any): (string|nil,integer|nil))`
618-
{fs_mkdir} `(async fun(path: string, mode: integer): (string|nil,boolean|nil))`
619-
{fs_mkdtemp} `(async fun(template: string): (string|nil,string|nil))`
620-
{fs_rmdir} `(async fun(path: string): (string|nil,boolean|nil))`
621-
{fs_stat} `(async fun(path: string): (string|nil,dapui.async.uv.Stat|nil))`
622-
{fs_fstat} `(async fun(fd: integer): (string|nil,dapui.async.uv.Stat|nil))`
623-
{fs_lstat} `(async fun(path: string): (string|nil,dapui.async.uv.Stat|nil))`
624-
{fs_statfs} `(async fun(path: string): (string|nil,dapui.async.uv.StatFs|nil))`
625-
{fs_rename} `(async fun(old_path: string, new_path: string): (string|nil,boolean|nil))`
626-
{fs_fsync} `(async fun(fd: integer): (string|nil,boolean|nil))`
627-
{fs_fdatasync} `(async fun(fd: integer): (string|nil,boolean|nil))`
628-
{fs_ftruncate} `(async fun(fd: integer, offset: integer): (string|nil,boolean|nil))`
629-
{fs_sendfile} `(async fun(out_fd: integer, in_fd: integer, in_offset: integer, length: integer): (string|nil,integer|nil))`
630-
{fs_access} `(async fun(path: string, mode: integer): (string|nil,boolean|nil))`
631-
{fs_chmod} `(async fun(path: string, mode: integer): (string|nil,boolean|nil))`
632-
{fs_fchmod} `(async fun(fd: integer, mode: integer): (string|nil,boolean|nil))`
633-
{fs_utime} `(async fun(path: string, atime: number, mtime: number): (string|nil,boolean|nil))`
634-
{fs_futime} `(async fun(fd: integer, atime: number, mtime: number): (string|nil,boolean|nil))`
635-
{fs_link} `(async fun(path: string, new_path: string): (string|nil,boolean|nil))`
636-
{fs_symlink} `(async fun(path: string, new_path: string, flags?: integer): (string|nil,boolean|nil))`
637-
{fs_readlink} `(async fun(path: string): (string|nil,string|nil))`
638-
{fs_realpath} `(async fun(path: string): (string|nil,string|nil))`
639-
{fs_chown} `(async fun(path: string, uid: integer, gid: integer): (string|nil,boolean|nil))`
640-
{fs_fchown} `(async fun(fd: integer, uid: integer, gid: integer): (string|nil,boolean|nil))`
641-
{fs_lchown} `(async fun(path: string, uid: integer, gid: integer): (string|nil,boolean|nil))`
642-
{fs_copyfile} `(async fun(path: any, new_path: any, flags?: any): (string|nil,boolean|nil))`
643-
{fs_opendir} `(async fun(path: string, entries?: integer): (string|nil,dapui.async.uv.Dir|nil))`
644-
{fs_readdir} `(async fun(dir: dapui.async.uv.Dir): (string|nil,dapui.async.uv.DirEntry[]|nil))`
645-
{fs_closedir} `(async fun(dir: dapui.async.uv.Dir): (string|nil,boolean|nil))`
646-
{fs_scandir} `(async fun(path: string): (string|nil,dapui.async.uv.DirEntry[]|nil))`
647-
{shutdown} `(async fun(stream: dapui.async.uv.Stream): string|nil)`
648-
{listen} `(async fun(stream: dapui.async.uv.Stream, backlog: integer): string|nil)`
649-
{write} `(async fun(stream: dapui.async.uv.Stream, data: string|string[]): string|nil)`
650-
{write2} `(async fun(stream: dapui.async.uv.Stream, data: string|string[], send_handle: dapui.async.uv.Stream): string|nil)`
651-
652-
*dapui.async.uv.Handle*
653-
654-
*dapui.async.uv.Stream*
655-
Inherits: `dapui.async.uv.Handle`
656-
657-
658-
*dapui.async.uv.Stat*
659-
Fields~
660-
{dev} `(integer)`
661-
{mode} `(integer)`
662-
{nlink} `(integer)`
663-
{uid} `(integer)`
664-
{gid} `(integer)`
665-
{rdev} `(integer)`
666-
{ino} `(integer)`
667-
{size} `(integer)`
668-
{blksize} `(integer)`
669-
{blocks} `(integer)`
670-
{flags} `(integer)`
671-
{gen} `(integer)`
672-
{atime} `(dapui.async.uv.StatTime)`
673-
{mtime} `(dapui.async.uv.StatTime)`
674-
{ctime} `(dapui.async.uv.StatTime)`
675-
{birthtime} `(dapui.async.uv.StatTime)`
676-
{type} `(string)`
677-
678-
*dapui.async.uv.StatTime*
679-
Fields~
680-
{sec} `(integer)`
681-
{nsec} `(integer)`
682-
683-
*dapui.async.uv.StatFs*
684-
Fields~
685-
{type} `(integer)`
686-
{bsize} `(integer)`
687-
{blocks} `(integer)`
688-
{bfree} `(integer)`
689-
{bavail} `(integer)`
690-
{files} `(integer)`
691-
{ffree} `(integer)`
692-
693-
*dapui.async.uv.Dir*
694-
695-
*dapui.async.uv.DirEntry*
696-
697-
698-
==============================================================================
699-
dapui.async.ui *dapui.async.ui*
700-
701-
702-
Async versions of vim.ui functions.
703-
704-
*dapui.async.ui.input()*
705-
`input`({args})
706-
707-
708-
Parameters~
709-
{args} `(dapui.async.ui.InputArgs)`
710-
711-
*dapui.async.ui.InputArgs*
712-
Fields~
713-
{prompt} `(string|nil)` Text of the prompt
714-
{default} `(string|nil)` Default reply to the input
715-
{completion} `(string|nil)` Specifies type of completion supported for input. Supported types are the same that can be supplied to a user-defined command using the "-complete=" argument. See |:command-completion|
716-
{highlight} `(function)` Function that will be used for highlighting user inputs.
717-
718-
*dapui.async.ui.select()*
719-
`select`({items}, {args})
720-
721-
722-
Parameters~
723-
{items} `(any[])`
724-
{args} `(dapui.async.ui.SelectArgs)`
725-
726-
*dapui.async.ui.SelectArgs*
727-
Fields~
728-
{prompt} `(string|nil)` Text of the prompt. Defaults to `Select one of:`
729-
{format_item} `(function|nil)` Function to format an individual item from `items`. Defaults to `tostring`.
730-
{kind} `(string|nil)` Arbitrary hint string indicating the item shape. Plugins reimplementing `vim.ui.select` may wish to use this to infer the structure or semantics of `items`, or the context in which select() was called.
731-
732-
733-
==============================================================================
734-
dapui.async.tests *dapui.async.tests*
735-
736-
737-
Async versions of plenary's test functions.
738-
739-
*dapui.async.tests.it()*
740-
`it`({name}, {async_func})
741-
742-
Parameters~
743-
{name} `(string)`
744-
{async_func} `(function)`
745-
746-
*dapui.async.tests.before_each()*
747-
`before_each`({async_func})
748-
749-
Parameters~
750-
{async_func} `(function)`
751-
752-
*dapui.async.tests.after_each()*
753-
`after_each`({async_func})
754-
755-
Parameters~
756-
{async_func} `(function)`
757-
758-
759433
vim:tw=78:ts=8:noet:ft=help:norl:

0 commit comments

Comments
 (0)