When you format LaTeX "code" in your document, it will always format by using tabs irregardless of the documents vs-code-indentation-settings.
The document should not change.
The document will now be indented with tabs.
Using tabs vs spaces for formatting is based on the value of editor.insertSpaces. Does the issue appear regardless of the value of editor.insertSpaces. What is your value of editor.detectIndentation?
Both editor.insertSpaces and editor.detectIndentation are set to true.
It seems that I can reproduce this problem. Looking into that.
Quite interestingly, I cannot identify the source of this issue. It seems that the extension can correctly detect the above settings, and translate them into -y="defaultIndent:鈵b悾鈵b悾" for four spaces. However, latexindent seems to ignore this setting only when called by vscode. Scratching head and help needed.
There were actually two problems
latexindent had extra quotestabSize and insertSpaces values were wrong when detectIndentation=true.I think I have fixed both problems but could you please check that it does work with your configuration. Reopen the issue if needed.
This bug seems to be back as of commit https://github.com/James-Yu/LaTeX-Workshop/commit/de6216719f87d27c7bd97ae3c0e85e18a27fee5c, which removes shell: true from the spawn arguments.
Fixed by changing default latex-workshop.latexindent.args to
[
"-c",
"%DIR%/",
"%TMPFILE%",
"-y",
"defaultIndent: '%INDENT%'"
]
@jlelong I can also now reproduce the bug. The fix by @draivin works for me.
Most helpful comment
Fixed by changing default
latex-workshop.latexindent.argsto