3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VSCodeで一瞬でSOME_VARをsome_varに変換したい

Posted at

はじめに

変数や関数名といった識別子を、別の命名規則のものに置き換えたくなる時があると思います。
そういった時のために、VSCodeには識別子を特定の命名規則のものに変換する機能があります。

そもそも命名規則とは? "snake_case"や"camelCase"のように、単語の区切りに"_"を使ったり語頭を大文字にしたりといった、識別子の名付けに関する取り決めのことです。

詳しくは以下の記事を参考にしてみてください。
https://qiita.com/shota0616/items/4ac7a8696b3f6ccbe2bc

方法

まず、変換したい識別子を選択します。
image.png

そして、コマンドパレット(⇧⌘P)から、"transf"で検索し、目的の変換を選択します。

image.png

たったのこれだけで、識別子が一括で変換されます。

image.png

上の画像にある通り、全部で7種類の変換が用意されているようです。

おまけ

よく使う変換はショートカットに登録しておくと便利です。
コマンドパレットの右側に表示される歯車、あるいは直接キーボードショートカット(⌘K⌘S)から変更できます。

image.png

image.png

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?