C
C#2mo ago
Nezorin

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
ACiDCA7
ACiDCA72mo ago
can you define "its not working" a bit more?
Nezorin
NezorinOP2mo ago
I type "for", then pressing "Tab", nothing happens
ACiDCA7
ACiDCA72mo ago
siiigh.... show a screenshot of complete visual studio where the suggestionbox is open after you typed 'for'
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
here @ACiDCA7 @TeBeCo
Nezorin
NezorinOP2mo ago
Here the full video from VS start, it's clean install btw i tweaked nothing
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
Yes but it's nou autosected when i press tab, and it works wrong(ads some weird global::System.Int32)
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
Nothing solved but Good night!
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
I didn't
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
ok wait
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
Let me show you what i want with rider
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
Here
Nezorin
NezorinOP2mo ago
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
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
It's just doesn't work in VS, it start to generate some inteliscence/copilot suggestions instead of template for loop
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
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
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
bro... I PRESSED TAB
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
bro
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
u use snippets like "prop"
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
or ctor? bro chill
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
ok
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
Have you used snippets like "ctor" or "prop"?
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
No i swear i always usedfor snippet
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
It should work the same as ctor or prop
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
jcotton42
jcotton422mo ago
is there maybe a setting to prioritze snippets over keywords? or to not have keywords in intellisense?
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
jcotton42
jcotton422mo ago
I mean, you could've brought this up instead of sniping back and forth... looking at VS now
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
what do you want me to do?
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
You telling me that it i had to always type for, then select actual snippet in the intelisens list and then press tab?
jcotton42
jcotton422mo ago
No description
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
jcotton42
jcotton422mo ago
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
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
jcotton42
jcotton422mo ago
@Nezorin in that same page, there's also
No description
jcotton42
jcotton422mo ago
I wonder if that might be causing an issue... lemme try it on my end
Nezorin
NezorinOP2mo ago
Ok So... somehow it's wrong option is first in the list, right?
jcotton42
jcotton422mo ago
from the docs it sounds like the snippet should be taking priority
Nezorin
NezorinOP2mo ago
for "statement" isntead of for "snippet"
jcotton42
jcotton422mo ago
if i'm reading them correclty okay yeah, snippet isn't happening first on my end... lemme disable that experiment
jcotton42
jcotton422mo ago
No description
jcotton42
jcotton422mo ago
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
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
jcotton42
jcotton422mo ago
i hadn't hit tab yet
jcotton42
jcotton422mo ago
Nezorin
NezorinOP2mo ago
THANKS
jcotton42
jcotton422mo ago
(with the experiment off)
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
disabling the checkbox worked
jcotton42
jcotton422mo ago
wdym "want only the statement"? as in don't include the braces?
Nezorin
NezorinOP2mo ago
i already wrote the statement why would i want it
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Nezorin
NezorinOP2mo ago
like lets say i typed "fore" then ok it can complete to "foreach"
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
jcotton42
jcotton422mo ago
that's a keyword, not a statement
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
jcotton42
jcotton422mo ago
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
Nezorin
NezorinOP2mo ago
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
jcotton42
jcotton422mo ago
first tab completed the keyword, second expanded the snippet
jcotton42
jcotton422mo ago
anyhow, now to make that bug report
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
jcotton42
jcotton422mo ago
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
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
jcotton42
jcotton422mo ago
so i'd argue it's stricly a regression actually wait, @Nezorin, even with the new experience, double tabbing still expands the snippet
Nezorin
NezorinOP2mo ago
What does expand mean? It generates exactly what i want with double tab
jcotton42
jcotton422mo ago
turning just for into the for loop body
Nezorin
NezorinOP2mo ago
Sounds legit for -> for (int i = 0; i < length; i++) { }
Want results from more Discord servers?
Add your server