LoginSignup
2
1

More than 1 year has passed since last update.

VSCodeのスニペットで意図しない空白が入る件について

Last updated at Posted at 2022-12-21

この記事はNTTコムウェア Advent Calendar 2022 22日目の記事です。

はじめに

これは私がVSCodeのスニペット機能を使っていておかしな挙動に遭遇した内容とその対処法について記載しています。
同じような挙動に遭遇した方がこの記事を見て問題解決してもらえると幸いです。

動作環境

VSCodeのバージョンは1.74.2です。

結論

As Is

=の右の空白が消える

VSCode_snippet_bug.gif

To Be

=の右の空白が消えない

VSCode_snippet_success.gif

原因

prefixの値に半角スペースが入っていること

python.json
{

	"input int":{
        "prefix":"input int",
		"body":"int(input())",
		"description":"input int",
	},
}

解決方法

prefixの値に半角スペースを入れない

python.json
{

	"input int":{
        "prefix":"input_int",
		"body":"int(input())",
		"description":"input int",
	},
}

おわりに

VSCodeのバグなのかなー。よくわかりませんが、これで解決です!

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1