Compare commits

..

7 Commits

Author SHA1 Message Date
879e29504d chore(main): release 10.8.2 (#2097)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-11-30 21:27:02 +01:00
8baf9b5459 fix(lsp): fix inlay hints for older nightlies. See #2007 2023-11-30 21:24:07 +01:00
6ac331b588 chore(main): release 10.8.1 (#2095)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-11-30 20:20:39 +01:00
e229988a98 fix(lsp): inlay hints on stable. See #2007 2023-11-30 20:17:07 +01:00
11a8a6bea7 fix(ui): signcolumn signs on nightly. Fixes #2039 2023-11-30 20:17:07 +01:00
4ebda08d49 chore(build): auto-generate vimdoc 2023-11-30 18:54:19 +00:00
6853b785d9 fix(lsp): detect if using nvim-0.10 and use new inlay_hint.enable method (#2007)
* Detect if using nvim 0.10 and use new inlay_hint.enable method

* Add lsp util for inlay-hints and update keymap

* Remove the need to check vim version

* Support older nightly builds

* Move inlay_hint toggle in Util.toggle

---------

Co-authored-by: Gary Murray <gamurray@fanatics.com>
2023-11-30 19:53:40 +01:00
7 changed files with 49 additions and 14 deletions

View File

@ -1,5 +1,21 @@
# Changelog
## [10.8.2](https://github.com/LazyVim/LazyVim/compare/v10.8.1...v10.8.2) (2023-11-30)
### Bug Fixes
* **lsp:** fix inlay hints for older nightlies. See [#2007](https://github.com/LazyVim/LazyVim/issues/2007) ([8baf9b5](https://github.com/LazyVim/LazyVim/commit/8baf9b5459a903c783a1d34ad438e64036a8e15e))
## [10.8.1](https://github.com/LazyVim/LazyVim/compare/v10.8.0...v10.8.1) (2023-11-30)
### Bug Fixes
* **lsp:** detect if using nvim-0.10 and use new inlay_hint.enable method ([#2007](https://github.com/LazyVim/LazyVim/issues/2007)) ([6853b78](https://github.com/LazyVim/LazyVim/commit/6853b785d9916be6ffe4965aefd8554ed276f802))
* **lsp:** inlay hints on stable. See [#2007](https://github.com/LazyVim/LazyVim/issues/2007) ([e229988](https://github.com/LazyVim/LazyVim/commit/e229988a98a81b000fda3aadbb4fc404aeaa599e))
* **ui:** signcolumn signs on nightly. Fixes [#2039](https://github.com/LazyVim/LazyVim/issues/2039) ([11a8a6b](https://github.com/LazyVim/LazyVim/commit/11a8a6bea7a26ca5257fa4cbef90e0abdb22c349))
## [10.8.0](https://github.com/LazyVim/LazyVim/compare/v10.7.1...v10.8.0) (2023-11-04)

View File

@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 November 04
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 November 30
==============================================================================
Table of Contents *LazyVim-table-of-contents*

View File

@ -3,7 +3,7 @@ local Util = require("lazyvim.util")
---@class LazyVimConfig: LazyVimOptions
local M = {}
M.version = "10.8.0" -- x-release-please-version
M.version = "10.8.2" -- x-release-please-version
---@class LazyVimOptions
local defaults = {

View File

@ -119,8 +119,8 @@ map("n", "<leader>ul", function() Util.toggle.number() end, { desc = "Toggle Lin
map("n", "<leader>ud", function() Util.toggle.diagnostics() end, { desc = "Toggle Diagnostics" })
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
map("n", "<leader>uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
if vim.lsp.inlay_hint then
map("n", "<leader>uh", function() vim.lsp.inlay_hint(0, nil) end, { desc = "Toggle Inlay Hints" })
if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then
map( "n", "<leader>uh", function() Util.toggle.inlay_hints() end, { desc = "Toggle Inlay Hints" })
end
map("n", "<leader>uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" })

View File

@ -115,12 +115,10 @@ return {
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
end
local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint
if opts.inlay_hints.enabled and inlay_hint then
if opts.inlay_hints.enabled then
Util.lsp.on_attach(function(client, buffer)
if client.supports_method("textDocument/inlayHint") then
inlay_hint(buffer, true)
Util.toggle.inlay_hints(buffer, true)
end
end)
end

View File

@ -53,6 +53,20 @@ function M.diagnostics()
end
end
---@param buf? number
---@param value? boolean
function M.inlay_hints(buf, value)
local ih = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint
if type(ih) == "function" then
ih(buf, value)
elseif type(ih) == "table" and ih.enable then
if value == nil then
value = not ih.is_enabled(buf)
end
ih.enable(buf, value)
end
end
setmetatable(M, {
__call = function(m, ...)
return m.option(...)

View File

@ -10,12 +10,19 @@ local M = {}
function M.get_signs(buf, lnum)
-- Get regular signs
---@type Sign[]
local signs = vim.tbl_map(function(sign)
---@type Sign
local ret = vim.fn.sign_getdefined(sign.name)[1]
ret.priority = sign.priority
return ret
end, vim.fn.sign_getplaced(buf, { group = "*", lnum = lnum })[1].signs)
local signs = {}
if vim.fn.has("nvim-0.10") == 0 then
-- Only needed for Neovim <0.10
-- Newer versions include legacy signs in nvim_buf_get_extmarks
for _, sign in ipairs(vim.fn.sign_getplaced(buf, { group = "*", lnum = lnum })[1].signs) do
local ret = vim.fn.sign_getdefined(sign.name)[1] --[[@as Sign]]
if ret then
ret.priority = sign.priority
signs[#signs + 1] = ret
end
end
end
-- Get extmark signs
local extmarks = vim.api.nvim_buf_get_extmarks(