welkineins / vscode-astyle

Format C/C++/Obj-C code with Astyle in VSCode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow for use with arbitrary languages

Gama11 opened this issue · comments

AStyle does a passable job of formatting (simple) Haxe code, and I'd imagine that's the case for a lot of other languages that are not part of the officially supported / listed ones too. However, it seems like the extension is currently restricted to those.

It would be nice to have a simple setting for this, like:

"astyle.additional_languages": ["Haxe"]

I add support in v0.6, please take a look and see if it's works for you :)

Thanks for taking a look!

Unfortunately it doesn't work, at least not unless you open one of the file types that are activation events first. When I hacked in Haxe support for testing, I had to add the activation event here:

https://github.com/Gama11/vscode-astyle/commit/df90d30f498d6908c3fd1471bc1dfd939132b195#diff-b9cfc7f2cdf78a7f4b91a753d10865a2L27

I guess the only way to make a setting like this work is by using onLaguage:*?

Btw, I also just noticed that the name I suggested doesn't really match existing conventions: VSCode settings themselves and those of most extensions seem to use camelCase, so it'd have to be additionalLanguages rather than additional_languages.

I see, there are a default formatter for haxe, I thought it was formatted by astyle as I wish in test. I'll reopen the issue and fix it.

About the naming style, I follow C/C++ package which is also use underline to separate words, and I have already one option with this style, it's a little hard to change it :(

I see, there are a default formatter for haxe

Hm? Not that I know of.

OK, I was be miss leading again by myself. formatter is astyle, but it's not active by opening .hx file but a cpp file in my test environment.

I think I have to use "*" in activationEvents, which means whenever vs code starts up.

It's updated in 0.6.1 🥇

Works for me, thanks! :)

Btw, if you move the changelog from the Readme to a separate CHANGELOG.md file, it will show up in a separate "Changelog"-tab in VSCode:

An image would be nice too, but I guess AStyle doesn't have a logo?

AStyle doesn't have a official logo, bug I can find one. Thanks for your advice :)

Cool! It helps a lot to have a logo when you have a lot of extensions installed - can get difficult to tell them apart.