Skip to content
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

feat(null-ls): include hover capabilities #3603

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cristobalgvera
Copy link

@cristobalgvera cristobalgvera commented Dec 13, 2022

Description

This change adds hover capabilitites to LunarVim based on recent added hover in null-ls.

It follows already added null-ls capabilities in order to give a well known interface to current users.

This change has no external dependencies.

The documentation was added on PR312 of the LunarVim's docs.

How Has This Been Tested?

I include it on my own configuration since a while. I decide to include in the LunarVim's one to contribute.

local null_ls = require "null-ls"
local services = require "lvim.lsp.null-ls.services"
local method = null_ls.methods.HOVER

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function M.list_registered(filetype)
local registered_providers = services.list_registered_providers_names(filetype)
return registered_providers[method] or {}
end

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you also need to add a section for it in the info panel, same as the other null-ls sources, see

local auto_lsp_info = make_auto_lsp_info(ft)
local formatters_info = make_formatters_info(ft)
local linters_info = make_linters_info(ft)
local code_actions_info = make_code_actions_info(ft)
local content_provider = function(popup)
local content = {}
for _, section in ipairs {
M.banner,
{ "" },
{ "" },
header,
{ "" },
lsp_info,
{ "" },
auto_lsp_info,
{ "" },
formatters_info,
{ "" },
linters_info,
{ "" },
code_actions_info,
} do
vim.list_extend(content, section)
end
return text.align_left(popup, content, 0.5)
end

local services = require "lvim.lsp.null-ls.services"
local method = null_ls.methods.HOVER

function M.setup(formatter_configs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function M.setup(formatter_configs)
function M.setup(hover_configs)

local registered = services.register_sources(formatter_configs, method)

if #registered > 0 then
Log:debug("Registered the following hovers: " .. unpack(registered))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Log:debug("Registered the following hovers: " .. unpack(registered))
Log:debug("Registered the following hover sources: " .. unpack(registered))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants