vim-lsp icon indicating copy to clipboard operation
vim-lsp copied to clipboard

Print workspace_config with :verbose LspStatus

Open idbrii opened this issue 2 years ago • 6 comments

When trying to debug server configuration (recently for me: mattn/vim-lsp-settings/issues/542), it's useful to see the workspace_config for the server. I think this is more useful than anything else in server_info which are more session-specific (files).

This PR allows you to use :verbose LspStatus to add the workspace_config to the output. I uses tpope/vim-scriptease's pretty printing if available (new lines and indents) and otherwise falls back to json encoding (one big line).

I can squash the changes if you'd like. Or change it from verbose to bang.

idbrii avatar Feb 24 '22 00:02 idbrii

Can you past a screenshot of how the output looks like?

I have been thinking about use :CheckHealth as an addition to verbose :LspStatus as CheckHealth is bundled with neovim and there is a polyfil https://github.com/rhysd/vim-healthcheck.

http://vimcasts.org/episodes/neovim-checkhealth/

prabirshrestha avatar Feb 24 '22 01:02 prabirshrestha

Meanwhile I have filed a feature request to vim to bundle :CheckHealth by default. https://github.com/vim/vim/issues/9838

prabirshrestha avatar Feb 24 '22 01:02 prabirshrestha

Lua was the specific server I was trying to configure, but here's two other servers I use (where I use the default config):

with scriptease with scriptease and without with jsonencode

For CheckHealth, you mean implement health#lsp#check()? From the docs, it looks like we'd use health#report_info() since we don't actually do any error detection here. But if we had other validation (server doesn't exist for current filetype), we could print some warnings or errors.

idbrii avatar Feb 27 '22 22:02 idbrii

Yes we should implement health#lsp#check(). Problem with adding verbose log with message is that there could be lot of servers running and users will have to scroll.

Another option is to continue with :LspStatus <servername> that prints to buffer with information but then this would similar to the healthcheck. The reason I was preferring :checkhealth is so that we can print information about features enabled/disable which will make it easy for anyone to discover other potential issues.

prabirshrestha avatar Feb 27 '22 23:02 prabirshrestha

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 28 '22 23:04 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 12 '22 03:08 stale[bot]

I implemented checkhealth support:

image

I also included advice when status is "failed": image

Do you want me to remove the verbose log with message? checkhealth strips out leading indentation so the workspace output doesn't look as nice, but I agree that it's better for it to get dumped to a buffer.

idbrii avatar Sep 28 '22 15:09 idbrii

This looks great. Seems like there are some lint issues that needs to be fixed. Also would be good to document :Healthcheck. Can also update debugging section.

I would also add this for vim folks.

if !has('nvim') | Plug 'rhysd/vim-healthcheck' | endif

prabirshrestha avatar Oct 11 '22 06:10 prabirshrestha

Added documentation and included a Plug reference in the readme, but not in code since vim-plug is not mandatory. Looks like all lint checks pass now.

idbrii avatar Oct 29 '22 05:10 idbrii

Merged. Thanks

prabirshrestha avatar Oct 29 '22 17:10 prabirshrestha