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

More than 5 years have passed since last update.

PhpStormにGoogleMapAPIの補完機能を入れる

Posted at

概要

PhpStormにGoogleMapのスタブを読み込ませて、補完機能を有効にします。
快適なPhpStormライフを送るために。

手順

ライブラリをダウンロード。

以下のgoogle_maps_api_v3.js。バージョンについては後述。
https://github.com/google/closure-compiler/tree/master/contrib/externs/maps

読み込み

  • [PhpStorm] > [Preferences] > [Languages & Frameworks] > [Javascript] > [Libraries] > [Add]を選択。

  • 開いたウィンドウで左下の+をクリック。

  • [Attach Files]を選択し、ダウンロードしたファイルを選択すると以下の画面へ。
    スクリーンショット 2018-03-28 12.40.12.png

  • 以下の入力値を確認後、[OK]を押す。

    • Name: 適当に入力
    • Visibility: 現在のプロジェクトでのみ適用する場合はProjectを選択
  • 以下の状態で、Enabledにチェックが入っていればOK。
    スクリーンショット 2018-03-28 12.48.31.png

動作確認

before

スクリーンショット 2018-03-28 12.51.17.png

after

スクリーンショット 2018-03-28 12.51.34.png

補完もバッチリ。
スクリーンショット 2018-03-28 12.51.52.png

バージョンについて

以下のようにv=3としてリリースバージョンで利用している場合は手順でダウンロードしているファイルで問題ありません。
個別指定している場合は、対応バージョンのファイルをダウンロードしてください。

<script src="https://maps.googleapis.com/maps/api/js?v=3">

※リリースバージョン指定の場合、バージョンアップごとに取得されるファイルが変化するので、ライブラリの読み込みも都度落とし直してこないといけない点に注意してください。

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