mirror of
https://github.com/neovim/neovim.git
synced 2026-07-16 14:11:28 +00:00
fix(lsp): ensure the codelens on the first line is visible
This commit is contained in:
@@ -259,6 +259,12 @@ function Provider:on_win(toprow, botrow)
|
|||||||
virt_lines_overflow = 'scroll',
|
virt_lines_overflow = 'scroll',
|
||||||
hl_mode = 'combine',
|
hl_mode = 'combine',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Fix https://github.com/neovim/neovim/issues/16166
|
||||||
|
-- Make sure the code lens on the first line is visible when updating.
|
||||||
|
if row == 0 then
|
||||||
|
vim.cmd('normal! zb')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self.row_version[row] = self.version
|
self.row_version[row] = self.version
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ describe('vim.lsp.codelens', function()
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
local grid_with_lenses = dedent([[
|
local grid_with_lenses = dedent([[
|
||||||
|
{1: 1 implementation} |
|
||||||
struct S { |
|
struct S { |
|
||||||
a: i32, |
|
a: i32, |
|
||||||
b: String, |
|
b: String, |
|
||||||
@@ -52,7 +53,6 @@ describe('vim.lsp.codelens', function()
|
|||||||
println!("S.a: {}, S.b: {}", s.a, s.b); |
|
println!("S.a: {}, S.b: {}", s.a, s.b); |
|
||||||
} |
|
} |
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|
|
|
||||||
|
|
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -248,6 +248,7 @@ describe('vim.lsp.codelens', function()
|
|||||||
feed('ggdd')
|
feed('ggdd')
|
||||||
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
{1: 1 implementation} |
|
||||||
^a: i32, |
|
^a: i32, |
|
||||||
b: String, |
|
b: String, |
|
||||||
} |
|
} |
|
||||||
@@ -265,7 +266,7 @@ describe('vim.lsp.codelens', function()
|
|||||||
println!("S.a: {}, S.b: {}", s.a, s.b); |
|
println!("S.a: {}, S.b: {}", s.a, s.b); |
|
||||||
} |
|
} |
|
||||||
|
|
|
|
||||||
{1:~ }|*2
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]])
|
]])
|
||||||
exec_lua(function()
|
exec_lua(function()
|
||||||
@@ -276,6 +277,7 @@ describe('vim.lsp.codelens', function()
|
|||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
{1: 1 implementation} |
|
||||||
^a: i32, |
|
^a: i32, |
|
||||||
b: String, |
|
b: String, |
|
||||||
} |
|
} |
|
||||||
@@ -293,7 +295,7 @@ describe('vim.lsp.codelens', function()
|
|||||||
println!("S.a: {}, S.b: {}", s.a, s.b); |
|
println!("S.a: {}, S.b: {}", s.a, s.b); |
|
||||||
} |
|
} |
|
||||||
|
|
|
|
||||||
{1:~ }|*2
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
@@ -378,6 +380,7 @@ describe('vim.lsp.codelens', function()
|
|||||||
it('clears extmarks beyond the bottom of the buffer', function()
|
it('clears extmarks beyond the bottom of the buffer', function()
|
||||||
feed('12G4dd')
|
feed('12G4dd')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
{1: 1 implementation} |
|
||||||
struct S { |
|
struct S { |
|
||||||
a: i32, |
|
a: i32, |
|
||||||
b: String, |
|
b: String, |
|
||||||
@@ -390,7 +393,7 @@ describe('vim.lsp.codelens', function()
|
|||||||
} |
|
} |
|
||||||
|
|
|
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|*7
|
{1:~ }|*6
|
||||||
4 fewer lines |
|
4 fewer lines |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user