Add `--version` command to basedpyright-langserver binary
This is not important or affecting anything at all really, but, if you use this in neovim and run the :checkhealth command it shows this:
LSP configs active in this buffer (bufnr: 505) ~
- Language client log: ~/.local/state/nvim/lsp.log
- Detected filetype: `python`
- 2 client(s) attached to this buffer
- Client: `basedpyright` (id: 1, bufnr: [483, 45, 198, 39, 505, 458, 50, 48, 46, 42, 40, 165])
root directory: ~/code/airflow/airflow/providers/celery/
filetypes: python
cmd: ~/.local/share/nvim/mason/bin/basedpyright-langserver --stdio
version: `?` (Failed to get version) Tried:
`/Users/ash/.local/share/nvim/mason/bin/basedpyright-langserver --version`
`/Users/ash/.local/share/nvim/mason/bin/basedpyright-langserver -version`
`/Users/ash/.local/share/nvim/mason/bin/basedpyright-langserver version`
`/Users/ash/.local/share/nvim/mason/bin/basedpyright-langserver --help`
executable: true
autostart: true
Running the command manually I see this error:
/Users/ash/.local/share/nvim/mason/packages/basedpyright/venv/lib/python3.12/site-packages/basedpyright/dist/pyright-langserver.js:34880
throw new Error("Connection input stream is not set. " + commandLineMessage);
^
Error: Connection input stream is not set. Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'
at _createConnection (/Users/ash/.local/share/nvim/mason/packages/basedpyright/venv/lib/python3.12/site-packages/basedpyright/dist/pyright-langserver.js:34880:11)
at createConnection (/Users/ash/.local/share/nvim/mason/packages/basedpyright/venv/lib/python3.12/site-packages/basedpyright/dist/pyright-langserver.js:34831:10)
at run (/Users/ash/.local/share/nvim/mason/packages/basedpyright/venv/lib/python3.12/site-packages/basedpyright/dist/pyright-langserver.js:124324:47)
at async main (/Users/ash/.local/share/nvim/mason/packages/basedpyright/venv/lib/python3.12/site-packages/basedpyright/dist/pyright-langserver.js:124288:5)
Node.js v22.13.1
Having --help or --version work would be nice, but everything is working perfectly fine without this, it's just a nice to have
does neovim just try various different arguments to the language server command assuming one of them will work? as far as i know the language server spec doesn't mandate that servers support --help or --version cli arguments. i think returning serverInfo in InitializeResult would probably be a better option than the client guessing different commands (#1022)
Yeah it's just nvim trying it and hoping.
That said, having a --help option that prints something is no bad thing, no?
i think returning
serverInfoinInitializeResultwould probably be a better option than the client guessing different commands (#1022)
that's true! Neovim already reads InitializeResult.serverInfo https://github.com/neovim/neovim/pull/31611, I believe the CLI approach is just a fallback in case the server doesn't provide serverInfo
since #1077 has been merged i think this issue can be closed
That said, having a
--helpoption that prints something is no bad thing, no?
I agree with this. It would be nice to have a very minimal help menu. Perhaps we could open a separate issue for it?
i'll leave this issue open then but curious as to what the use case is if it's already covered by the lsp spec. i think it's only worth doing if there's a client that doesn't read serverInfo for some reason
i'll leave this issue open then but curious as to what the use case is if it's already covered by the lsp spec. i think it's only worth doing if there's a client that doesn't read
serverInfofor some reason
The use is if you try to invoke it directly in a shell by mistake etc.
currently it crashes with a stack trace if you do that, which i guess should be fixed
+1, trying to add this as a kakoune LSP integration, but a) it took a bit to realize basedpyright != basedpyright-langserver and b) I don't have a great way of figuring out how to pipe input into the LSP.