LaurentTreguier / vscode-uncrustify

Code format using uncrustify
66 stars 10 forks source link

Fails to format using VSCode Remote SSH #57

Open plwalsh opened 4 years ago

plwalsh commented 4 years ago

I'm having trouble getting the Uncrustify extension to work when using the VSCode Remote SSH environment.

My current setup is as follows:

The uncrustify extension is installed both locally and remotely, but VSCode reports (as expected) the following when I hover over your extension in my list:

Extension is enabled on 'SSH: ' and disabled locally.

When working directly on the remote machine, with its local instance of VSCode and the Uncrustify extension, everything works just fine when I format a document, and I see the following output:

Debug: extension started
Debug: registered formatter for modes: c,cpp,csharp,d,java,objective-c,pawn,pde,vala,apex,apex-anon
Debug: uncrustify installed: true
Debug: should uncrustify be installed: undefined
Debug: installers found: none
Debug: installer choice: undefined
Debug: config file: /absolute/path/to/my/uncrustify.cfg
Debug: launched: ./relative/path/from/workspace/to/uncrustify -l CPP -c /absolute/path/to/my/uncrustify.cfg
Debug: uncrustify exited with error: Parsing: 1862 bytes (1862 chars) from stdin as language CPP

Debug: uncrustify exited with status: 0

But when working from the Windows machine using the VSCode Remote Development environment, the formatting fails with a popup that says,

spawn ./relative/path/from/workspace/to/uncrustify ENOENT

and the following output:

Debug: extension started
Debug: registered formatter for modes: c,cpp,csharp,d,java,objective-c,pawn,pde,vala,apex,apex-anon
Debug: uncrustify installed: true
Debug: should uncrustify be installed: undefined
Debug: installers found: none
Debug: installer choice: undefined
Debug: config file: /absolute/path/to/my/uncrustify.cfg
Debug: launched: ./relative/path/from/workspace/to/uncrustify -l CPP -c /absolute/path/to/my/uncrustify.cfg
Debug: uncrustify exited with error:

My uncrustify settings are configured for the workspace exactly the same in both cases:

"uncrustify.configPath.linux": "./relative/path/from/workspace/to/uncrustify.cfg",
"uncrustify.executablePath.linux": "./relative/path/from/workspace/to/uncrustify",
"uncrustify.debug": true

And a final note, I'm currently compiling the uncrustify executable, on the RHEL7 remote machine, from the v0.66.1 source tarball.

Any help would be greatly appreciated, as your extension has greatly improved my workflow.

LaurentTreguier commented 4 years ago

My guess if that relative paths are handled differently in those two cases; this extension wasn't made with relative paths in mind regarding the Uncrustify executable path

plwalsh commented 4 years ago

You are correct; that fixed it. I was hoping it that setting would take a relative path from the root of my workspace since I was adding the setting to my "workspace settings". We use a specific version of the uncrustify executable for this particular project, simply because it was the first one we got a working configuration for, and haven't updated since. I could see this as a reasonable use case for adding support for relative executable paths, based on the workspace.

Thanks for the help!