Vanila for loop snippet VS 2022
I'm trying to use the built-in code snippet for a for loop in Visual Studio 2022. When I type 'for' and press Tab, it should generate a basic for loop with an integer iterator, but it's not working. Is anyone else experiencing this issue?
87 Replies
can you define "its not working" a bit more?
I type "for", then pressing "Tab", nothing happens
siiigh.... show a screenshot of complete visual studio where the suggestionbox is open after you typed 'for'
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
here @ACiDCA7 @TeBeCo
Here the full video from VS start, it's clean install btw i tweaked nothing
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Yes but it's nou autosected when i press tab, and it works wrong(ads some weird global::System.Int32)
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Nothing solved but Good night!
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
I didn't
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
ok wait
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Let me show you what i want with rider
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Here
I just want to write "for" press tab and i want my vanila for loop with INT i = 0
It always worked in VS, i've used it since 2017 version, but know it seems to be broken
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
It's just doesn't work in VS, it start to generate some inteliscence/copilot suggestions instead of template for loop
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
1) I don't want so spend time on selected "good" icon i just want to press tab
2) it wasn't good it's global::System.Int32 isntead of int
Ok i will capture one more time, see
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
bro...
I PRESSED TAB
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
bro
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
u use snippets like "prop"
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
or ctor?
bro chill
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
ok
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Have you used snippets like "ctor" or "prop"?
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
No i swear i always usedfor snippet
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
It should work the same as ctor or prop
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
is there maybe a setting to prioritze snippets over keywords? or to not have keywords in intellisense?
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
I mean, you could've brought this up instead of sniping back and forth...
looking at VS now
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
what do you want me to do?
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
You telling me that it i had to always type for, then select actual snippet in the intelisens list and then press tab?
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
but, oddly from the help page for that dialog
Always include snippets When this option is selected, IntelliSense adds aliases for C# code snippets to the completion list. In the case where the code snippet alias is the same as a keyword, for example, class, the keyword is replaced by the shortcut. For more information, see C# Code Snippets.so, it sounds like the snippet should be taking priority
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
@Nezorin in that same page, there's also
I wonder if that might be causing an issue...
lemme try it on my end
Ok
So... somehow it's wrong option is first in the list, right?
from the docs it sounds like the snippet should be taking priority
for "statement" isntead of for "snippet"
if i'm reading them correclty
okay yeah, snippet isn't happening first on my end...
lemme disable that experiment
that seems to be the cause
yep, turning that checkbox back on breaks it
@Nezorin try disabling "show new snippet experience"
i'll make a bug report
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
i hadn't hit tab yet
THANKS
(with the experiment off)
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
disabling the checkbox worked
wdym "want only the statement"?
as in don't include the braces?
i already wrote the statement
why would i want it
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
like lets say i typed "fore" then ok it can complete to "foreach"
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
that's a keyword, not a statement
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
and that would be keyword completion, not snippet completion
Nezorin was getting keyword completion when they wanted snippet completion, so I'm not sure why you're bringing this up.
Admittedly I only skimmed the convo above.
oh wait, i think i see what you mean
Ok guys, thank you both i've got what i wanted with disabling this checkbox now it works correct
@TeBeCo sorry for bad explanation, my English is bad
first tab completed the keyword, second expanded the snippet
anyhow, now to make that bug report
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
well even with the exp off, it seems it will work how you want anyhow
since the snippet needs a second tab to insert if you didn't fully type out the keyword
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
so i'd argue it's stricly a regression
actually wait, @Nezorin, even with the new experience, double tabbing still expands the snippet
What does expand mean?
It generates exactly what i want with double tab
turning just
for
into the for loop bodySounds legit
for ->
for (int i = 0; i < length; i++)
{
}