-
-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prettier error spawnSync EINVAL when formatting Apex classes #3495
Comments
Prettier is at 3.3.3 and the Apex plugin is at 2.1.4. Did you try updating those? |
I tryed to update for a lot of combinations but no success, let me try with this one too. |
@DiegoCanuto I'm not sure if this helps but restarting my machine fixed this issue for me. Still not sure what caused the error though. The only thing I can think of was updating the Github extension in VS Code. |
I was affected after an update of vs code to version 1.92.1 downgrade to 191 and all OK Link: https://update.code.visualstudio.com/1.91.1/win32-x64/stable |
Thank you so much @fgl27 I did the downgrade to 191 and worked |
edit: ty for re-opening
|
The node spawn issue does not seem to impact the prettier extension directly, I suggest opening an issue with the apex plugin |
Summary
Prettier is not working to format apex files. Also I found an issue related to Node / Windows users
Steps To Reproduce:
Expected result
Format the file
Actual result
Prettier Error spawnSync
Additional information
Feel free to attach a screenshot.
Prettier Version:
2.8.0
Prettier Plugin Apex Version:
1.12.0
Java Version:
java 22.0.2 2024-07-16
Java(TM) SE Runtime Environment (build 22.0.2+9-70)
Java HotSpot(TM) 64-Bit Server VM (build 22.0.2+9-70, mixed mode, sharing)
Node Version
v22.6.0
** Npm Version**
10.8.2
VS Code Version:
Version: 1.92.0 (user 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.19045
Prettier Extension Version:
10.4.0.
OS and version:
Windows 10
Prettier Log Output
["ERROR" - 11:05:01 AM] Error formatting document.
["ERROR" - 11:05:01 AM] spawnSync c:\Test\Project\node_modules\prettier-plugin-apex\vendor\apex-ast-serializer\bin\apex-ast-serializer.bat EINVAL
Error: spawnSync c:\Test\Project\node_modules\prettier-plugin-apex\vendor\apex-ast-serializer\bin\apex-ast-serializer.bat EINVAL
at Object.spawnSync (node:internal/child_process:1124:20)
at spawnSync (node:child_process:914:24)
at parseTextWithSpawn (c:\Test\Project\node_modules\prettier-plugin-apex\dist\src\parser.js:47:59)
at Object.parse (c:\Test\Project\node_modules\prettier-plugin-apex\dist\src\parser.js:472:25)
at Object.parse (c:\Test\Project\node_modules\prettier\index.js:7331:23)
at coreFormat (c:\Test\Project\node_modules\prettier\index.js:8645:18)
at formatWithCursor2 (c:\Test\Project\node_modules\prettier\index.js:8837:18)
at c:\Test\Project\node_modules\prettier\index.js:37832:12
at Object.format (c:\Test\Project\node_modules\prettier\index.js:37846:12)
at t.PrettierMainThreadInstance.format (c:\Test\Project.vscode\extensions\esbenp.prettier-vscode-10.4.0\dist\extension.js:1:18227)
at t.default.format (c:\Test\Project.vscode\extensions\esbenp.prettier-vscode-10.4.0\dist\extension.js:1:16318)
at async t.PrettierEditProvider.provideEdits (c:\Test\Project.vscode\extensions\esbenp.prettier-vscode-10.4.0\dist\extension.js:1:12876)
at async W.provideDocumentFormattingEdits (c:\Test\Project\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:154:109702)
["INFO" - 11:05:01 AM] Formatting completed in 99ms.
The text was updated successfully, but these errors were encountered: