But why are there no free alternatives for refactoring? Is there some difficult technical problem?
If we consider, for example, Java and refactoring then Rename Variable, Extract Method and similar features do not look very hard to implement. There are libraries for parsing Java and if we have the syntax tree then it's just a matter of performing the modifications on it.
Parsing broken code may be a challenge, but a powerful refactoring library would be very helpful even if it could work only on compilable code. Text editors could just call the library and reload the source files after the refactoring is done.
LSP is a step in the good direction by providing completion, jump to definition, etc. Why are there no similar libraries for source code refactorings? What is the difficulty here?
I’d look into a strong type system like Haskell, F#, shoot even Rust will help in large refactorings being easier