Refactoring for vxcode

just curious what is status for refactoring tool like move file / move field, rename e.c in vscode.
As I get this question quite often from people that try to use Haxe.

Is it just lack of implementation in vxcode plugin or there are something missing in Haxe compiler it self? :slight_smile:

This is usually first question when I try to introduce Haxe :smiley:

Thank you

As most features in vshaxe are powered by the compiler’s display API, rename would have to be implemented that way as well, yes.

I agree that this is a very important feature, but I don’t think we have any concrete timeline for it.


Thank you @Gama11 for very quick answer :slight_smile:

Is it clear what should be done on Haxe / vxcode side and are there GitHub issues in place or nothing concrete yet ?

If tickets would be there more people could help on this.

Thank you for your great job on vxhaxe, it really feels good to work with already :slight_smile:

1 Like

We have, but no issue on the compiler side yet I think.

Why the extension is limited to only features that are supported by the compiler… IMHO there are things that should be implement in the extension because it’s correct to insert them into the compiler… WDYT?

Not every vshaxe feature uses the compiler. But for some features like completion or rename, you would actually end up having to essentially reimplement large parts of the compiler. And not only that, it’s really hard to maintain and keep up to date (see also: HaxeDevelop and the IntelliJ plugin, which tend to lag behind in terms of support for latest Haxe features).

There are two experimental features called “Extract type” and “Extract function” in Haxe languageserver, hidden behind -debug. Both work to some extend.

I think “Extract type” works in most cases - however it doesn’t update imports for any file outside the one you extract a type from. And extracted type’s file just copies all imports from original file, which is probably too much and requires a manual “Organize imports” to correct.

“Extract function” works in some cases, it can find some parameters and their type hints, but it’s far from perfect, e.g. if your code is inside a for or a switch expression it won’t add parameters for captured or loop variables. Also there is no UI to input a name for your extracted function, so it’s always called newFunction, requiring a manual rename. And it doesn’t look for other places with similar or identical snippets, so it will only operate on the bit of code you selected when activating “Extract function”.

I haven’t looked at both for some time, if you’re feeling adventurous you can compile languageserver with -debug and test them for yourself.

@Gama11 could this help you? :slight_smile: . If not, you mentioned @Simn as somebody that could help with this. Could I like… um… bribe you two guys with a luxurious dinner to get this working? Say, 100 Euro / head working on getting this done? :smiley: Seriously, I’m looking to move THREE MAJOR projects onto this technology and such a commitment and achievement would convince my “benefactors” (read “employers”) to invest in this :slight_smile:

1 Like

In other words, bribes don’t work :smiley:

Or maybe they prefer different way of bribe :slight_smile: