はじめに
Visual Studio Code(VSCode)は,ご存知の通り様々な言語に対応したエディタです.もちろん Markdown にも対応しています.
多くのエディタでは頻繁に使用するコードのパターンを簡単に挿入できるスニペットという機能があり VSCode でも対応しています.しかし,Markdown では他の言語と同様の方法でスニペットを登録しても,編集中の候補として出てきません.
ここでは,Markdown でスニペットを利用できるようにする方法について書いていきます.
解決方法
settings.jsonに以下のコードを挿入します.
"[markdown]": {
"editor.quickSuggestions": {
"comments": "on",
"strings": "on",
"other": "on"
}
}
言語を指定する必要がなければこのようにしても良いです.
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": false
}
settings.jsonの開き方がわからない場合
この記事を参考にすると良いです.
settings.jsonへの挿入がわからないとき
この記事で json の書き方を把握すると良いです.
または以下を参考に
{
// いろいろ書いてある
ほげほげ, // なければ文末にカンマを挿入
"[markdown]": {
"editor.quickSuggestions": {
"comments": "on",
"strings": "on",
"other": "on"
}
}
}
例えばこんな感じ.
{
"editor.renderWhitespace": "all", // 半角スペースを可視化
"[markdown]": {
"editor.quickSuggestions": {
"comments": "on",
"strings": "on",
"other": "on"
}
}
}
設定が波カッコや角カッコの入れ子の場合もあります.
{
"[tex]": {
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.tabSize": 2
},
"[markdown]": {
"editor.quickSuggestions": {
"comments": "on",
"strings": "on",
"other": "on"
}
}
}