"Add Cursors to Line Ends" in Visual Studio 2019

Has anyone found an equivalent of “Add Cursors to Line Ends” in Visual Studio Code for Visual Studio 2019? The shortcut SHIFT + ALT + I used in Visual Studio code doesn’t work unfortunately, and just throws me the Windows ding/bell warning sound.

The only workaround I’ve found so far is opening the HiddenWordList.h file in Visual Studio Code, using the shortcut to edit the file, then reopening the file in VS 2019.

What I ended up doing is [Shift] + [Alt] clicking before the first word, scrolling down, [Shift] + [Alt] clicking before the last word to set cursors there, typing TEXT(", then doing the same thing off to the right leaving a large amount of whitespace to type the ending. Then highlight the strings and from the top, click on Edit > Advanced > Delete Horizontal Whitespace. You might need to do it twice, but it worked for me.

3 Likes

Nice workaround! I had previously managed to use [Shift] + [Alt] to edit the front of each line, but then ran into the issue getting to the end of each line due to the differing lengths and the resulting whitespace, but I had never thought to use Delete Horizontal Whitespace! As you said, I too had to do it twice, as the first time there was still some remaining whitespace at the end of each string (see screenshot attached). Thanks so much for your help!

I still find it strange that Visual Studio Code—something which is focused on simplicity—has this one-up over Visual Studio.

i found one solution that worked for me:
mark all words, then ctrl + f and use regex to find matches (like on the screen), then replace all

5 Likes

I’m not following when I press replace all it does nothing

EDIT: NVM Got it just had to copy exactly everything you did to the dot lol

Thanks man aaaaaaaaaloooooooot
Finally its over
I was scared i had to do it line by line
Thank god you were here to save us
I followed your steps exactly and it worked
Thanks a ton
Regards,
R.G.

If I’m not mistaken, TEXT macro only changes how the string is encoded, which means an FString variable can be initialized without the macro at first and can be converted later.

Which in turn means that you could go full developer mode and do this instead to liberate yourself from coding environment specific limitations (again, if my assumption is correct):

The TEXT macro is only for string literals. It doesn’t change encoding, all it does is make sure the string literal is the correct type for Unicode. On Windows that’s const wchar_t[N] and L is the prefix used to make a string literal of that type.
i.e. On Windows

FString Word = TEXT("Hello");

Is just

FString Word = L"Hello";

On other platforms such as Linux the macro does nothing as Linux uses char

If you already have an existing FString you don’t need to do anything as it’s already done any necessary conversions.

Ah, I see. I was under the impression that TEXT macro modifies the characters (whether an FString or a char array) based on the OS, locality etc. In one of the early examples I tried using non-latin Turkish letters like i without a dot in a string and the final output differs with and without the macro. That’s why I assumed this would be a workaround to create the FString array without the TEXT macro and do the conversion on the go. Anyways, thanks for clearing it up!

Thank you so much!!! This worked out in less than 1 minute. Gracias!!!

Thanks, I haven’t seen that used before. worked great