Skip to content

LspInfo: "Failed to get version" with bash-language-server #3453

@yb66

Description

@yb66

Description

Hi there,

My bashls wasn't running, so I ran :LspInfo inside of Neovim with a shell file open, and got this back as part of the info:

version:           `?` (Failed to get version) Tried:
  `…/mason/bin/bash-language-server --version`
  `…/mason/bin/bash-language-server -version`
  `…/mason/bin/bash-language-server version`
  `…/mason/bin/bash-language-server --help`

I found it's because the recipient is reading STDERR output too, and if there's anything coming through on STDERR then it chokes:

$ ./mason/bin/bash-language-server --version
5.4.2
(node:51440) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

This line is where the server is started:

I replaced:

cmd = { 'bash-language-server', 'start' },

with:

cmd = { 'sh', '-c', 'bash-language-server start 2>/dev/null' },

and it's fixed.

I'd put in a pull request but this is just a workaround and it'd probably be better if STDERR wasn't read (or was handled), but I've no idea about this codebase and any further effects this may have, so this is an FYI.

Regards,
iain

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions