ltex-plus / ltex-ls-plus

LTeX Language Server: LSP language server for LanguageTool :mag::heavy_check_mark: with support for LaTeX :mortar_board:, Markdown :pencil:, and others
https://ltex-plus.github.io/ltex-plus/
Mozilla Public License 2.0
13 stars 3 forks source link

ltex-cli-plus tries to start the wrong ltex-ls file #40

Closed rpls closed 1 month ago

rpls commented 1 month ago

Describe the bug I'm not sure how the CLI exactly works, but as it is, it doesn't work. From what I gather, it tries to start the LS, sends the files to be checked, outputs the result, and then stops the server? In any case, the .lsp-cli.json file contains the wrong executable name for the LS server. It's still set to ./ltex-ls, instead of ./ltex-ls-plus.

Steps to reproduce Steps to reproduce the behavior:

  1. Use the ./ltex-cli-plus script to check some files.
  2. It will crash with a "file not found" error.

Expected behavior It should not cash.

Sample document N/A

LTeX configuration N/A

LTeX LS log Paste the log (output) of LTeX LS here:

Not LS log, but CLI log.

java.io.IOException: Cannot run program "DIR/ltex-ls-plus-18.2.0/bin/./ltex-ls" (in directory "DIR/ltex-ls-plus-18.2.0/bin"): error=2, No such file or directory
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1170)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089)
    at org.bsplines.lspcli.client.LspCliLanguageClient$Companion.startLanguageServerProcess(LspCliLanguageClient.kt:108)
    at org.bsplines.lspcli.client.LspCliLanguageClient$Companion.access$startLanguageServerProcess(LspCliLanguageClient.kt:86)
    at org.bsplines.lspcli.client.LspCliLanguageClient.<init>(LspCliLanguageClient.kt:40)
    at org.bsplines.lspcli.LspCliLauncher.call(LspCliLauncher.kt:166)
    at org.bsplines.lspcli.LspCliLauncher$Companion.main(LspCliLauncher.kt:212)
    at org.bsplines.lspcli.LspCliLauncher.main(LspCliLauncher.kt)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
    at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:295)
    at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:225)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1126)
    ... 7 more

Version information List here the version information of the relevant software.

Additional context/information The fix is trivial, just change the following in the generated file:

--- a/ltex-ls-plus-18.2.0/bin/.lsp-cli.json.bak 2024-10-21 14:29:10
+++ b/ltex-ls-plus-18.2.0/bin/.lsp-cli.json 2024-10-21 14:29:20
@@ -9,6 +9,6 @@
   },
   "defaultValues": {
     "--hide-commands": true,
-    "--server-command-line": "./ltex-ls"
+    "--server-command-line": "./ltex-ls-plus"
   }
 }

From what I gather, the file is generated by the tools/addLtexCli.py script?

spitzerd commented 1 month ago

Thank you for the hint. It's fixed now.

From what I gather, it tries to start the LS, sends the files to be checked, outputs the result, and then stops the server?

Yes

From what I gather, the file is generated by the tools/addLtexCli.py script?

Also yes