Status of vscode extension for formatter and checkstyle

Hi,
would like to know what is happening with vscode extensions checkstyle andformatter. I see people are contributing to them but they are not published to marketplace. Are they used from source? or not ready to be published ?
I think they could get more attention if they would be available for use even if not all features are ready for use.

Thank you.

vscode-checkstyle isn’t ready to be published I think, mostly because it doesn’t have sensible defaults at the moment (all checks activated IIRC). It shouldn’t take too much work to get it to that point though.

haxe-formatter was a bit of an experiement of mine that I never ended up finishing. It is technically integrated into haxe-languageserver / vshaxe and usable to some degree, but it’s currently locked behind #if debug. If you want to try it out, you could build vshaxe from source.

One problem is that with the chosen approach, it probably would never be able to handle conditional compilation properly. I’m still hoping to find the time for trying out a different approach, using Lexer output instead of an actual Parse Tree / AST. This is similar to what clang-format does (and I think dealing with conditional compilation was one of the main reasons they went with that approach).

Interesting PPT on clang-format implementation details: https://llvm.org/devmtg/2013-04/jasper-slides.pdf

Thanks for insight @Gama11

Some progress: vscode-checkstyle is now available on the marketplace!

https://marketplace.visualstudio.com/items?itemName=vshaxe.haxe-checkstyle

Thanks to @ablum for pushing it to the finish line. :slight_smile:

4 Likes

Cool, I installed it, its possible to configure the rules? Like I have a lot of TAB indentation problems, but I like it this way (and not space indentation).

Place a file called checkstyle.json in your workspace root and you can start adding and configuring checks. VSCode should guide you through with tooltips and autocompletion.

Without a checkstyle.json file the extension uses a builtin one (https://raw.githubusercontent.com/vshaxe/vscode-checkstyle/master/checkstyle.json), that probably only works for some people.

1 Like

Thx, its possible to “hot-reloading” the checkstyle.json file when changes it? Currently, I have to re-open VSCode to my changes will reflect.

The extension doesn’t cache checkstyle.json, so after changing it, all you should need to do is save or open a file and it should apply your new configuration.
You might have to open and/or save all files from your problems view to make every entry go away.

1 Like

We could implement a file watcher using VSCode’s file watcher API for this. But with auto-save enabled, that might get expensive depending on how many editors you have open at the moment?

Short update: there is now a formatter on haxelib for command line use and a VSCode version integrated into vshaxe extension (see New formatter haxelib library - #2 by ablum).

1 Like