You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a bunch of tooling/automation situations where it would be useful to me to execute automated/deterministic refactorings from the command line than interactively in an IDE.
Is that possible with roslynator? If no, is that something you're open to considering? (I'm not asking you to implement it for me, but whether it feels "in scope" for your vision of this project.)
I thought you probably meant analyzers or code fixes (it's common confusion).
How could you possibly use refactorings from command line? Refactoring represents a single operation that is provided on demand for a given span of text. By definition, it's not something you can apply automatically.
Thanks for the examples — refakts and clang-rename make it clearer, and I think we were talking past each other. When I said a refactoring "isn't something you can apply automatically," I meant it the way analyzers/code fixes work: an analyzer has a predicate deciding where it applies, so roslynator fix can walk a whole solution unattended. A refactoring has no predicate — it only knows "the caret is here, run this action." I follow your proposal now: you'd supply the location yourself, so it's scripting a single precise invocation of what the IDE does interactively. Mechanically that's feasible — our refactorings run off a RefactoringContext around a TextSpan.
My real concern is startup cost. A refactoring needs a semantic model, which means the project/solution has to be loaded with references resolved — a multi-second-plus MSBuild operation. With roslynator fix that cost is amortized across the whole solution; here you'd pay it in full for one edit. Cold-loading a solution per refactoring isn't practical. Worth noting your examples avoid this: refakts is TypeScript, and clang-rename works off a single translation unit, so neither pays that tax.
That points me away from a one-shot CLI command and toward a persistent process that loads once and services many requests — i.e. LSP or a long-running daemon. That's a much bigger scope, so I'd want to think it through before committing. Interested in your thoughts.
I would start by cold-loading the solution per refactoring, even though it will be slow: there are scenarios where that will be useful.
Then if you see that people are complaining that it's too slow, you will know there's interest in this feature and can think about performance (or no one complains and you know not to waste your time on it).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I have a bunch of tooling/automation situations where it would be useful to me to execute automated/deterministic refactorings from the command line than interactively in an IDE.
Is that possible with roslynator? If no, is that something you're open to considering? (I'm not asking you to implement it for me, but whether it feels "in scope" for your vision of this project.)
All reactions