News for hackers. Stuff that matters.
Re:Ask HN: What are your favourite programming shortcuts by solardev on Sunday March 31, 2024 @10:25AM (#39884562)
In Jetbrains, you can shift-F6 to rename something (like a variable or function) via a built-in refactorer. It'll do it (somewhat) intelligently across not just the current file, but your whole project.

Like in a React project, you can rename the first part of `[isThisThingOn, setIsThisThingOn] = useState()` and it'll automatically rename the setter and all the components that inherit that state. Or if you rename `<MyComponent/>` to something else, it'll rename that component, the imports, the filename itself, etc. across your whole project.

It works pretty well but does have its quirks, like how it handles properties inside objects or type definitions, so it's worth double-checking the IDE's work for readability.

VScode has something similar (F2), I think, but maybe only for some languages? https://code.visualstudio.com/docs/editor/refactoring#_renam.... It's cute that they kept the F2 shortcut key from the Windows (3.1?) days.

There are no comments on this comment yet.