user390480
user390480

Reputation: 1665

How do I change the suggestion that displays when I type part of command?

I do a lot of JavaScript in Visual Studio and I would often type the letters cl which would then cause a popup to display. In that popup "console.log" would highlight and I would hit tab and it would put that command in my editor.

Something happened however in that now when I type cl the word "class" is highlighted. I don't know what happened but how do I make it go back to showing/highlighting console.log?

Thanks.

Upvotes: 0

Views: 30

Answers (1)

HaveSpacesuit
HaveSpacesuit

Reputation: 4004

Check your Code Snippets Manager (Tools > Code Snippets Manager...)

Under the JavaScript language you should see the cl snippet you use.

enter image description here

If you need to recreate the snippet file, create a new cl.snippet file in your snippets location with this content, then add it from the Code Snippets Manager.

<CodeSnippet Format="1.1.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <Header>
    <Title>cl</Title>
    <Author>Microsoft Corporation</Author>
    <Shortcut>cl</Shortcut>
    <Description>Code snippet for console.log</Description>
    <SnippetTypes>
      <SnippetType>Expansion</SnippetType>
    </SnippetTypes>
  </Header>
  <Snippet>
    <Code Language="JavaScript"><![CDATA[console.log($end$);]]></Code>
  </Snippet>
</CodeSnippet>

EDIT

To have your console.log() functionality work in .html and .cshtml files, create a new code snippet file like above, but change the Code Language from JavaScript to HTML. Save the file in your My HTML Snippets file location.

(To find it, in Code Snippets Manager, select Language: HTML, and highlight My HTML Snippets. The Location is displayed. For me it is C:\Users{user.name}\Documents\Visual Studio 2017\Code Snippets\Visual Web Developer\My HTML Snippets.)

Now typing CLTab should populate with console.log();.

Upvotes: 1

Related Questions