The BEST Way to Refactor in VS Code
HTML-код
- Опубликовано: 18 мар 2024
- This shortcut can save you lots of time when refactoring!
*Newsletter*
Newsletter 🗞 - www.jamesqquick.com/newsletter
*DISCORD*
Join the Learn Build Teach Discord Server 💬 - / discord
Follow me on Twitter 🐦 - / jamesqquick
Check out the Podcast - compressed.fm/
Courses - jamesqquick.com/courses
*QUESTIONS ABOUT MY SETUP*
Check out my Uses page for my VS Code setup, what recording equipment I use, etc. www.jamesqquick.com/uses
really appreciate keep sharing vids like this ❤
Nice Tip James !!
Glad you liked it!
It's a time saver if you know every instance in the file needs to be changed, but if not you could also use the find and replace and select individual instances.
Yep, that's very true!
Nice tip!!
Glad to help!
Try CMD + Shift + L on Mac
You can also select the text casing on the top right overlay option.
I prefer select the variable or function name and hit Ctrl + Shift + F to search across multiple files, it has a case sensitive option too
Which font he uses? It is neat
Wow!!! I don't knew!!!
Hi James, did you see a latest version of VS Code 1.87 that has a copilot rename suggestions? It seems really cool, but in my case somehow doesn't work. Did you try that already? Thanks!
My favourite LSP feature. In any editor.
What is LSP?
Language Server Protocol. The language server that makes this work. Like TypeScripts, or Rusts, etc@@JamesQQuick
I found this doesn't always work correctly, so I pref to just CTRL + D until I selected every with that specific name.
What kind of issues have you had? Also CTRL+D only works in one single file not across files. That's a huge benefit of the refactor way
Instead of hitting CTRL+D until having selected all instances, try hitting CTRL+SHIFT+L instead.
Sidenote:
It selects every instance no matter its case. If you want to preserve the case of each instance and not having to manually go through each instance to check the casing is correct, I can highly recommend the extension called “Multiple cursor case preserve”, which does exactly that: keeps the casing of any highlighted instance.