3 ms·
Yes, it's copy pasting but it's tedious and it adds up fast. Even the doFoo to performBar is tedious because you need to catch all instances and your find/repl
by RealityVoid 4mo ago
Yes, it's copy pasting but it's tedious and it adds up fast.
Even the doFoo to performBar is tedious because you need to catch all instances and your find/replace script strategy might have unintended victims.
In this case indeed, it's just much more convenient.
- fridder 4mo agodon'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.
- mattmanser 4mo agoThe languages I use the IDE literally does this for you, perfectly, deterministically. And instantly, certainly when compared to AI.
- simonw 4mo agoWhich languages, just out of interest?
- Semaphor 4mo agoThat should be most? Unless you do very weird stuff like using strings in JS to call functions, or reflection in C# and similar very special cases, any IDE can handle that.
- rustyminnow 4mo agoJava has very good refactor support. I use jdt.ls which is eclipse based, but I've heard intellij is even better. I've wished for similar refactor actions in other langs.
- t-writescode 4mo agoKotlin, Java, Python, C#, Typescript. Anything that has a trustworthy and consistent pointer between code. Ruby would be the one exception I’ve worked on in my head, and for they language, ctrl+f *usually* (but not always) finds the rest. Ruby is particularly magical with being able to evaluate methods from dynamic strings into running, production code[0]; but otherwise, languages and capable IDEs, like IntelliJ and Visual Studio just support that. I don’t happen to use VS Code, but I assume it has basic refactor, too. [0] Devise. https://github.com/heartcombo/devise/blob/main/lib/devise/controllers/helpers.rb#L115 https://github.com/heartcombo/devise/blob/main/lib/devise/co...
- miroljub 4mo agoIf IDE can do it, a custom tool can do it to. IntelliJ even have a built in MCP server ready to help any agent with such tasks.
- habinero 4mo ago