简体   繁体   English

Visual Studio Code - 代码片段 cw 意外行为

[英]Visual Studio Code - Code Snippet cw Unexpected Behavior

When using code snippets in Visual Studio Code, the behavior of cw which turns into Console.WriteLine() always includes the fully qualified name when it is auto completed, as follows.在 Visual Studio Code 中使用代码片段时,转换为Console.WriteLine()cw的行为在自动完成时始终包含完全限定名称,如下所示。

System.Console.WriteLine()

However, I already have using System;但是,我已经using System; declared at the top of my file.在我的文件顶部声明。 Why does VSCODE insist on including the namespace in the code snippet?为什么VSCODE坚持在代码片段中包含命名空间? I am expecting it to auto complete into this,我期待它自动完成,

Console.WriteLine()

Is this normal behavior to be expected from VSCODE ? VSCODE会出现这种正常行为吗?

maybe you can create a snippet in VSC :也许您可以在 VSC 中创建一个片段

  1. ctrl+shift+p Ctrl+Shift+P
  2. Configure user snippets配置用户片段
  3. Csharp夏普
{   "Print ConsoleWriteLine()": {
        "prefix": "cw",
        "body": [
            "Console.WriteLine($0);"
        ],
        "description": "Print line of code"
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM