Closed JeremyVyska closed 1 year ago
Hey Jeremy :) I understood. But I'm not sure about the best possible approach to solve it.
Furthermore I have a few more things on my list that I would prioritize higher as for this one I think we have good workarounds, like using Ctrl+D
or Ctrl+Shift+L
or Ctrl+D
and sometimes Ctrl+K Ctrl+D
if you want to skip instances.
Or if there are many changes you could simply do a regex search replace with (?!Label )'CHEDDAR'
and CheddarTok
.
Nevertheless I'll look into it, but please be patient if I need some time :)
Two additions:
Hi @JeremyVyska , took some time, but now I've implemented it. It's now like this: If there are further occurences of the same string literal then you're asked if they should be replaced as well directly. Feel free to try it out in v1.0.25.
I'm curious if this would be possible.
I love the "Extract to Label" (and locked) variant. Often, I have older code that uses the same hardcoded text over and over. Extract to Label works on the first, but then I have lingering instances.
Would it be possible to have a CodeAction on a String Literal that you can "Replace with Label" that looks to see if there's a label with the same value (local or global), and if so, swaps the Literal? Would be great if it could do a whole file.
Example nonsense (bad) pre-code:
After using extract-to-label:
In example two, it'd be great to select the
CHEDDAR
in theShredTheCheese
function, do the CodeAction to find thatCheddarTok
matches, so swaps the literal.Super fun would be a Command to run a pass on the whole file doing a complete find/swap.