Skip to content

v0.8.0

Choose a tag to compare

@nmfirdausw nmfirdausw released this 21 Oct 10:54
· 7 commits to main since this release
c28d63e

What's Changed

Features

Completion

  • Add documentation and signature_help options by @nmfirdausw in #9

Refactors

Completion

Highlights

  • No more menu while typing. The completion menu now opens only on request, for both the native engine and blink.cmp. Open it with <C-x><C-o>, <C-n> or <C-p> in insert mode, or <Tab> on the command line.
  • autoshow brings the old behaviour back. Set autoshow = true and the menu opens as you type, as in v0.7.0.
  • Documentation and signature help. Two new options, off by default, show the selected item's documentation and the signature of the call you are typing.
  • Same keys on both engines. The native engine now has blink's <C-k> to toggle signature help, and <C-b> / <C-f> to scroll the documentation.

Usage

require("batu").setup({
  completion = {
    autoshow = false,        -- open the menu as you type (default: on request)
    documentation = false,   -- show docs next to the menu
    signature_help = false,  -- show the signature while typing a call
    -- blink = true,         -- use blink.cmp instead of the built-in
  },
})
Option Default Effect
autoshow false true opens the menu as you type, on the command line and in LSP completion
documentation false true shows the selected item's documentation beside the menu
signature_help false true shows signature help on trigger characters and after accepting an item

Keys

Key Mode Action
<C-x><C-o> insert LSP omni completion
<C-n> <C-p> insert Open the menu (with blink, the first item is selected)
<Tab> command line Open the menu
<C-k> insert Toggle signature help
<C-b> <C-f> insert Scroll the documentation

How it works

On the native engine, documentation adds popup to completeopt, and signature_help calls vim.lsp.buf.signature_help() when a trigger character is typed and after an item is accepted. With autoshow off, LSP completion is attached without autotrigger, and o is added to complete so <C-n> / <C-p> include the server's items. On blink, the options set completion.menu.auto_show, completion.documentation.auto_show and signature.enabled, with signature.trigger.show_on_accept so the signature shows after accepting an item.

Upgrading

The menu no longer opens as you type. To keep the old behaviour, set completion = { autoshow = true }. On the native engine, <C-k> in insert mode now toggles signature help instead of entering digraphs.

Full Changelog: v0.7.0...v0.8.0