luahint

LSP inline hints for Lua, intended for use with Neovim.

Stars
16

luahint

LSP inline hints for Lua, intended for use with Neovim.

Now that inline hints are working in Neovim nightly, I figured I'd attempt to build an LSP-adjacent project. Luahint provides inline parameter hints via LSP, and potentially more in the future. It's a work in progress right now, but here's a screenshot:

Goals

  • Basic function parameter hints
  • Index entire runtime (currently only indexes single file)
  • Table function parameter hints
  • Method parameter hints
  • Metamethod parameter hints
  • Emmylua type hints

Installation

With lazy.nvim

{
	"willothy/luahint",
	build = "cargo install --path=./",
	config = true
	-- or opts = { ... }
}

Configuration

Luahint comes with the following defaults:

{
	-- string[] | string
	-- Autocommands that should trigger a refresh
	update = {
		"CursorHold",
		"CursorHoldI",
		"InsertLeave",
		"TextChanged",
	},

	-- boolean
	-- Whether to enable the plugin at startup
	enabled_at_startup = true,

	-- fun(): string
	-- Function to determine the root directory of the project
	root_dir = vim.fn.getcwd,
}

Usage

local hints = require("luahint")

-- show the hints
hints.show()

-- hide the hints
hints.hide()

-- toggle the hints
hints.toggle()