Skip to content

Add version reporting to CLI flags and LSP serverInfo#1161

Merged
datho7561 merged 3 commits intoredhat-developer:mainfrom
shin19991207:chang-patch-1142
Jan 5, 2026
Merged

Add version reporting to CLI flags and LSP serverInfo#1161
datho7561 merged 3 commits intoredhat-developer:mainfrom
shin19991207:chang-patch-1142

Conversation

@shin19991207
Copy link
Member

What does this PR do?

  1. handle --version/-version and --help/-help/-h so clients probing don’t crash
  2. include serverInfo with version in the initialize result so LSP clients can display it properly.

What issues does this PR fix or reference?

Fixes #1142

Is it tested? How?

  1. The following CLI flags should work:

    • yaml-language-server --version
    • yaml-language-server -version
    • yaml-language-server --help
    • yaml-language-server -help
    • yaml-language-server -h
  2. Neovim (nvim-lspconfig) displays version properly:

    • Configure yaml-language-server in Neovim:
      cmd = {"/path/to/bin/yaml-language-server", "--stdio"}
      
    • Open a .yaml file in Neovim and run :LspInfo. Expect version is shown instead of ?:
      Screenshot 2026-01-05 at 5 58 52 AM

Signed-off-by: Morgan Chang <shin19991207@gmail.com>
Signed-off-by: Morgan Chang <shin19991207@gmail.com>
@coveralls
Copy link

coveralls commented Jan 5, 2026

Coverage Status

coverage: 84.09% (+0.005%) from 84.085%
when pulling 644905c on shin19991207:chang-patch-1142
into 53d0a34 on redhat-developer:main.

Signed-off-by: Morgan Chang <shin19991207@gmail.com>
Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

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

Looks good and works well. I checked it worked in neovim.

@datho7561 datho7561 merged commit 8495b84 into redhat-developer:main Jan 5, 2026
4 checks passed
@shin19991207 shin19991207 deleted the chang-patch-1142 branch February 18, 2026 18:45
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.

Add --version option

3 participants