redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 440 forks source link

Code running in WSL:Ubuntu will not load the codestyle.xml located in the Windows filesystem #1783

Open rdcoe opened 3 years ago

rdcoe commented 3 years ago

I found that vscode cannot load an eclipse profile if vscode is using WSL as the terminal and the codestyle file is in the Windows filesystem. This I found is true regardless of the url syntax for local files, i.e., D:\path\to\file or /d/path/to/file. I had to copy the file into my WSL filesystem and reference is relative to the WSL root, i.e., /home/path/to/file.

Environment
Steps To Reproduce
  1. configure Java › Format › Settings: Url to be drive_letter:\path\to\eclipse_codestyle.xml
  2. confirm the settings aren't used when formatting file
  3. configure Java › Format › Settings: Url to be file:///wsl_drive_mnt/path/to/eclipse_codestyle.xml
  4. confirm the settings aren't used when formatting file
  5. configure Java › Format › Settings: Url to be file:///path/to/eclipse_codestyle.xml
  6. confirm file is used when formatting file
snjeza commented 3 years ago

@rdcoe you can try /mnt/drive_letter/path/to/eclipse_codestyle.xml

rdcoe commented 3 years ago

I've changed the root mount point to use /, instead of /mnt/ so that's not the problem.

On Sun, Jan 31, 2021 at 12:16 PM Snjeza notifications@github.com wrote:

@rdcoe https://github.com/rdcoe you can try /mnt/drive_letter/path/to/eclipse_codestyle.xml

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/redhat-developer/vscode-java/issues/1783#issuecomment-770415974, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZS3FO56OLDUTJAGIJFB2LS4WF77ANCNFSM4W2UPQLA .

snjeza commented 3 years ago

Could you try

ls /mnt/drive_letter/path/to/eclipse_codestyle.xml or ls /drive_letter/path/to/eclipse_codestyle.xml drive_letter is without : as /mnt/c/path/to/eclipse_codestyle.xml or /c/path/to/eclipse_codestyle.xml See https://github.com/microsoft/WSL/issues/1918

rdcoe commented 3 years ago

ls /d/OneDrive/Documents/Development/eclipse_codestyle.xml /d/OneDrive/Documents/Development/eclipse_codestyle.xml* ls /mnt/d/OneDrive/Documents/Development/eclipse_codestyle.xml ls: cannot access '/mnt/d/OneDrive/Documents/Development/eclipse_codestyle.xml': No such file or directory

Is this what you're looking for?

thx

On Sun, Jan 31, 2021 at 2:32 PM Snjeza notifications@github.com wrote:

Could you try

ls /mnt/drive_letter/path/to/eclipse_codestyle.xml or ls /drive_letter/path/to/eclipse_codestyle.xml for instance, drive_letter is without : as /mnt/c/path/to/eclipse_codestyle.xml or /c/path/to/eclipse_codestyle.xml See microsoft/WSL#1918 https://github.com/microsoft/WSL/issues/1918

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/redhat-developer/vscode-java/issues/1783#issuecomment-770437058, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZS3FOU4E65D6EIUYLRJJ3S4WV3NANCNFSM4W2UPQLA .

rdcoe commented 3 years ago

btw, I see you linked it to the issue on changing the mount point. I did that quite a long time ago, using the wsl.conf method that's described in the issue.

cat /etc/wsl.conf [automount] root = / options = "metadata"

snjeza commented 3 years ago

Is this what you're looking for?

yes, it is. You should use:

"java.format.settings.url": "/d/OneDrive/Documents/Development/eclipse_codestyle.xml",

could you attach your server log ?

rdcoe commented 3 years ago

K, I just re-tested, so as to get new log data, and it worked. Not sure what was different between now and before, when I had previously defined the url using a windows path, from when I ran code under a windows profile. When I changed it to use a WSL path, it didn't work. Perhaps I had a syntax error in my attempts to get it to work; I wasn't sure if I needed a raw path or a file:/// URL reference, so maybe I messed that up?

Long story short, looks like this can be closed. But perhaps a more instructional message on this page, https://github.com/redhat-developer/vscode-java/wiki/Formatter-settings, which only has a remote http reference as an example would be helpful?

Thanks.

On Sun, Jan 31, 2021 at 10:26 PM Snjeza notifications@github.com wrote:

Is this what you're looking for?

yes, it is. You should use:

"java.format.settings.url": "/d/OneDrive/Documents/Development/eclipse_codestyle.xml",

could you attach your server log http:///d/OneDrive/Documents/Development/eclipse_codestyle.xml ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/redhat-developer/vscode-java/issues/1783#issuecomment-770538561, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZS3FLVD3K62XDMANLZXZLS4YNMTANCNFSM4W2UPQLA .