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): print "{cmd} --version", drop config.lspinfo #3375

Merged
merged 2 commits into from
Oct 18, 2024
Merged

Conversation

justinmk
Copy link
Member

@justinmk justinmk commented Oct 16, 2024

Problem:

config.lspinfo is an undocumented feature that allows extending the info shown in :LspInfo (:checkhealth lspconfig). This feature is unwanted because:

  • it's undocumented
  • it adds a maintenance burden
  • it provides info that should be derived from the LSP client or server, in a generalized way.

Solution:

Problem:
`config.lspinfo` is an undocumented feature that allows extending the
info shown in `:LspInfo` (`:checkhealth lspconfig`).
This feature is unwanted because:
- it's undocumented
- it adds a maintenance burden
- it provides info that should be derived from the LSP protocol itself.

Solution:
Remove support for `config.lspinfo`.
Instead, `:LspInfo` (`:checkhealth lspconfig`) should be enhanced to
automatically gather this kind of extra info from the server response.
Copy link
Contributor

Note that configs.md or configs.txt will be regenerated by the docgen CI process. Edit the Lua source file instead. For details on generating documentation, see: https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#generating-docs

local info_lines = {
'filetypes: ' .. config_info.filetypes,
'root directory: ' .. fmtpath(config_info.root_dir),
'cmd: ' .. fmtpath(config_info.cmd),
('%-18s `%s`'):format('version:', try_get_version(cmd_version)),
Copy link
Member Author

Choose a reason for hiding this comment

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

Print the cmd --version result automatically.

@neovim neovim deleted a comment from github-actions bot Oct 18, 2024
@justinmk justinmk changed the title fix(lspinfo)!: remove config.lspinfo feat(lspinfo): print "{cmd} --version", drop config.lspinfo Oct 18, 2024
@justinmk justinmk merged commit 54d1091 into master Oct 18, 2024
11 checks passed
@justinmk justinmk deleted the rmlspinfo branch October 18, 2024 12:24
--- @param cmd string[]
local function try_get_version(cmd)
local out = vim.fn.system(cmd)
if not out then
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if not out then
if not out or vim.v.shell_error > 0 then

do we also need this condition 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

if it returns any output we'll just print it, regardless of error code

Copy link
Member

@dundargoc dundargoc left a comment

Choose a reason for hiding this comment

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

I had no idea this existed. Nice.

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.

3 participants