PHP アプリケーション開発のために Eclipse に入れてるプラグインと設定。 その2
第一弾はこちら
PHP アプリケーション開発のために Eclipse に入れてるプラグインと設定。ちょっと今の環境が変わったので再度まとめてみる。
Eclipse 本体 [link]
Eclipse 4.2.2 をチョイス。パフォーマンス向上、様々なバグが修正されてるようです。ただし後述する Eclipse 3.8.x にあった個人的にはスーパー便利機能がなくなってしまっています。まあ代替案はありますがとっても残念。ダウンロード
Eclipse Downloads http://www.eclipse.org/downloads/ から Eclipse Classic をダウンロードします。ぼくは Mac ですが、~/Applications/eclipse-pdt として展開します。本体更新
Help -> Install New Software...Work with: The Eclipse Project Updates - http://download.eclipse.org/eclipse/updates/4.2
Select All ボタンで全部選択し。Hide items that are already installed チェックボックスでインストール済のものをスキップさせます。(Eclipse RPC でなんかエラーか文句言われる)
Juno の更新サイトからインストール
PHP Development Tools (PDT) Feature ってのがあるんですが、3.1.1 でバージョンが低いです。更新もできないので Feature の方を入れてしまったら、一旦削除して Feature 無しの方を入れましょう。Help -> Install New Software...
Work with: Juno - http://download.eclipse.org/release/juno
Collaboration
Eclipse EGit
Eclipse EGit Mylyn GitHub Feature
EGit Mylyn
EGit Plug-in Import Support
Git Team Provider Core
Mylyn Builds Connector: Hudson/Jenkins
Mylyn Context Connector: Team Support
Mylyn TaskList
Mylyn Task-Focused Interface
Mylyn Versions Connector: Git
Mylyn WikiText
General Purpose Tools
Marketplace Client
Web, XML, Java EE and OSGi Enterprise Development
Eclipse Web Developer Tools
Eclipse XML Editors and Tools
JavaScript Developpent Tools
PHP Development Tools (PDT)
Web Page Editor
AnyEdit tools plugin for Eclipse [link]
Help -> Install New Software...
Work with: http://andrei.gmxhome.de/eclipse/
Eclipse 3.5 - 4.2 plugins
AnyEditTools
QuickREx [link]
正規表現をチェックできるプラグイン。
Help -> Install New Software...
Work with: http://www.bastian-bergerhoff.com/eclipse/features
QuickREx
QuickREx
QuickREx_I18N
Eclipse Color Theme [link]
Help -> Eclipse Marketplace...
Find: Eclipse Color Theme
言わずもがなカラーテーマ設定プラグイン。Eclipse Color Themeshttp://eclipsecolorthemes.org/ から好きなテーマをダウンロードしましょう。
MakeGood [link]
Help -> Eclipse Marketplace...
Find: MakeGood
MakeGood は Eclipse PDT 上でユニットテストを実行するための継続的テストランナーです。とあります。テストを書くならこれですね。なにげにこれを入れると、日本語メソッドがかけるようになります。
pdt_tools.formatter [link]
なんていうかすごいこれ。PDT のコードフォーマッタは有ってないようなものだっなんですが、このフォーマッタは細かい設定までできむしろこれ PDT に入れていいんじゃないか?というぐらい。漏れそうなくらい大変助かります。作られてる方のブログ?昔から PDT の情報いっぱい。 Dead Zone
SOURCEFORGE.jp から ダウンロード -> (root) -> juno -> pdt_tools.formatter_xxxxx.zip をダウンロードする。
Help -> Install New Software...
Add... -> Archive... -> pdt_tools.formatter_xxxxx.zip
PDT Tools
PDT Tools: Formatter
PDT Tools: Formatter 日本語ヘルプ
設定
General✓ Show heap status
Appearance
Color Theme
好きなのを選択。僕は Solarized Dark を Import してます。
Colors and Fonts
Basic
Text Editor Block Selection Font
Text Font
好きなフォントに変更。僕は Ricty Diminished Discord. すばらしい。
Content Types
Text
PHP Content Type
CakePHP 使いたいので、 *.ctp を追加。
Editors
AnyEdit Tools
Auto - Convert
✓ Convert tabs <-> spaces
✓ Tabs to spaces
Convert...
Tab width/number of spaces for tab : 4 に変更。
Text Editors
Undo history size: 1000
✓ Insert spaces for tabs
✓ Show print margin
Print margin column: 100
✓ Show line numbers
✓ Show whitespace characters
configure visibility
Transparency level: 70
Spelling
□Enable spell checking (Off にする)
Keys
Name: New Editor
Binding: ^N (control + n)
When: In Windows
Web Browser
✓Use external web browser
Workspace
Text file encoding
Other: UTF-8
JavaScript
Appearance
✓ Show inferred function return types
✓ Show colored labels
Editor
Content Assist
Auto-Activation
Auto activation delay: 0
Auto activation triggers for javascript: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0987654321.
PHP
Appearance
✓ Show method return types
Code Style
Formatter (PDT Tools)
[編集]
プロファイル名: Eclipse [built-in] - custom
インデント
一般設定
タブポリシー: スペース
インデント
✓ 'switch' 内
波括弧
括弧の位置
名前空間: 次の行に
クラス・インターフェイス: 次の行に
関数・メソッド: 次の行に
空白行 (ここはお好みで?)
クラス定義の前: 1
関数定義の前: 1
折り返し
一般
一行の最大幅: 100
Editor
Content Assist
Auto Activation
Auto activation delay: 0
PHP Manual
New
Name PHP.net ja
Remote Site: http://www.php.net/manual/ja
Default
Team
Git
Label Decorations
Text Decorations
Projects: {dirty:>} {name} [{branch}{ branch_status}]
Web
CSS Files
Encoding: ISO 1-646/Unicode(UTF-8)
Editor
Formatting
Line width: 100
✓ Indent using spaces
Indentation size: 2
Capitalization style
Identifier:
✓ Lowercase
HTML Files
Encoding: ISO 1-646/Unicode(UTF-8)
Editor
Formatting
Line width: 100
✓ Indent using spaces
Indentation size: 2
XML
XML Files
Editor
Formatting
Line width: 100
✓ Indent using spaces
Indentation size: 2
パースペクティブ
Window -> Close All Perspectives
Window -> Open Perspective -> Other -> PHP
右上の PHP パースペクティブアイコンのコンテクストメニュー -> Show Text のチェックを外す。
Window -> Customize Perspective
Command Groups Availability
✓ Git
✓ Git Navigation Actions
ツールバーをグリグリ動かして、好きなポジションにしてくだい。
PHP Explorer -> ▼(下三角のメニュー) -> Filters
□ .* resources のチェックを外す。
✓ Name Filter patterns
.settings, .project, .classpath, .buildpath DS_Store, Thumbs.db
起動オプション
もちょっとメモリの割当増やしてあげましょう。Eclipse を終了します。Eclipse.app のコンテキストメニュー -> パッケージの内容を表示
Contents -> MacOS -> eclipse.ini
--launcher.XXMaxPermSizeとか。もっとメモリ潤沢にある人はガッツリ増やしたらいいと思うよ。
256m
-Xms256m
-Xmx1g
長い
こんなかんじかなぁと。Window -> Customize Perspective で PHP パースペクティブのカスタムをもっとごりごりすると吉。ここらへんって好みがあるから自分好みにすればいいと思うよ。
今回は MakeGood を入れたこと、なにより pdt_tools.formatter を入れたことが大きい。フォーマットを決めとけば command + Shift + f で一発修正。素晴らしい。フォーマットは PSR に合わせたり、PEAR とか zend とかに合わせたらいいと思うよ。
こんな設定項目多いからこれから IDE で PHP 始めるのは PhpStorm がいいのかも。まあ無料だし、育てるのもいいんじゃないのかいな。
テストの実行とか設定なんかは今回書いていない。自分の中でまとまったらもう一度まとめようと思います。
おまけ
Eclipse 3.8.x にあった個人的にはスーパー便利機能
最初のほうで書いた。
エディタタブのコンテキストメニューが 4.x 系だとなくなっている。ここから New Editor を選択して同じファイルをもう一個のエディタで開いて、タブを掴んで横にずらすなどして、画面分割的な使い方をしていた。これなんだろうなー。残念。あとタブのダブルクリックでその View を最大化してくれたんだけど、それもなくなった。残念無念。なのでその2つはキーボードショートカットで
New Editor は さっき追加で設定した [control + n] ここもお好みで。
エディタの最大化は [control + m] でできる。設定は Maximize Active View or Editor のところ で変更できるのだ。
花粉にやられてどっこいしょ。