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.