To prioritize your Live Templates over the built-in suggestions in PhpStorm, you can adjust the settings to make your custom templates more prominent. While there isn't a direct "Prioritize Live Templates" setting, you can achieve this by tweaking the code completion settings and using a few tricks. Here's how you can do it:
-
Adjust Live Template Abbreviations:
- Make sure your Live Template abbreviations are unique and not conflicting with common code snippets or keywords. This will help PhpStorm recognize them more easily.
-
Use the
TabKey for Live Templates:- By default, PhpStorm uses the
Tabkey to expand Live Templates. This can help you quickly insert your templates without relying on the autocomplete suggestions.
- By default, PhpStorm uses the
-
Reorder Completion Suggestions:
- While you can't directly prioritize Live Templates, you can influence the order of suggestions by adjusting the settings for code completion.
Here are the steps to adjust the code completion settings:
-
Open Settings:
- Go to
File > Settings(orPhpStorm > Preferenceson macOS).
- Go to
-
Navigate to Code Completion:
- Go to
Editor > General > Code Completion.
- Go to
-
Adjust Completion Settings:
- Under the
Code Completionsection, you can adjust the settings to influence the order of suggestions. For example, you can enable or disable certain types of suggestions to reduce clutter and make your Live Templates more prominent.
- Under the
-
Use Live Template Prefixes:
- You can use specific prefixes for your Live Templates to make them stand out. For example, if you prefix all your templates with
lt_, typinglt_will bring up all your Live Templates first.
- You can use specific prefixes for your Live Templates to make them stand out. For example, if you prefix all your templates with
Here is an example of how you can create a unique Live Template:
// Example Live Template
// Abbreviation: lt_mytemplate
// Template Text:
function ${NAME}(${PARAMS}) {
${BODY}
}
When you type lt_mytemplate and press Tab, PhpStorm will expand this template.
By following these steps, you can make your Live Templates more accessible and reduce conflicts with built-in suggestions. While it may not be a perfect solution, it should help you prioritize your custom templates effectively.