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

Commit 7565d84

Browse files
committed
LSP Extensions using inlay_hints entry function. Document configuring LSP Extensions for inlay hints
1 parent c441df2 commit 7565d84

File tree

2 files changed

+41
-10
lines changed

2 files changed

+41
-10
lines changed

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,48 @@
22

33
Repo to hold a bunch of info & extension callbacks for built-in LSP. Use at your own risk :wink:
44

5+
## Install
6+
7+
Requires Built-in LSP, [Neovim Nightly](https://github.com/neovim/neovim/releases/tag/nightly), [nvim-lsp](https://github.com/neovim/nvim-lsp)
8+
9+
```vimscript
10+
" LSP Extensions (inlay-hints)
11+
Plug "tjdevries/lsp_extensions.nvim"
12+
```
13+
14+
## Inlay Hints (rust-analyzer)
15+
16+
![inlay-hints](https://i.imgur.com/YsOfqOk.png)
17+
18+
Inlay hints for the whole file:
19+
20+
```vimscript
21+
nnoremap <Leader>T :lua require'lsp_extensions'.inlay_hints()
22+
```
23+
24+
Only current line:
25+
26+
```vimscript
27+
nnoremap <Leader>t :lua require'lsp_extensions'.inlay_hints{ only_current_line = true }
28+
```
29+
30+
Available Options (Showing defaults):
31+
32+
```lua
33+
require'lsp_extensions'.inlay_hints{
34+
highlight = "Comment",
35+
prefix = " > ",
36+
aligned = false,
37+
only_current_line = false
38+
}
39+
```
540

641
## Clips
742

843
- Showing Line Diagnostics: https://clips.twitch.tv/ProductiveBoxyPastaCoolStoryBro
944

1045
- This Plugin:
11-
- Lined up hints: https://clips.twitch.tv/DaintyCorrectMarjoramKeepo
46+
47+
- Lined up hints: https://clips.twitch.tv/DaintyCorrectMarjoramKeepo
1248

1349
- N E O V I M: https://clips.twitch.tv/SmoothGoodTurnipCmonBruh

lua/lsp_extensions/init.lua

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,12 @@ Each extension should probably look like:
1616
1717
--]]
1818

19+
local vim = vim
1920
local extensions = {}
21+
local inlay_hints = require('lsp_extensions.inlay_hints')
2022

21-
22-
extensions.test = function(highlight)
23-
highlight = highlight or "Comment"
24-
25-
local inlay_hints = require('lsp_extensions.inlay_hints')
26-
vim.lsp.buf_request(0, 'rust-analyzer/inlayHints', inlay_hints.get_params(), inlay_hints.get_callback {
27-
only_current_line = false,
28-
aligned = true
29-
})
23+
extensions.inlay_hints = function(opts)
24+
vim.lsp.buf_request(0, 'rust-analyzer/inlayHints', inlay_hints.get_params(), inlay_hints.get_callback(opts))
3025
end
3126

3227
return extensions

0 commit comments

Comments
 (0)