back to TILs

Neovim :Inspect

Yesterday, I was working on improving buf’s lsp protobuf semantic tokens, and needed to test out how my changes were working in a real LSP client.

I knew neovim had a couple of helper functions for inspecting the current position; first I tried:

:lua vim.print(vim.inspect_pos())

I figured there must be a function more specifically for semantic tokens:

:lua vim.print(vim.lsp.semantic_tokens.get_at_pos())

But finally I landed on:

:Inspect

(neovim docs)

which prints both treesitter and semantic tokens, but in a much cleaner way than the two lua functions.

I’ve keymapped the underlying vim.show_pos() function to <leader>i in neovim for easier access.