bash-lsp/bash-language-server

Syntax error: Unexpected token when running with Kate on KDE Neon with Plasma 6

Closed this issue · 8 comments

Code editor

Kate

Platform

KDE Neon 6.0

Version

5.4.2

What steps will reproduce the bug?

Open any shell script in Kate and it immediately happens.

How often does it reproduce? Is there a required condition?

Always, when opening any .sh file.

What is the expected behavior?

Never seen it work properly, so probably should run without errors.

What do you see instead?


/usr/local/lib/node_modules/bash-language-server/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40
        return this._head?.value;
                          ^
SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:85:18)
    at Object. (/usr/local/lib/node_modules/bash-language-server/node_modules/vscode-jsonrpc/lib/common/api.js:37:21)
    at Module._compile (internal/modules/cjs/loader.js:999:30)


    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

followed by
[10:28:55  LSP Client Warning] Server terminated unexpectedly ... NOT Restarting [/usr/local/bin/bash-language-server start] [homepage: https://github.com/bash-lsp/bash-language-server]

Additional information

Output of bash-language-server -v shows a deprecation warning, if that's relevant:


bash-language-server --help
Usage:
  bash-language-server start             Start listening on stdin/stdout
  bash-language-server -h, --help        Display this help and exit
  bash-language-server -v, --version     Print the version and exit

Environment variables:
  BASH_IDE_LOG_LEVEL                     Set the log level (default: info)

Further documentation: https://github.com/bash-lsp/bash-language-server
(node:7284) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

Does Kate use your global installation of Node.js to run the language server? If yes, what's the version you're running? Is it an old one like <=13? It seems like it's throwing an error because a dependency used optional chaining (?.) and your version of Node.js doesn't recognize it.

The only node.js installed here is version 22.9.0 as recorded by nvm -current and node -v, both in my user account and with sudo for the system (i.e. there are not multiple installations).
Kate simply calls the binary for LSP servers (I'm facing similar errors for the typescript server LSP as well)

That's weird then, I can't really see any other reason it would error in that way. Have you had any success integrating another language server written in js/ts? Since the TypeScript Language Server also gave you a syntax error that you shouldn't be having, it might be a Kate thing or with how you've configured it.

If this is the config you meant, can you try another language server written in js/ts like the HTML or CSS one? If there is no error then it might mean that both the Bash and TypeScript language servers are doing something wrong, but if there still is and it's similar to the one you've gotten so far then it's probably a Kate or a config problem.

I saw in typescript-language-server/typescript-language-server#921 that your issue with having an old Node.js install and Kate using that has been resolved. I'm assuming that the issue with running bash-language-server has also been resolved?

Yes indeed! :)