docs: added LazyMsg

This commit is contained in:
Folke Lemaitre 2024-06-28 20:22:08 +02:00
parent 9d4b3f0818
commit 12850c2a34
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 11 additions and 2 deletions

View File

@ -46,7 +46,7 @@ To make it easier for users to install your plugin, you can include a [package s
:::
- Inside a `build` function or `*.lua` build file, use `coroutine.yield(status_msg)` to show progress.
- Inside a `build` function or `*.lua` build file, use `coroutine.yield(msg:string|LazyMsg)` to show progress.
- Don't change the `cwd` in your build function, since builds run in parallel and changing the `cwd` will affect other builds.
@ -64,9 +64,18 @@ The spec **build** property can be one of the following:
- if no `build` is specified, but a `build.lua` file exists, that will be used instead.
Build functions and `*.lua` files run asynchronously in a coroutine.
Use `coroutine.yield(status_msg)` to show progress.
Use `coroutine.yield(msg:string|LazyMsg)` to show progress.
Yielding will also schedule the next `coroutine.resume()` to run in the next tick, so you can do long-running tasks without blocking Neovim.
```lua
---@class LazyMsg
---@field msg string
---@field level? number vim.log.levels.XXX
```
Use `vim.log.levels.TRACE` to only show the message as a **status** message for the task.
:::tip
If you need to know the directory of your build lua file, you can use: