Skip to content

Commit 0c8e067

Browse files
committed
Hackily immediately change the infoview when the LSP dies.
Honestly the reason to do this now is the stupid test suite failure on nightly. God do I hate nvim flakiness.
1 parent 6052a06 commit 0c8e067

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lua/lean/infoview.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,12 @@ function Infoview:__update()
443443
pcall(info.move_pin, info, util.make_position_params())
444444
end
445445

446+
---Directly mark that the infoview has died. What a shame.
447+
function Infoview:died()
448+
self.info.pin.__data_element = components.LSP_HAS_DIED -- FIXME: yeah, gross
449+
self.info.pin:__update()
450+
end
451+
446452
---Either open or close a diff window for this infoview depending on whether its info has a diff pin.
447453
function Infoview:__refresh_diff()
448454
if not self.window then
@@ -1259,7 +1265,7 @@ function infoview.enable(opts)
12591265
if not current_infoview then
12601266
return
12611267
end
1262-
current_infoview:__update()
1268+
current_infoview:died()
12631269
end),
12641270
})
12651271

spec/infoview/contents_spec.lua

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,12 +485,7 @@ describe('interactive infoview', function()
485485
return vim.tbl_isempty(vim.lsp.get_clients())
486486
end)
487487
assert.message("Couldn't kill the LSP!").is_true(succeeded)
488-
489-
-- We don't immediately mark the infoview with our dead message.
490-
-- In theory maybe we could by attaching to `LspDetach` and triggering
491-
-- a final update, but for now this seems OK.
492-
helpers.move_cursor { to = { 1, 6 } }
493-
assert.infoview_contents.are '🪦 The Lean language server is dead.'
488+
assert.infoview_contents_nowait.are '🪦 The Lean language server is dead.'
494489
end)
495490
end)
496491
)

0 commit comments

Comments
 (0)