Open michens opened 3 months ago
Same issue here. Thanks for the pointer, never coded JS before but I was able to fix my local installation with the following changes to extension.js
:
--- a/extension.js.old
+++ b/extension.js
@@ -13516,6 +13516,7 @@ class DependencyManager {
const executableOptions = {
encoding: 'utf-8',
timeout: 15000,
+ shell: true
};
if (executable.options != null) {
executableOptions.cwd = executable.options.cwd;
@@ -13615,6 +13616,7 @@ class DependencyManager {
const executableOptions = {
encoding: 'utf-8',
timeout: 15000,
+ shell: true
};
const childProcess = ((process.platform == 'win32')
? ChildProcess.spawnSync('wmic', ['process', 'list', 'FULL'], executableOptions)
@@ -24684,7 +24686,9 @@ class LanguageClient extends commonClient_1.CommonLanguageClient {
if (node.args) {
node.args.forEach(element => args.push(element));
}
- const execOptions = Object.create(null);
+ const execOptions = {
+ shell: true
+ };
execOptions.cwd = serverWorkingDir;
execOptions.env = getEnvironment(options.env, false);
const runtime = this._getRuntimePath(node.runtime, serverWorkingDir);
@@ -24817,6 +24821,7 @@ class LanguageClient extends commonClient_1.CommonLanguageClient {
let args = command.args || [];
let options = Object.assign({}, command.options);
options.cwd = options.cwd || serverWorkingDir;
+ options.shell = true;
let serverProcess = cp.spawn(command.command, args, options);
if (!serverProcess || !serverProcess.pid) {
return Promise.reject(`Launching server using command ${command.command} failed.`);
I'm hoping this will work until the package is properly patched.
Same issue here. Thanks for the pointer, never coded JS before but I was able to fix my local installation with the following changes to
extension.js
:>>> diff extension.js.old extension.js 13518a13519 > shell: true 13617a13619 > shell: true 24687c24689,24691 < const execOptions = Object.create(null); --- > const execOptions = { > shell: true > }; 24819a24824 > options.shell = true;
I'm hoping this will work until the package is properly patched.
Thanks a lot! extension.js can be found in %USERPROFILE%.vscode\extensions\valentjn.vscode-ltex-13.1.0\dist
Maybe same issue with Version: 1.92.0 (system setup) Commit: b1c0a14de1414fcdaa400695b4db1c0799bc3124 Date: 2024-07-31T23:26:45.634Z Electron: 30.1.2 ElectronBuildId: 9870757 Chromium: 124.0.6367.243 Node.js: 20.14.0 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.22000
Log:
2024-08-02T09:14:10.699Z Info: Setting LTeX UI language to 'en'.
2024-08-02T09:14:10.699Z Info: Loading i18n messages...
2024-08-02T09:14:10.708Z Info: Loading default i18n messages...
2024-08-02T09:14:10.711Z Info:
2024-08-02T09:14:10.712Z Info: ltex.ltex-ls.path not set.
2024-08-02T09:14:10.712Z Info: Searching for ltex-ls in 'c:\Users\Administrator\.vscode\extensions\valentjn.vscode-ltex-13.1.1-alpha.1.nightly.2024-08-02\lib'...
2024-08-02T09:14:10.712Z Info: ltex-ls found in 'c:\Users\Administrator\.vscode\extensions\valentjn.vscode-ltex-13.1.1-alpha.1.nightly.2024-08-02\lib\ltex-ls-16.0.1-alpha.1.nightly.2024-08-02'.
2024-08-02T09:14:10.712Z Info:
2024-08-02T09:14:10.712Z Info: Using ltex-ls from 'c:\Users\Administrator\.vscode\extensions\valentjn.vscode-ltex-13.1.1-alpha.1.nightly.2024-08-02\lib\ltex-ls-16.0.1-alpha.1.nightly.2024-08-02'.
2024-08-02T09:14:10.713Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set.
2024-08-02T09:14:10.714Z Info: Testing ltex-ls...
2024-08-02T09:14:10.714Z Info: Command: "c:\\Users\\Administrator\\.vscode\\extensions\\valentjn.vscode-ltex-13.1.1-alpha.1.nightly.2024-08-02\\lib\\ltex-ls-16.0.1-alpha.1.nightly.2024-08-02\\bin\\ltex-ls.bat"
2024-08-02T09:14:10.714Z Info: Arguments: ["--version"]
2024-08-02T09:14:10.714Z Info: env['JAVA_HOME']: undefined
2024-08-02T09:14:10.714Z Info: env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2024-08-02T09:14:10.714Z Error: Test failed.
2024-08-02T09:14:10.714Z Error: Error details:
2024-08-02T09:14:10.716Z Error: Error: spawnSync c:\Users\Administrator\.vscode\extensions\valentjn.vscode-ltex-13.1.1-alpha.1.nightly.2024-08-02\lib\ltex-ls-16.0.1-alpha.1.nightly.2024-08-02\bin\ltex-ls.bat EINVAL
2024-08-02T09:14:10.716Z Error: at Object.spawnSync (node:internal/child_process:1124:20)
2024-08-02T09:14:10.716Z Error: at Object.spawnSync (node:child_process:914:24)
2024-08-02T09:14:10.716Z Error: at DependencyManager.<anonymous> (c:\Users\Administrator\.vscode\extensions\valentjn.vscode-ltex-13.1.1-alpha.1.nightly.2024-08-02\dist\extension.js:14962:45)
2024-08-02T09:14:10.716Z Error: at Generator.next (<anonymous>)
2024-08-02T09:14:10.716Z Error: at fulfilled (c:\Users\Administrator\.vscode\extensions\valentjn.vscode-ltex-13.1.1-alpha.1.nightly.2024-08-02\dist\extension.js:14593:58)
2024-08-02T09:14:10.716Z Info: ltex-ls did not print expected version information to stdout.
2024-08-02T09:14:10.716Z Info: stdout of ltex-ls:
2024-08-02T09:14:10.716Z Info:
2024-08-02T09:14:10.716Z Info: stderr of ltex-ls:
2024-08-02T09:14:10.716Z Info:
2024-08-02T09:14:10.716Z Info: You might want to try offline installation, see https://valentjn.github.io/vscode-ltex/docs/installation-and-usage.html#offline-installation.
Same issue here. Installing an earlier version of VSCode (1.91) solves the issue.
I tried to run the ltex-ls.bat
directly:
Exception in thread "main" java.nio.charset.UnsupportedCharsetException: cp65001
at java.base/java.nio.charset.Charset.forName(Unknown Source)
at picocli.CommandLine.getStderrEncoding(CommandLine.java:14531)
at picocli.CommandLine.getErr(CommandLine.java:1236)
at picocli.CommandLine.handleUnhandled(CommandLine.java:2097)
at picocli.CommandLine.execute(CommandLine.java:2093)
at org.bsplines.ltexls.LtexLanguageServerLauncher$Companion.main(LtexLanguageServerLauncher.kt:223)
at org.bsplines.ltexls.LtexLanguageServerLauncher.main(LtexLanguageServerLauncher.kt)
Seems that the UTF-8 charset is not supported.
I got a different error
SEVERE: Missing header Content-Length in input "
"
java.lang.IllegalStateException: Missing header Content-Length in input "
"
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:91)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Same Issue
any update so far?
Thanks.
same issue
Same issue here. Thanks for the pointer, never coded JS before but I was able to fix my local installation with the following changes to
extension.js
:>>> diff extension.js.old extension.js 13518a13519 > shell: true 13617a13619 > shell: true 24687c24689,24691 < const execOptions = Object.create(null); --- > const execOptions = { > shell: true > }; 24819a24824 > options.shell = true;
I'm hoping this will work until the package is properly patched.
Same issue. Updating the extensions.js file makes the error disappear. However, ltex still doesn't seem to run properly, as no errors in LaTeX documents (with deliberate typos) are detected.
same issue
Same issue. Updating the extensions.js file makes the error disappear. However, ltex still doesn't seem to run properly, as no errors in LaTeX documents (with deliberate typos) are detected.
Interesting, for me it fixes the issue and errors and warnings are properly shown. Yours might be a separate issue then.
Same issue here, but the errors come from a different place:
2024-08-06T21:48:58.294Z Error: Error: spawnSync c:\users...\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0\bin\ltex-ls.bat EINVAL
2024-08-06T21:48:58.294Z Error: at Object.spawnSync (node:internal/child_process:1124:20)
2024-08-06T21:48:58.294Z Error: at Object.spawnSync (node:child_process:914:24)
2024-08-06T21:48:58.294Z Error: at DependencyManager.<anonymous> (c:\users...\.vscode\extensions\valentjn.vscode-ltex-13.1.0\dist\extension.js:13528:45)
2024-08-06T21:48:58.294Z Error: at Generator.next (<anonymous>)
2024-08-06T21:48:58.294Z Error: at fulfilled (c:\users...\.vscode\extensions\valentjn.vscode-ltex-13.1.0\dist\extension.js:13159:58)
2024-08-06T21:48:58.294Z Info: ltex-ls did not print expected version information to stdout.
2024-08-06T21:48:58.294Z Info: stdout of ltex-ls:
The fix from @tobiscode didn't help, but still thank you!
If I try to run the ltex-ls.bat
in cmd as Admin, I receive the same error as @peiranxiao
EDIT: After applying the fix from @tobiscode and restarting VS Code twice, it worked.
Ran into the same issue, suggestion used by @tobiscode worked.
@michens , there is an ltex-neo project that may be accepting fixes, but is currently experiencing the same issue.
Currently I'm looking for an alternative that can spellcheck markdown.
I have the same issue. I tried c:\...\bin\ltex-ls.bat --version
in console and it gave me the correct output.
{ "ltex-ls": "15.2.0", "java": "11.0.12" }
I thought it was a problem of Java because of the output of VSCode 2024-07-29T17:17:28.196Z Info: env['JAVA_HOME']: undefined
. I tried to set the system variables but it didn't solve the problem. I also tried to install the extension with the vsix.-file. But it didn't help. Took me half a day to find this issue :/
I encountered this too. Good work by michens and thanks to tobiscode for the diff to fix. It'd be nice if this got fixed via PR or owners though to avoid others having to fix locally.
Here's some overly detailed steps, in case it helps anyone:
%USERPROFILE%.vscode\extensions\valentjn.vscode-ltex-13.1.0\dist\extension.js
c:\Users\jake_\.vscode\extensions\valentjn.vscode-ltex-13.1.0\dist\extension.js
Change line 13516:
const executableOptions = {
encoding: 'utf-8',
timeout: 15000,
};
to
const executableOptions = {
encoding: 'utf-8',
timeout: 15000,
shell: true,
};
Change line 13616:
const executableOptions = {
encoding: 'utf-8',
timeout: 15000,
};
to
const executableOptions = {
encoding: 'utf-8',
timeout: 15000,
shell: true,
};
Change line 24689:
const execOptions = Object.create(null);
to
const execOptions = {
shell: true
}
Change line 24823:
options.cwd = options.cwd || serverWorkingDir;
to
options.cwd = options.cwd || serverWorkingDir;
options.shell = true;
Thank you @JakeSteam that worked! Once again, it loads up with no issues and works as intended. Life Saver!
same issue
I've applied the above fix locally to the extension.js
file but I am now encountering issues with whitespace instead in %USERPROFILE%
upon restarting Visual Studio Code and the extension as follows:
2024-08-13T16:02:35.490Z Info: Setting LTeX UI language to 'en'.
2024-08-13T16:02:35.490Z Info: Loading i18n messages...
2024-08-13T16:02:35.492Z Info: Loading default i18n messages...
2024-08-13T16:02:35.497Z Info:
2024-08-13T16:02:35.497Z Info: ltex.ltex-ls.path not set.
2024-08-13T16:02:35.497Z Info: Searching for ltex-ls in 'c:\Users\Long Name Here\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib'...
2024-08-13T16:02:35.498Z Info: ltex-ls found in 'c:\Users\Long Name Here\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0'.
2024-08-13T16:02:35.498Z Info:
2024-08-13T16:02:35.498Z Info: Using ltex-ls from 'c:\Users\Long Name Here\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0'.
2024-08-13T16:02:35.498Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set.
2024-08-13T16:02:35.499Z Info: Testing ltex-ls...
2024-08-13T16:02:35.499Z Info: Command: "c:\\Users\\Long Name Here\\.vscode\\extensions\\valentjn.vscode-ltex-13.1.0\\lib\\ltex-ls-15.2.0\\bin\\ltex-ls.bat"
2024-08-13T16:02:35.499Z Info: Arguments: ["--version"]
2024-08-13T16:02:35.499Z Info: env['JAVA_HOME']: undefined
2024-08-13T16:02:35.499Z Info: env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2024-08-13T16:02:35.550Z Error: Test failed.
2024-08-13T16:02:35.550Z Error: Error details:
2024-08-13T16:02:35.550Z Info: ltex-ls terminated with non-zero exit code 1.
2024-08-13T16:02:35.550Z Info: stdout of ltex-ls:
2024-08-13T16:02:35.550Z Info:
2024-08-13T16:02:35.550Z Info: stderr of ltex-ls:
2024-08-13T16:02:35.550Z Info: 'c:\Users\Long' is not recognized as an internal or external command,
2024-08-13T16:02:35.550Z Info: operable program or batch file.
2024-08-13T16:02:35.550Z Info:
2024-08-13T16:02:35.550Z Info: You might want to try offline installation, see https://valentjn.github.io/vscode-ltex/docs/installation-and-usage.html#offline-installation.
"Long Name Here" is used as a substitute for my actual Username for privacy reasons.
I believe that this problem arises due to presence of whitespace in %USERPROFILE%
because of the error 'c:\Users\Long' is not recognized as an internal or external command, operable program or batch file.
, which seems to be a relatively common problem in Windows PowerShell where it cuts off Long Name Here, interpreting the first segment as a command instead of the entire string as a path to the destination (i.e., the batch file).
Would there be a possible workaround for this problem while waiting (hopefully) for a fix? I'm thinking that modifying the batch file itself or something in extension.js
that provides the path to the batch file would fix this issue, but being an end-user myself, this is simply out of my depth.
您好,邮件已收到,我一定尽快回复。
Applied the fixes stated, and while it did get past the originally posted error, there do seem to still be issues starting the local ltex server/client. Would love to see this holistically fixed in mainline. Thanks for the work so far!
I've applied the above fix locally to the
extension.js
file but I am now encountering issues with whitespace instead in%USERPROFILE%
upon restarting Visual Studio Code and the extension as follows:2024-08-13T16:02:35.490Z Info: Setting LTeX UI language to 'en'. 2024-08-13T16:02:35.490Z Info: Loading i18n messages... 2024-08-13T16:02:35.492Z Info: Loading default i18n messages... 2024-08-13T16:02:35.497Z Info: 2024-08-13T16:02:35.497Z Info: ltex.ltex-ls.path not set. 2024-08-13T16:02:35.497Z Info: Searching for ltex-ls in 'c:\Users\Long Name Here\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib'... 2024-08-13T16:02:35.498Z Info: ltex-ls found in 'c:\Users\Long Name Here\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0'. 2024-08-13T16:02:35.498Z Info: 2024-08-13T16:02:35.498Z Info: Using ltex-ls from 'c:\Users\Long Name Here\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0'. 2024-08-13T16:02:35.498Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set. 2024-08-13T16:02:35.499Z Info: Testing ltex-ls... 2024-08-13T16:02:35.499Z Info: Command: "c:\\Users\\Long Name Here\\.vscode\\extensions\\valentjn.vscode-ltex-13.1.0\\lib\\ltex-ls-15.2.0\\bin\\ltex-ls.bat" 2024-08-13T16:02:35.499Z Info: Arguments: ["--version"] 2024-08-13T16:02:35.499Z Info: env['JAVA_HOME']: undefined 2024-08-13T16:02:35.499Z Info: env['JAVA_OPTS']: "-Xms64m -Xmx512m" 2024-08-13T16:02:35.550Z Error: Test failed. 2024-08-13T16:02:35.550Z Error: Error details: 2024-08-13T16:02:35.550Z Info: ltex-ls terminated with non-zero exit code 1. 2024-08-13T16:02:35.550Z Info: stdout of ltex-ls: 2024-08-13T16:02:35.550Z Info: 2024-08-13T16:02:35.550Z Info: stderr of ltex-ls: 2024-08-13T16:02:35.550Z Info: 'c:\Users\Long' is not recognized as an internal or external command, 2024-08-13T16:02:35.550Z Info: operable program or batch file. 2024-08-13T16:02:35.550Z Info: 2024-08-13T16:02:35.550Z Info: You might want to try offline installation, see https://valentjn.github.io/vscode-ltex/docs/installation-and-usage.html#offline-installation.
"Long Name Here" is used as a substitute for my actual Username for privacy reasons.
I believe that this problem arises due to presence of whitespace in
%USERPROFILE%
because of the error'c:\Users\Long' is not recognized as an internal or external command, operable program or batch file.
, which seems to be a relatively common problem in Windows PowerShell where it cuts off Long Name Here, interpreting the first segment as a command instead of the entire string as a path to the destination (i.e., the batch file).Would there be a possible workaround for this problem while waiting (hopefully) for a fix? I'm thinking that modifying the batch file itself or something in
extension.js
that provides the path to the batch file would fix this issue, but being an end-user myself, this is simply out of my depth.
Running the batch file itself works, (so it's not referencing it's own path), meaning there is something in extension.js
probably that is not considering spaces in paths. Although this part is I think more relevant to #80 (https://github.com/valentjn/vscode-ltex/issues/80#issuecomment-2291032843)
As this repo seems to be unmaintained (and neo-ltex might as well), I created a fork: https://github.com/ltex-plus/vscode-ltex-plus https://marketplace.visualstudio.com/items?itemName=ltex-plus.vscode-ltex-plus
Thank you @spitzerd! Your new fork of the LTeX extension for VSCode works for me with the latest VSCode 1.92. I confirm that the original LTeX extension gave the error described in this issue.
This seems like an easy fix. Has anyone tried sending a pull request (PR)?
Thank you @spitzerd for your fork keeping Ltex alive, but after installing Ltex+ this error comes up :
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/bsplines/ltexls/LtexLanguageServerLauncher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Thank you anyone for advice.
@veronidan Can you please open an issue at https://github.com/ltex-plus/vscode-ltex-plus ?
Thanks @JakeSteam that took care of it for me!
您好,邮件已收到,我一定尽快回复。
Describe the bug New versions of Node require setting "shell: true" when calling spawn/spawnSync on a .bat file such as "ltex-ls.bat".
Steps to reproduce Run on Windows.
Expected behavior That it works.
Sample document N/A
LTeX configuration N/A
"LTeX Language Server" log file No log file created as server never starts
"LTeX Language Client" log file 2024-07-29T17:17:28.190Z Info: Setting LTeX UI language to 'en'. 2024-07-29T17:17:28.190Z Info: Loading i18n messages... 2024-07-29T17:17:28.190Z Info: Loading default i18n messages... 2024-07-29T17:17:28.194Z Info: 2024-07-29T17:17:28.194Z Info: ltex.ltex-ls.path not set. 2024-07-29T17:17:28.194Z Info: Searching for ltex-ls in 'c:\Users...'... 2024-07-29T17:17:28.194Z Info: ltex-ls found in 'c:\Users...'. 2024-07-29T17:17:28.194Z Info: 2024-07-29T17:17:28.194Z Info: Using ltex-ls from 'c:\Users...'. 2024-07-29T17:17:28.194Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set. 2024-07-29T17:17:28.196Z Info: Testing ltex-ls... 2024-07-29T17:17:28.196Z Info: Command: "c:\Users\...\lib\ltex-ls-15.2.0\bin\ltex-ls.bat" 2024-07-29T17:17:28.196Z Info: Arguments: ["--version"] 2024-07-29T17:17:28.196Z Info: env['JAVA_HOME']: undefined 2024-07-29T17:17:28.196Z Info: env['JAVA_OPTS']: "-Xms64m -Xmx512m" 2024-07-29T17:17:28.196Z Error: Test failed. 2024-07-29T17:17:28.196Z Error: Error details: 2024-07-29T17:17:28.201Z Error: Error: spawnSync c:\Users...\lib\ltex-ls-15.2.0\bin\ltex-ls.bat EINVAL 2024-07-29T17:17:28.201Z Error: at Object.spawnSync (node:internal/child_process:1124:20) 2024-07-29T17:17:28.201Z Error: at Object.spawnSync (node:child_process:914:24) 2024-07-29T17:17:28.201Z Error: at DependencyManager. (c:\Users...\dist\extension.js:15912:43)
2024-07-29T17:17:28.201Z Error: at Generator.next ()
2024-07-29T17:17:28.201Z Error: at fulfilled (c:\Users...\dist\extension.js:15367:32)
2024-07-29T17:17:28.202Z Info: ltex-ls did not print expected version information to stdout.
2024-07-29T17:17:28.202Z Info: stdout of ltex-ls:
2024-07-29T17:17:28.202Z Info:
2024-07-29T17:17:28.202Z Info: stderr of ltex-ls:
2024-07-29T17:17:28.202Z Info:
2024-07-29T17:17:28.202Z Info: You might want to try offline installation, see https://valentjn.github.io/vscode-ltex/docs/installation-and-usage.html#offline-installation.
Version information
Additional context/information Easy enough to solve by patching extension.js file locally. See https://github.com/node-red/node-red/pull/4652/commits/bd58431603fb4169c1696f6b97a618b1acae5091 for pattern to fix. Will submit PR if this project is active and accepting PRs.