bash-lsp / bash-language-server

A language server for Bash
MIT License
2.12k stars 121 forks source link

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

Closed luciph0r closed 1 week ago

luciph0r commented 2 weeks ago

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)
mcecode commented 2 weeks ago

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.

luciph0r commented 2 weeks ago

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)

mcecode commented 1 week ago

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.

luciph0r commented 1 week ago

I've been able to integrate the perl lsp, that one loads fine. Kate has a default JSON configuration with Github URLs for supported lsps, it's where I found all of them including yours.

From: Matthew Espino @.> To: bash-lsp/bash-language-server @.> CC: luciph0r @.>; Author @.> Date: 4 Oct 2024 04:03:32 Subject: Re: [bash-lsp/bash-language-server] Syntax error: Unexpected token when running with Kate on KDE Neon with Plasma 6 (Issue #1207)

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.

— Reply to this email directly, view it on GitHub[https://github.com/bash-lsp/bash-language-server/issues/1207#issuecomment-2392012887], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AKSRSMLK7QWRKZGXNLJMUV3ZZWBHBAVCNFSM6AAAAABPGU7IKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJSGAYTEOBYG4]. You are receiving this because you authored the thread. [Tracking image][https://github.com/notifications/beacon/AKSRSMLI2GAIUXXFNPRFNWTZZWBHBA5CNFSM6AAAAABPGU7IKWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUOSM4FO.gif]

mcecode commented 1 week ago

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.

luciph0r commented 1 week ago

Can you recommend any? I've seen one written for visual studio and another for Eclipse, not sure if they will work.

From: Matthew Espino @.> To: bash-lsp/bash-language-server @.> CC: luciph0r @.>; Author @.> Date: 6 Oct 2024 00:25:34 Subject: Re: [bash-lsp/bash-language-server] Syntax error: Unexpected token when running with Kate on KDE Neon with Plasma 6 (Issue #1207)

If this[https://invent.kde.org/utilities/kate/-/blob/master/addons/lspclient/settings.json] 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.

— Reply to this email directly, view it on GitHub[https://github.com/bash-lsp/bash-language-server/issues/1207#issuecomment-2395075667], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AKSRSMNEZGWJ7EGW35CKNKLZZ7ZFXAVCNFSM6AAAAABPGU7IKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJVGA3TKNRWG4]. You are receiving this because you authored the thread. [Tracking image][https://github.com/notifications/beacon/AKSRSML5CJPRGTKW77XQHBDZZ7ZFXA5CNFSM6AAAAABPGU7IKWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUOYH2FG.gif]

mcecode commented 1 week ago

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?

luciph0r commented 1 week ago

Yes indeed! :)