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(lspinfo): replace :LspInfo with :checkhealth #3339

Merged
merged 1 commit into from
Oct 2, 2024
Merged

Conversation

justinmk
Copy link
Member

@justinmk justinmk commented Oct 2, 2024

Problem:

:LspInfo has its own "inner platlform" of highlights, mappings etc. And it doesn't integrate with :checkhealth.

Solution:

  • Move the lspinfo code to a healthcheck.
  • LspInfo features such as highlights, "floating window" presentation, etc., should be added to :checkhealth in Nvim core, if they are really needed.
  • Add a "q" mapping until Nvim stable that in :checkhealth.

Testing

Tested on Nvim HEAD and Nvim 0.10.

Todo (future)

  • The "docs" section doesn't have syntax highlighting currently. That may involve a fix for the >markdown directive, or maybe just the formatting needs to be adjusted to satisfy vimdoc.
    • Different idea: provide .../lspconfig/doc/configs.lua#<linenum> URLs which the user can visit with gF.

image

@glepnir
Copy link
Member

glepnir commented Oct 2, 2024

It is definitely the direction to move forward. But the timing is not quite right. Because core checkhealth needs some improve. avoid some noisy issues, it's better after core checkhealth improved.

@justinmk
Copy link
Member Author

justinmk commented Oct 2, 2024

Because core checkhealth needs some improve. avoid some noisy issues, it's better after core checkhealth improved.

which issues exactly should block this?

@glepnir
Copy link
Member

glepnir commented Oct 2, 2024

the configured servers list and depreceted servers list is missing in checkhealth. may need an integration.

@justinmk
Copy link
Member Author

justinmk commented Oct 2, 2024

the configured servers list and depreceted servers list is missing in checkhealth. may need an integration

? The code in this PR is the same as the old LspInfo implementation. So configured & deprecated should display, or there's a bug.

@@ -277,29 +254,7 @@ return function()
vim.list_extend(buf_lines, { '', 'Deprecated servers: ' .. table.concat(deprecated_servers, ' ') })
Copy link
Member Author

Choose a reason for hiding this comment

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

deprecated servers

Copy link
Member

Choose a reason for hiding this comment

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

Oh yes. i didn't look at code carefully.

@justinmk justinmk force-pushed the lspinfo branch 2 times, most recently from 6201897 to bc5ad09 Compare October 2, 2024 12:25
Problem:
:LspInfo has its own "inner platlform" of highlights, mappings etc. And
it doesn't integrate with :checkhealth.

Solution:
- Move the lspinfo code to a healthcheck.
- LspInfo features such as highlights, "floating window" presentation,
  etc., should be added to :checkhealth in Nvim core, if they are really
  needed.
- Define a "q" mapping until Nvim stable has that in :checkhealth.
root_dir_not_found = 'Not found.',
async_root_dir_function = 'Asynchronous root_dir functions are not supported in :LspInfo',
async_root_dir_function = 'Asynchronous root_dir functions are not supported by `:checkhealth lspconfig`',
Copy link
Member Author

Choose a reason for hiding this comment

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

I need help with confirming that these messages still work correctly and are displayed nicely. Probably they should be converted to health.error() calls.

@justinmk justinmk merged commit e6569c1 into master Oct 2, 2024
9 checks passed
@justinmk justinmk deleted the lspinfo branch October 2, 2024 13:57
@daviareias
Copy link

any tips to restore the highlights? It's really hard to read the buffer returned by LspInfo now

@justinmk
Copy link
Member Author

justinmk commented Oct 7, 2024

what highlights specifically

@daviareias
Copy link

daviareias commented Oct 8, 2024

what highlights specifically

Sorry I didn't explain my situation correctly.

before when I used to type LspInfo, it would show a nice floating window,
after the last update it shows a buffer like this:
Screenshot 2024-10-08 at 4 49 53 PM

I find it a little hard to read, and couldn't find how to customize it to put it inside a floating window like this:
Screenshot 2024-10-08 at 4 51 18 PM

@glepnir
Copy link
Member

glepnir commented Oct 8, 2024

This is how it works now. CheckHealth is displayed in the normal window.

@justinmk
Copy link
Member Author

justinmk commented Oct 8, 2024

You still didn't mention which highlights.

The door is open for adding features to :checkhealth, that needs to be done in Nvim core.

phucnguyen035 added a commit to phucnguyen035/dotfiles that referenced this pull request Oct 22, 2024
@nvim-enjoyer
Copy link

removing the floating window option and moving to a checkhealth looks way worse.

i get the idea of moving to :che but could that not have been done AFTER floating window support in nvim core???

@glepnir
Copy link
Member

glepnir commented Nov 5, 2024

Please be patient. I will try to add a floating window for checkhealth in core and hope it will be in time for 0.11.

Update: early draft it works.

QQ_1730802329055

@neovim neovim deleted a comment from 909oce Nov 24, 2024
@GrzegorzKozub
Copy link

GrzegorzKozub commented Nov 25, 2024

I was using require('lspconfig.ui.windows') to set the border of the LSP information float that is displayed when I hit the K button like so:

require('lspconfig.ui.windows').default_options.border = 'rounded'

I prefer using the NormalFloat highlight the same as my Normal (editor background) highlight and just have a rounded border.

Anyone knows if there's another way to change this border? The default seems none.

I also noticed that some configs in this repo still use this API, for example:

border = require('lspconfig.ui.windows').default_options.border or 'single',

@justinmk
Copy link
Member Author

I also noticed that some configs in this repo still use this API, for example:

Thanks for mentioning that. Fixed in #3454

I was using require('lspconfig.ui.windows') to set the border of the LSP information float that is displayed when I hit the K button like so:

K is unrelated to this repo. This repo is just a collection of configs. K is a default mapping provided by Nvim core, which calls vim.lsp.buf.hover(). See also neovim/neovim#31074

@neovim neovim locked as resolved and limited conversation to collaborators Nov 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants