簡體   English   中英

是否有 VSCode 快捷方式將文本包裝在 react/react-native 片段中?

[英]Is there a VSCode shortcut to wrap text in a react/react-native fragment?

我發現自己經常使用片段,並希望使用鍵盤快捷鍵來使其更容易。

將此添加到keybindings.json

{
    "key": "ctrl+k f", // 👈 whatever binding you want. obv.
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": {
      "snippet": "<$1>${TM_SELECTED_TEXT}</$1>"
    }
}

獎勵...如果需要,光標可以輸入任何其他組件的名稱。

  1. 選擇要包裝的元素
  2. 您可以在 mac 中按command + P ,在 Windows 中按 Ctrl + P
  3. 然后您將看到以下搜索欄:

在此處輸入圖像描述

  1. 寫下以下內容:

    >艾美特

  2. 選擇此選項:

在此處輸入圖像描述

  1. 然后寫Fragment並點擊回車:

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM