【问题标题】:Where do code snippets reside in Visual Studio Code?代码片段位于 Visual Studio Code 中的什么位置?
【发布时间】:2021-11-19 15:40:23
【问题描述】:

我拥有的唯一 C/C++ 扩展是来自 Microsoft 的 official one。我没有任何其他 sn-p/intellisense/autocompletion 扩展。

查看下面加载的所有扩展:

在尝试为我的 sn-ps 创建快捷键/前缀时,我想确保它不会与其他 sn-ps 的任何预先存在的快捷键/前缀冲突。有没有办法了解/查看 VSCode 中所有当前可用的代码 sn-ps 及其快捷键/前缀?

我尝试通过命令面板Insert Snippet,希望它能显示所有可用的 sn-ps。不幸的是,它没有列出所有的 sn-ps。例如,请参见下图,其中此命令调色板不显示存在 for sn-p,但在编辑器中,当我键入 for 时,可以选择添加这样的 sn-p。

【问题讨论】:

  • 你有sn-ps和代码完成,代码完成可以是sn-p
  • 您阅读过 sn-p 文档页面吗?一些 sn-ps 存在于扩展、工作区、全局用户 sn-ps 目录中
  • 刚刚从code.visualstudio.com/docs/editor/userdefinedsnippets 发现Ctrl space 给出了一个详尽的列表。我想我应该滚动浏览一下,看看是否已经使用了任何关键字/快捷方式/前缀。
  • 然而,令人困惑的是:You can see the available snippets for a language by running the Insert Snippet command in the Command Palette to get a list of the snippets for the language of the current file. However, keep in mind that this list also includes user snippets that you have defined, and any snippets provided by extensions you have installed 在该页面上。本段之前的图像显示了一个 for 内置 sn-p,但它并没有从命令托盘中显示出来。
  • 他们不会为每个 VSC 更新更新图像,只有当你创建一个问题并且它是一个新功能的错过时

标签: visual-studio-code code-snippets


【解决方案1】:

我从vscode-cpptools 的人那里得到了官方的确认,C/C++ sn-ps 只能通过Ctrl-Space 自动完成而不是通过Ctrl-Shift-P Command Pallette 获得。

查看他们的答案链接here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-15
    • 1970-01-01
    • 2019-02-03
    • 1970-01-01
    • 2017-08-01
    • 1970-01-01
    • 2020-09-07
    相关资源
    最近更新 更多