-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Source/Documentation actions sometimes don't appear the first time a hover menu is opened #396
Comments
hey 👋 haskell-tools just parses the response it receives from haskell-language-server, to create the hover actions. |
Looks like this: haskell/haskell-language-server#3062 thanks |
FWIW this is what I'm using now ["<Leader>lo"] = {
function()
local function make_hover_request(callback, retry)
local params = vim.lsp.util.make_position_params()
vim.lsp.buf_request(0, "textDocument/hover", params, function(err, result, _, _)
if err or not result or not result.contents then
if not retry then print "No hover information available" end
return
end
local markdown_lines = vim.lsp.util.convert_input_to_markdown_lines(result.contents)
local uri
for _, line in ipairs(markdown_lines) do
if vim.startswith(line, "[Documentation]") then
uri = string.match(line, "%[Documentation%]%((.+)%)")
if uri then
callback(uri)
return
end
end
end
if not retry then
-- If we didn't find the documentation link, try once more
vim.defer_fn(function() make_hover_request(callback, true) end, 100)
else
print "Could not find documentation link"
end
end)
end
make_hover_request(function(uri)
if uri then
vim.fn.jobstart({ "xdg-open", uri }, { detach = true })
print "Opening documentation in browser"
end
end)
end,
desc = "Open documentation",
cond = function(client) return client.supports_method "textDocument/hover" end,
}, Just in case anyone else wants this |
@expipiplus1 I think you meant to post that in #395 😄 |
Neovim version (nvim -v)
v0.10.1
Operating system/version
NixOS
Output of :checkhealth haskell-tools
How to reproduce the issue
Load a haskell project and wait for hls to initialize
Open the hover menu on an identifier
vim.lsp.buf.hover()
or whatever keybinding existsObserve that the Open documentation in browser and Open source in browser links are not present
Close the menu
Open it again and observe that they're present
Expected behaviour
The first time the hover menu is opened these links are present (if available)
Actual behaviour
Sometimes, to see these links the hover must be closed and reopened
Log files
No response
The minimal config used to reproduce this issue.
The text was updated successfully, but these errors were encountered: