1
3

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 3 years have passed since last update.

VSCodeで設定しておくと便利なこと

Last updated at Posted at 2020-12-12

VSCodeの環境構築する上で、便利なことを色々調べたのでまとめてみます。

環境

MacOS Catalina 10.15.7

目次

[VSCodeダウンロード](# VSCodeダウンロード)
[設定を開く](# 設定を開く)
[1. 日本語化](#1. 日本語化)
[2. コード整形](#2. コード整形)
[3. エンコーディングを変更・自動判別](##3. エンコーディングを変更・自動判別)

VSCodeをダウンロード

  1. 公式サイトにいき、ダウンロードページからMac版をダウンロード
  2. ターミナルを使ってダウンロード(下記参照)
$ brew cask install visual-studio-code
Updating Homebrew...
(( 略 ))
==> Downloading https://update.code.visualstudio.com/1.51.1/darwin/stable
==> Downloading from https://az764295.vo.msecnd.net/stable/e5a624b788d92b8d34d13
######################################################################## 100.0%
==> Installing Cask visual-studio-code
==> Moving App 'Visual Studio Code.app' to '/Applications/Visual Studio Code.app
==> Linking Binary 'code' to '/usr/local/bin/code'.
🍺  visual-studio-code was successfully installed!

ダウンロードが完了!

設定を開く

(注)日本語になっているのは[1. 日本語化](##1. 日本語化)を参照

  1. Shift + Command / Ctrl + Pでコマンドパレットを開く。
  2. setting」と入力。候補にでてくるOpen User Settingsを選択。

左下、歯車アイコンから設定を選択することで開くこともできます。

1. 日本語化

メニューなどの表記が日本語になっているほうが、使いやすくなると思います。

拡張機能から日本語パックをインストール

(注)四角形で構成されているアイコンが「拡張機能」です。

  1. Extensionで「Japanese Language Pack for Visual Studio Code」と検索。
  2. [install]ボタン(緑色)をクリック。

日本語パックを反映する

  1. Shift + Command / Ctrl + Pでコマンドパレットを開く。
  2. config」と入力。候補にでてくるConfigure Display Languageを選択。
3. [**ja**]を選択。 4. 再起動を求められるので、再起動すると反映されます。

2. 自動コード整形

プログラミングで、コード整形を自動でしてくれると助かると思ったときに役立つ機能です。

  1. 設定を開く。
  2. [設定の検索]で「formatOn」と入力。出てくるFormat On Paste・Format On Saveの2つにチェックを付ける。
  • FormatOnPaste:コードをペーストしたときに整形します。
  • FormatOnSave:ファイルを保存するときに整形します。

3. エンコーディングを自動判別

VSCodeは、UTF-8でエンコーディングします。他の文字コードの場合、文字化けが発生してしまいます。
他の文字コードのファイルを読み込むときに、自動で判別し、エンコーディングするように設定してみましょう。

  1. 設定を開く。
  2. [設定の検索]で「file.auto」と入力。出てくるAuto Guess Encodingにチェックを付ける。
#### 参考 [VS Codeでエンコーディングを変更、自動判別するには](https://www.atmarkit.co.jp/ait/articles/1806/01/news051.html)

おわりに

他にも便利な機能があれば紹介していきたいと思います。
快適なVSCodeライフを送りましょう!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?