Skip to content
This repository was archived by the owner on Jul 7, 2022. It is now read-only.

Commit 905c1ce

Browse files
committed
example: Add inlay hints example
1 parent a158ca9 commit 905c1ce

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ Repo to hold a bunch of info & extension callbacks for built-in LSP. Use at
77

88
- Showing Line Diagnostics: https://clips.twitch.tv/ProductiveBoxyPastaCoolStoryBro
99

10+
- This Plugin:
11+
- Lined up hints: https://clips.twitch.tv/DaintyCorrectMarjoramKeepo
12+
1013
- N E O V I M: https://clips.twitch.tv/SmoothGoodTurnipCmonBruh

examples/inlay_hints_inline.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
local inlay_hints = require('lsp_extensions.inlay_hints')
2+
3+
local M = {}
4+
5+
-- Global function, so you can just call it on the lua side
6+
ShowInlineInlayHints = function()
7+
vim.lsp.buf_request(0, 'rust-analyzer/inlayHints', inlay_hints.get_params(), inlay_hints.get_callback {
8+
only_current_line = true
9+
})
10+
end
11+
12+
-- @rockerboo
13+
M.show_line_hints_on_cursor_events = function()
14+
vim.cmd [[augroup ShowLineHints]]
15+
vim.cmd [[ au!]]
16+
vim.cmd [[ autocmd CursorHold,CursorHoldI,CursorMoved *.rs :lua ShowInlineInlayHints()]]
17+
vim.cmd [[augroup END]]
18+
end
19+
20+
return M

0 commit comments

Comments
 (0)