COMMUNITY

Vshaxe 2.17.0 released (auto indentation, sort imports)

2020 starts with a new vshaxe release! :tada: The highlights of this release are:

Auto Indentation

Something a lot of people have been waiting for: pressing enter after a bracketless if / else / for / etc now automatically increases the indentation:

Same for case and default in switch:

Note: depending on your code style, auto indentation might require some configuration. Read the wiki page for more info.

Sort Imports

The Haxe extension already some support for VSCode’s “Organize Imports” feature, but it only removed unused ones. Now it also sorts the imports alphabetically like you would expect.

We also added a separate “Sort Imports” code action if you only want to sort imports without removing unused ones. Both of these can be configured to automatically run when saving the file (similar to “format on save”), have a look at the wiki for more details.

Extract Constant

This is the first refactoring code action that vshaxe supports, with more planned in the future. It replaces all occurences of a string literal with a constant.


Full list of changes as always in the changelog. Also, a big thanks to @RblSb and @ablum for their contributions to this release.

13 Likes

Thanks @Gama11, the work you’re doing on vshaxe is amazing :green_heart:
Same goes for the rest of the team working on display features

3 Likes

In case someone wants their imports grouped by e.g. top- or second-level package names you can put

{
  "emptyLines": {
    "importAndUsing": {
      "betweenImportsLevel": "secondLevelPackage",
      "betweenImports": 1
    }
  }
}

into your hxformat.json and vshaxe will add an empty line between two imports if second part of your package name differs (e.g. sys.io.File and sys.db.Connection - note: also between sys.FileSystem and sys.io.File). betweenImportsLevel supports a few more options, VSCode should give you auto completion in hxformat.json.

The setting should work even if you haven’t turned on formatter in your projects.

1 Like