2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【ちょっと便利な小技_part 7】 Snippetでファイル名に合わせたクラス名を表示させよう

Last updated at Posted at 2023-09-05

今回は前回の記事【ちょっと便利な小技_part 6】VSCodeのカスタムSnippet編の内容を応用したものとなります。
なので、Snippetの利用方法はわかっている前提で進めるので、わからない人は前回の記事を見てください。
これでは始めます。
今回はSnippetを使って楽にファイル名に合わせたクラス名をつける方法を紹介します。
めちゃくちゃ簡単ですぐに終わります。
是非、試してみてください

実装方法

まずdart.jsonに下記のコードを追加します。
これでもうOKです。
あとは使うだけ!

dart.json
"Class name": {
		"prefix": "Class name",
		"body": [
			"${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}",
		],
		"description": "Class name",
	},

結果

もし、test_class_name.dartというファイル内でしようした場合
TestClassNameとなります!

2
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?