0

I type 'cw' press tab twice and bam 'Console.WriteLine()' appears. I then press enter and move to another line type 'cw' press tab twice and wtf 'cw.WriteLine()' appears.

enter image description here

I tried throwing my computer out the window but remembered that I need it.

burnsi
  • 6,194
  • 13
  • 17
  • 27
dumdahdum
  • 3
  • 2
  • I was just able to cw-tab-tab-enter about 10 times in a row with same result. What version of Visual Studio are you using? – Kevin M Jan 23 '23 at 16:05
  • I am using visual studio community 2022. Then I am building console apps using .net 6.0 – dumdahdum Jan 23 '23 at 16:17
  • What exact version of VS is this? For example, 17.4.0. VS2022 is a family of versions (17.*). This sounds like a bug, and you can report it to Microsoft using the _Help | Send feedback | Report a problem_ feature in VS itself. Be sure to attach a recording of the problem happening. If you link it here, I can make sure it's sent to the right team internally. – Drew Noakes Jan 23 '23 at 20:41

2 Answers2

1

First, please check whether the version of your VS2022 is the latest version, I am currently using VS community 17.4.4, and the code snippets shortcut 'cw' works fine on my side.

1, So first, please make sure you are based on the latest version of VS2022:

enter image description here

2, Second, you can try to reset the environment settings and turn off synchronized settings on a particular computer(If you don't encountered the issue when you don't login in please unselect the setting.)

Reset environment settings:

enter image description here

enter image description here

enter image description here

enter image description here

turn off synchronized settings on a particular computer:

enter image description here]7

enter image description here

3, And please check whether other snippets have this problem, if not, I suggest you to create your own code snippets, import it and then try again.

Creat a file named xxx.snippet:

<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>xxx</Title>
            <Shortcut>xxx</Shortcut>
            <Description>Code snippet for Console.WriteLine</Description>
            <Author>Microsoft Corporation</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal Editable="false">
                    <ID>SystemConsole</ID>
                    <Function>SimpleTypeName(global::System.Console)</Function>
                </Literal>
            </Declarations>
            <Code Language="csharp"><![CDATA[$SystemConsole$.WriteLine($end$);]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

After that, import this code snippets:

enter image description here

enter image description here

After that, write xxx and double press Tab.

Bowman Zhu-MSFT
  • 4,776
  • 1
  • 9
  • 10
  • 1
    Thank you! That was very helpful. After resetting the import/export settings I can now continuously type 'cw' and the correct snippet is produced after tab-tab. You rock! – dumdahdum Jan 26 '23 at 12:29
0

Reinstall and its fixed! IF thats not an option, force update or check integrity. It has happened to me before but just opening and closing did it for me

You might also have some extension or plugin installed that overrides the default behavior

  • Your most welcome, if it does work dont forget to check it as anwser to help other who might end up in this page –  Jan 23 '23 at 16:25
  • So after reinstalling the issue is still happening. I am just going to live with it for now. – dumdahdum Jan 23 '23 at 18:42