mirror of
https://github.com/neovim/neovim.git
synced 2025-11-15 06:49:01 +00:00
fix(lsp): don't overlay insertion-style inline completions (#36477)
* feat(lua): `Range:is_empty()` to check vim.range emptiness * fix(lsp): don't overlay insertion-style inline completions **Problem:** Some servers commonly respond with an empty inline completion range which acts as a position where text should be inserted. However, the inline completion module assumes that all responses with a range are deletions + insertions that thus require an `overlay` display style. This causes an incorrect preview, because the virtual text should have the `inline` display style (to reflect that this is purely an insertion). **Solution:** Only use `overlay` for non-empty replacement ranges.
This commit is contained in:
@@ -99,6 +99,13 @@ function Range.__eq(r1, r2)
|
||||
return r1.start == r2.start and r1.end_ == r2.end_
|
||||
end
|
||||
|
||||
--- Checks whether the given range is empty; i.e., start >= end.
|
||||
---
|
||||
---@return boolean `true` if the given range is empty
|
||||
function Range:is_empty()
|
||||
return self.start >= self.end_
|
||||
end
|
||||
|
||||
--- Checks whether {outer} range contains {inner} range.
|
||||
---
|
||||
---@param outer vim.Range
|
||||
|
||||
Reference in New Issue
Block a user