Skip to content

Commit

Permalink
Hackily immediately change the infoview when the LSP dies.
Browse files Browse the repository at this point in the history
Honestly the reason to do this now is the stupid test suite failure on
nightly.

God do I hate nvim flakiness.
  • Loading branch information
Julian committed Dec 28, 2024
1 parent 6052a06 commit 0c8e067
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 7 additions & 1 deletion lua/lean/infoview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,12 @@ function Infoview:__update()
pcall(info.move_pin, info, util.make_position_params())
end

---Directly mark that the infoview has died. What a shame.
function Infoview:died()
self.info.pin.__data_element = components.LSP_HAS_DIED -- FIXME: yeah, gross
self.info.pin:__update()
end

---Either open or close a diff window for this infoview depending on whether its info has a diff pin.
function Infoview:__refresh_diff()
if not self.window then
Expand Down Expand Up @@ -1259,7 +1265,7 @@ function infoview.enable(opts)
if not current_infoview then
return
end
current_infoview:__update()
current_infoview:died()
end),
})

Expand Down
7 changes: 1 addition & 6 deletions spec/infoview/contents_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -485,12 +485,7 @@ describe('interactive infoview', function()
return vim.tbl_isempty(vim.lsp.get_clients())
end)
assert.message("Couldn't kill the LSP!").is_true(succeeded)

-- We don't immediately mark the infoview with our dead message.
-- In theory maybe we could by attaching to `LspDetach` and triggering
-- a final update, but for now this seems OK.
helpers.move_cursor { to = { 1, 6 } }
assert.infoview_contents.are '🪦 The Lean language server is dead.'
assert.infoview_contents_nowait.are '🪦 The Lean language server is dead.'
end)
end)
)
Expand Down

0 comments on commit 0c8e067

Please sign in to comment.