mawkler / fidget.nvim

Standalone UI for nvim-lsp progress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fidget.nvim

Extensible UI for Neovim notifications and LSP progress messages.

fidget.nvim demo

Demo setup

Note that this demo may not always reflect the exact behavior of the latest release.

This screen recording was taken as I opened a Rust file I'm working on, triggering rust-analyzer to send me some LSP progress messages.

As those messages are ongoing, I trigger some notifications with the following:

local fidget = require("fidget")

vim.keymap.set("n", "A", function()
  fidget.notify("This is from fidget.notify().")
end)

vim.keymap.set("n", "B", function()
  fidget.notify("This is also from fidget.notify().", vim.log.levels.WARN)
end)

vim.keymap.set("n", "C", function()
  fidget.notify("fidget.notify() supports annotations...", nil, { annote = "MY NOTE", key = "foobar" })
end)

vim.keymap.set("n", "D", function()
  fidget.notify(nil, vim.log.levels.ERROR, { annote = "YOUR AD HERE", key = "foobar" })
  fidget.notify("... and overwriting notifications.", vim.log.levels.WARN, { annote = "bottom text" })
end)

(I use normal mode keymaps to avoid going into ex mode, which would pause Fidget rendering and make the demo look glitchy...)

Visible elements:

Why?

Fidget is an unintrusive window in the corner of your editor that manages its own lifetime. Its goals are:

  • to provide a UI for Neovim's $/progress handler
  • to provide a configurable vim.notify() backend
  • to support basic ASCII animations (Fidget spinners!) to indicate signs of life
  • to be easy to configure, sane to maintain, and fun to hack on

There's only so much information one can stash into the status line. Besides, who doesn't love a little bit of terminal eye candy, as a treat?

Quickstart

Requirements

Fidget requires Neovim v0.8.0+.

If you would like to see progress notifications, you must have configured Neovim with an LSP server that uses the $/progress handler. For an up-to-date list of LSP servers this plugin is known to work with, see this pinned issue.

Installation

Install this plugin using your favorite plugin manager.

See the documentation for setup() options.

{
  "j-hui/fidget.nvim",
  opts = {
    -- options
  },
}
Plug 'j-hui/fidget.nvim'

Make sure the plugin is installed run :PlugInstall.

After the plugin is loaded (e.g., after plug#end() for vim-plug), call its setup function (in Lua):

require("fidget").setup {
  -- options
}

Related Work

rcarriga/nvim-notify is first and foremost a vim.notify() backend, and it also supports LSP progress notifications (with the integration seems to have been packaged up in mrded/nvim-lsp-notify).

vigoux/notifier.nvim is a vim.notify() backend that comes with first-class LSP notification support.

neoclide/coc.nvim provides a nice LSP progress UI in the status line, which first inspired my desire to have this feature for nvim-lsp.

arkav/lualine-lsp-progress was the original inspiration for Fidget, and funnels LSP progress messages into nvim-lualine/lualine.nvim. I once borrowed some of its code (though much of that code has since been rewritten).

nvim-lua/lsp-status.nvim also supports showing progress text, though it requires some configuration to integrate that into their status line.

Acknowledgements

Most of the Fidget spinner patterns were adapted from the npm package sindresorhus/cli-spinners.

About

Standalone UI for nvim-lsp progress

License:MIT License


Languages

Language:Lua 100.0%