3 ms·
don't LSPs and IDE's help with that?
by fridder 4mo ago
don't LSPs and IDE's help with that?
- rustyminnow 4mo agoI'm right there with you - prefer classic, deterministic tools wherever possible - but there's a limit. E.g. it's easy to rename a single getter from classic enterprise java `Foo getFoo() {..}` to a modern style `Foo foo() {..}` ... but to rename dozens of getters/setters across hundreds of classes is still tedious. Even harder would be to update your setters from `void setFoo(Foo f) { this.foo = f; }` to fluent-style `Parent foo(Foo f) { this.foo = f; return this; }` - I'd be surprised if there's an LSP action for that at all. (I'd love to be proven wrong though)
- teraflop 4mo agoNot sure about LSP, but IntelliJ has had a "structural search and replace" feature for many years, and it can easily handle changes like the one in your second paragraph. It's conceptually like a regex search, but it matches language-specific AST subtrees instead of character sequences.
- yonaguska 4mo agoI've found that for super large but simple refactors, codex and Claude struggle and will just quietly stop doing what you asked it if it's a long running task. I actually had better luck asking codex to write temporary sed scripts based on the requirements then apply them.
- christoff12 4mo agoPerhaps, but do they handle all the other aspects of refactoring, too?
- deathanatos 4mo agoYes, LSPs can supply a variety of refactoring commands (rename, extract to, inline, etc.) that the LSP server can implement directly, deterministically, locally.