LaurentTreguier / vscode-uncrustify

Code format using uncrustify
66 stars 10 forks source link

Does this extension work with mac Visual Studio Code? #54

Closed samishchandra closed 4 years ago

samishchandra commented 4 years ago

I freshly downloaded latest Visual Studio from here.

I installed Uncrustify and the extension as per the instructions. I configured it via settings.. I am not able to see any formatters registered for any of the C, C++, ObjC, ObjC++ files.

Here is what I added in the vstudio settings file.

    "uncrustify.configPath.osx": "/Users/<username>/.uncrustify.cfg",
    "uncrustify.graphicalConfig": true,
    "uncrustify.executablePath.osx": "/usr/local/bin/uncrustify",
    "uncrustify.langOverrides":{
        "apex": "JAVA",
        "apex-anon": "JAVA",
        "objective-cpp": "OC+",
    },

Here is the log I see in the debug console.

Debug: extension started
Debug: registered formatter
Debug: uncrustify installed: true
Debug: should uncrustify be installed: undefined
Debug: installers found: none
Debug: installer choice: undefined
LaurentTreguier commented 4 years ago

No, this extension is only compatible with Visual Studio Code. Visual Studio for Windows and Visual Studio for Mac are completely different editors under the hood, and they have different extension systems

samishchandra commented 4 years ago

Thanks for the reply.

Oh okay. Is there an extension that is available to format the vscode currently?

samishchandra commented 4 years ago

@LaurentTreguier, sorry i mistyped the issue header, I am currently using vscode for mac only ?

LaurentTreguier commented 4 years ago

Yes, I see; your configuration seems perfectly fine, I don't know what the problem is yet. I will test it on mac and see if it works

LaurentTreguier commented 4 years ago

I have some questions to try to understand why this happens:

samishchandra commented 4 years ago

Please find the below screenshots for formatter and vscode settings.

Formatter commands

image

For a fresh install and when i disable cpp. I get No formatter registered for filetype 'objective-cpp' notification.

Settings

image

How did you install uncrustify ? Does it properly work in the terminal ?

Yes. Installed it via Homebrew. brew install uncrustify --HEAD

 ~  uncrustify --version
Uncrustify-91076aa

Have you tried removing and re-intalling the extension ?

Done this multiple times.

samishchandra commented 4 years ago

Adding following to settings file, made it to work ✅. Thank you.

"editor.defaultFormatter": "LaurentTreguier.uncrustify",
LaurentTreguier commented 4 years ago

Strange, I think it should not need this. But if it works, then great ! 👍