Please make sure you use Sublime 3 first:
- From the Sublime Tex Menu choose option About and make sure build is higher that 3xxx
- Navigate to your Sublime text packages directory: Sublime Text Menu > Preferences > Browse Packages...
- Copy
PHP
folder formCache
intoPackages
folder - Locate
PHP.tmLanguage
file insdePHP
folder and open in for edit: - Inside yuor
PHP.tmLanguage
find:<key>php_doc</key>
node and update the language file by adding the following snippet under the php_doc's patterns array:
<dict>
<key>match</key>
<string>\@(Route|Template|Method|ParamConverter|Cache)\b</string>
<key>name</key>
<string>keyword.other.symfonyannotations.php</string>
</dict>
Your PHP.tmLanguage file should look something like this:
<key>php_doc</key>
<dict
<key>patterns</key>
<array>
.
.
.
<dict>
<key>match</key>
<string>\@(Route|Template|Method|ParamConverter|Cache)\b</string>
<key>name</key>
<string>keyword.other.symfonyannotations.php</string>
</dict>
<dict>
<key>match</key>
<string>\@(Assert)\b</string>
<key>name</key>
<string>keyword.other.symfonyassertannotations.php</string>
</dict>
<dict>
<key>match</key>
<string>\@(ORM)\b</string>
<key>name</key>
<string>keyword.other.doctrineannotations.php</string>
</dict>
<dict>
<key>match</key>
<string>\@(Secure)\b</string>
<key>name</key>
<string>keyword.other.jmssecurityannotations.php</string>
</dict>
</array>
</dict>
Updating the theme files to highlight the annotations
Update your current colour theme file to include the following styles, feel free to change the highlight colour to match your theme if required:
- Copy
Color Scheme - Default
folder formCache
intoPackages
folder and edit the Theme you use (for example: Monokai.tmTheme): - Add followign snipped:
<dict>
<key>name</key>
<string>PHP: Symfony Annotations</string>
<key>scope</key>
<string>keyword.other.symfonyannotations.php</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#EE8709</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>PHP: Doctrine Annotations</string>
<key>scope</key>
<string>keyword.other.symfonyassertannotations.php</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#ede62a</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>PHP: Doctrine Annotations</string>
<key>scope</key>
<string>keyword.other.doctrineannotations.php</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#35D693</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>PHP: JMS Security Annotations</string>
<key>scope</key>
<string>keyword.other.jmssecurityannotations.php</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#1ec932</string>
</dict>
</dict>