I archived this repo because I think there are better language specific repos to handle the kinds of things we have here.
Feel free to copy anything inside of here and then use it in your own language-specific or feature-specific repos.
Thanks
- TJ
Requires Built-in LSP, Neovim Nightly, nvim-lsp
" LSP Extensions
Plug 'nvim-lua/lsp_extensions.nvim'
Inlay hints for the whole file:
nnoremap <Leader>T :lua require'lsp_extensions'.inlay_hints()
Only current line:
nnoremap <Leader>t :lua require'lsp_extensions'.inlay_hints{ only_current_line = true }
Run on showing file or new file in buffer:
autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require'lsp_extensions'.inlay_hints{}
On cursor hover, get hints for current line:
autocmd CursorHold,CursorHoldI *.rs :lua require'lsp_extensions'.inlay_hints{ only_current_line = true }
By default only ChainingHint is enabled. This is due to Neovim not able to add virtual text injected into a line. To enable all hints: Note: Hints will overwrite if other hints using this. Only the last hint will be shown.
:lua require('lsp_extensions').inlay_hints{ enabled = {"TypeHint", "ChainingHint", "ParameterHint"} }
Available Options (Showing defaults):
require'lsp_extensions'.inlay_hints{
highlight = "Comment",
prefix = " > ",
aligned = false,
only_current_line = false,
enabled = { "ChainingHint" }
}
autocmd InsertLeave,BufEnter,BufWinEnter,TabEnter,BufWritePost *.rs :lua require'lsp_extensions'.inlay_hints{ prefix = ' » ', highlight = "NonText", enabled = {"ChainingHint"} }
Check out the example file for setup
Check out the example file for setup
To enable workspace diagnostics, you'll want do something like this:
-- use the same configuration you would use for `vim.lsp.diagnostic.on_publish_diagnostics`.
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
require('lsp_extensions.workspace.diagnostic').handler, {
signs = {
severity_limit = "Error",
}
}
)
To use workspace diagnostics, you can do some of the following:
-- Get the counts from your curreent workspace:
local ws_errors = require('lsp_extensions.workspace.diagnostic').get_count(0, 'Error')
local ws_hints = require('lsp_extensions.workspace.diagnostic').get_count(0, 'Hint')
-- Set the qflist for the current workspace
-- For more information, see `:help vim.lsp.diagnostic.set_loc_list()`, since this has some of the same configuration.
require('lsp_extensions.workspace.diagnostic').set_qf_list()
-
Showing Line Diagnostics: https://clips.twitch.tv/ProductiveBoxyPastaCoolStoryBro
-
This Plugin:
-
N E O V I M: https://clips.twitch.tv/SmoothGoodTurnipCmonBruh