Currently, I have a file, eclipse-formatter.xml, located at ${workspaceRoot}/.vscode directory.
I understand environment variables are not supported in VSCode-Java.
So, if I were to start from:
"java.format.settings.url": "",
How do I know where the current working directory for "java.format.settings.url" defaults to? Or this is actually based on where the ".code-workspace" file is located? Or this is based off of where "settings.json" is located?
@tommai78101 you can try the following:
"java.format.settings.url": ".vscode/eclipse-formatter.xml",
Thanks for the solution. I have my formatter set up now.
I would like to know if there's a way to detect the current working directory? If so, where does it begin by default, when the "java.format.settings.url" is not specified yet?
Currently, the wiki page on Github didn't specify in detail where the current working directory is pointing to.
See https://code.visualstudio.com/docs/editor/variables-reference
${cwd} - the task runner's current working directory on startup
Thanks.
I'll figure something out for printing the ${cwd} within Visual Studio Code.
This seems not working in latest VC code version 1.54.3
@saumilsdk Open a new issue and reference this ticket.
@tommai78101 Hey this seems to work with _file:_ prefix.
"java.format.settings.url": "file:/eclipse-formatter.xml"
"java.format.settings.url": "file:.vscode/eclipse-formatter.xml", should work
Yep, latest VSCode broke referencing local files without a file: protocol... @saumilsdk and @kulynyak tipps fixed the issue for me! Thanks so much!
@saumilsdk @kulynyak Thanks to both. Didn't know there's a new protocol to specify the file.
It's a bug that'll be fixed in the next release (end of March)
Duplicate of #1827
Most helpful comment
Yep, latest VSCode broke referencing local files without a
file:protocol... @saumilsdk and @kulynyak tipps fixed the issue for me! Thanks so much!