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