ES7 React/Redux/GraphQL/React-Native 片段不起作用

问题描述 投票:0回答:8

由于某种原因,我无法使用 ES7 React/Redux/GraphQL/React-Native 片段,即使我已经安装了所需的扩展。

reactjs code-snippets vscode-snippets
8个回答
7
投票

搜索命令 您可以使用 ES7 片段搜索命令搜索片段,该命令可以使用 CMD + Shift + P 运行,或者仅使用 CMD + Shift + R(对于 Windows 和 Linux 为 CTRL + ALT + R)键绑定。


2
投票

你必须降级到

v3.1.1
才能工作,我遇到了类似的问题并以这种方式解决了它,我认为更新的版本不起作用fsr

右键单击扩展程序并选择

install another version
,然后在顶部会出现版本列表,然后选择
v3.1.1


2
投票

我也有同样的问题。 对我来说,这个设置选项很有效。

"editor.suggest.showSnippets": true,

// Controls if quick suggestions should show up while typing
  //code snippet Issue https://stackoverflow.com/questions/44321000/visual-studio-code-user-snippets-not-working
  "editor.quickSuggestions": {
    "other": true,
    "comments": false,
    "strings": true,
  },
  // top: Show snippet suggestions on top of other suggestions.
  "editor.snippetSuggestions": "top",
  // Controls whether to automatically show inline suggestions in the editor
  "editor.inlineSuggest.enabled": true,
  // setting which controls if suggestions are triggered by special characters.
  "editor.suggestOnTriggerCharacters": true,
  // Controls auto complete on dot(.)
  // https://stackoverflow.com/questions/49447663/disable-autocomplete-on-dot-in-vscode
  "editor.acceptSuggestionOnCommitCharacter": false,
  // Controls whether sorting favours words that appear close to the cursor
  "editor.suggest.localityBonus": true,
  // Controls how suggestions are pre-selected when showing the suggest list
  "editor.suggestSelection": "recentlyUsed",
  // Controls the delay in ms after which quick suggestions will show up.
  // If set to -1, quick suggestions will show up immediately.
  // If set to +500, quick suggestions will not show up because of Github Copilot
  "editor.quickSuggestionsDelay": 100,
  "editor.suggest.snippetsPreventQuickSuggestions": false,
  // Controls if pressing tab inserts the best suggestion and if tab cycles through other suggestions
  "editor.tabCompletion": "on",
  // Enable word based suggestions
  "editor.wordBasedSuggestions": true,
  "editor.suggest.showColors": true,
  "editor.suggest.showConstants": true,
  "editor.suggest.showConstructors": true,
  "editor.suggest.showCustomcolors": true,
  "editor.suggest.showDeprecated": false,
  "editor.suggest.showEnumMembers": true,
  "editor.suggest.showEnums": true,
  "editor.suggest.showEvents": true,
  "editor.suggest.showFields": true,
  "editor.suggest.showFiles": true,
  "editor.suggest.showFolders": true,
  "editor.suggest.showFunctions": true,
  "editor.suggest.showInterfaces": true,
  "editor.suggest.showIssues": true,
  "editor.suggest.showKeywords": true,
  "editor.suggest.showMethods": true,
  "editor.suggest.showModules": true,
  "editor.suggest.showOperators": true,
  "editor.suggest.showProperties": true,
  "editor.suggest.showReferences": true,
  "editor.suggest.showSnippets": true,
  "editor.suggest.showStructs": true,
  "editor.suggest.showTypeParameters": true,
  "editor.suggest.showVariables": true,
  "editor.suggest.showValues": true,
  "editor.suggest.showWords": true,
  "editor.suggest.showUsers": true,
  "editor.suggest.showUnits": true,

0
投票

有同样的问题,请检查:

打开 VSCode JSON 设置,

“ctrl + shift + P”或“Cmd + Shift + P”=>然后输入“打开设置(JSON)”

复制您当前的设置并保存到其他地方以便再次使用, 然后清除所有 JSON 设置并通过“ctrl + s”保存,关闭 VSCode 并再次打开,检查 ES7 片段是否有效,然后再次进入 JSON 设置并粘贴之前复制的设置。


0
投票
<Ctrl><Shift>P

Preferences: Open Settings (JSON)

<Ctrl>F
editor.quickSuggestions

改变

"other": false

"other": true

这解决了我的问题。


0
投票

该扩展程序已停止为您工作,因为您可能会更改某些设置。

  1. 确保您已安装并启用它,并且您正在处理具有正确文件扩展名的文件,以便它们可以工作(尝试:.jsx 和 .tsx)。
  2. 如果它们仍然无法工作(我也遇到过这种情况),请检查您的设置,因为某些设置可能会干扰,并使扩展程序停止工作。
  3. 通过以下方式打开settings.json: CTRL + SHIFT + p ,输入:settings.json,选择:“打开设置(JSON)
  4. 检查settings.json文件中以下设置是否与我的不同:
    "editor.snippetSuggestions": "top",     /*make sure this is NOT "none"*/
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.quickSuggestions": {
      "other": true,
      "comments": false,
      "strings": true
    },
    "editor.wordBasedSuggestions": true,
    "html.suggest.html5": false,
    "typescript.suggest.paths": false,
    "javascript.suggest.paths": false,

作为快速实验,您可以复制整个代码,将其粘贴到settings.json的末尾,保存,然后重新启动VSC。
如果它解决了您的问题,您可以将命令一一排序,以找出导致您问题的原因。


0
投票

检查并确保您的片段建议优先级未选择为“无”

在您的设置搜索栏中:@modified

Editor: Snippet Suggestions

确保优先级设置为“top”,或者至少不是“none”。

Snippet Suggestions Drop Down Options

默认值是“内联”,但在仔细阅读 VS Code 的 Intellisense 和设置文档后,我能够通过使用上面提到的“@modified”搜索词搜索所有修改的设置来找到它。如果这不适合您,只需直接搜索片段建议。


0
投票

访问 VS Code Marketplace,搜索 ES7+ React/Redux/React-Native snippets 扩展,然后将其直接安装在本地 VS Code 应用程序中。

© www.soinside.com 2019 - 2024. All rights reserved.