-
Notifications
You must be signed in to change notification settings - Fork 535
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
Error with 'Format Document' command when path has spaces #1873
Comments
This is related to nodejs/node#7367. I will look into it. |
The complaint about the |
Looking closely at the logs, I am a bit puzzled by the failure of the formatting command because of spaces in the command path. Building went fine and yet it was using I do not have access to a Windows machine. Could someone investigate what is going on in this? |
This is the content of my .fls:
|
I have moved the project to
As you said it really is quite puzzling for it to work only in one case. |
Ok I get it for the |
When using docker, the PWD entry refers to a directory inside the docker image. It is much safer to take the dirname of the .fls file as the working directory. Related to #1873
Can you try to call SyncTeX from cursor from the TeX badge and post the logs? |
With "latex-workshop.synctex.synctexjs.enabled": true:
With "latex-workshop.synctex.synctexjs.enabled": false:
|
Thanks. The test with It took me a while googling around but I hope I get it. This seems related to nodejs/node/issues/7367 stating that the failure only occurs when there is a space both in the command and an argument. Synctex and build take the relative path to the file
whereas
Yet, I am bit puzzled by this one. Maybe the
There is no easy fix mentioned in nodejs/node/issues/7367. The solution might be to use cross-spawn. I can make a PR but unfortunately I won't be able to test because I have no access to a Windows machine. Will you be able to test it, see here for how to? |
I've followed your guide and was able to test #1883. The format command has slightly different output depending on which docker image was used: aergus/latex
default: (tianon/latex)
The tianon/latex docker image does not support the y option, since it is using Other commands such as SyncTeX and Build still work. |
This is good news! With Can you try to run the formatting command from the command line (directly from directory c:\Users\Mr Sinamun\Projects\LaTeX-Workshop\scripts`)? You need set the environment variable
If it fails, can you play a bit with the quotes and To solve the issue with |
The current issue seems to be caused by When running:
in the directory:
The folder from which When I hardcore
and run the
This does not happen on Linux, because the |
I think you have found the second problem. Looking closely at your first post
The build spawn uses the basename of the rootFile LaTeX-Workshop/src/components/builder.ts Lines 500 to 515 in 9ee65b7
This is supposed to work similarly for formatting but it does not. I will look into it |
Using #1883, the stock configuration works for formatting!:
There are two small oddities that I noticed:
After running it twice:
I realize this is quite the edge-case 😅 . |
Great!!
|
Can you run the following test?
const cs = require("cross-spawn");
const cp = require("child_process");
const res1 = cs.spawn.sync('t.bat', [], {stdio: 'pipe', cwd: process.cwd()});
console.log(res1.stdout.toString());
const res2 = cs.spawn.sync('echo', ['Hello'], {stdio: 'pipe', cwd: process.cwd()});
console.log(res2.stdout.toString());
const res3 = cp.spawnSync('t.bat', [], {stdio: 'pipe', cwd: process.cwd()});
console.log(res3.stdout.toString());
const res4 = cp.spawnSync('echo', ['Hello'], {stdio: 'pipe', cwd: process.cwd()});
console.log(res4.stdout.toString());
|
The output is:
The error stack for
|
Let us forget about I will try to implement a hack in the extension. |
To avoid mixing up things. I will merge #1883 and open a new one to fix the echo mode of `cmd.exe. |
Yes you are right! By prepending the content of
I've tested it with |
Related to #1873. Thanks to @MrSinamun for the tip.
Everything should be working fine now. Ask for reopening the issue if not. |
Thank you for your time. Everything is good now. |
Describe the bug
When trying to format a .tex document (Alt+Shift+F) it does not work due to there being a space (punctuation) in the paths.
I've had a similar issue with the Maven for Java extension: See the issue here
Might be related to #485, #786
When building a latex project everything works fine, but there is an error related to an .aux file appearing in the developer console. I'm not sure this is related - But I've included this log under it's own section for just in case.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
When using the Format Document command, it should reformat the document.
Logs (Format Document)
LaTeX Workshop Output
Developer Tools Console
Formatting failed. Please refer to LaTeX Workshop Output for details.
Logs (Build LaTex project)
LaTeX Workshop Output
Developer Tools Console
Desktop
Additional questions
Are you using LaTeX Workshop with VS Code Remote?
Yes - With Remote Container (aergus/latex)
Non-Default settings?
The text was updated successfully, but these errors were encountered: