英文:
Can I customize the "New File" menu in PhpStorm?
问题
I would like to add some other options, like "PHP Enum" or "PHP Interface" directly to this menu. Also, I would like to put PHP-related options first. It is possible tu customize this in PhpStorm? I'm using last version (2022.3.2) with the new UI enabled.
I tried using Appearance & Behaviour -> Menus & Toolbars
but that didn't work for me.
英文:
I would like to add some other options, like "PHP Enum" or "PHP Interface" directly to this menu. Also, I would like to put PHP-related options first. It is possible tu customize this in PhpStorm? I'm using last version (2022.3.2) with the new UI enabled.
I tried using Appearance & Behaviour -> Menus & Toolbars
but that didn't work for me.
答案1
得分: 0
你知道你可以使用通用的 PHP 类 入口,只需更改对象的类型(因此文件模板也会更改)吗?在键入文件或类名时,只需使用<kbd>上箭头 / 下箭头</kbd>键即可:
(绿色矩形区域是<kbd>上</kbd> / <kbd>下</kbd>键将起作用的地方;红色矩形显示我的自定义文件模板)
附言:PHP Enums
的模板也在那里,只是该截图是在 PHP 8.0 语言级别的项目中拍摄的(需要 8.1 才能看到枚举)。
附言:在再次调用此对话框时,IDE 将记住上次使用的模板。
https://www.jetbrains.com/help/phpstorm/creating-php-classes.html
您可以通过在 Settings/Preferences | Editor | File and Code Templates
创建自定义文件模板来将新条目添加到此菜单中
https://www.jetbrains.com/help/phpstorm/settings-file-and-code-templates.html
以下是我的测试自定义文件模板:
以及它们在该菜单中的显示方式:
自定义此菜单(删除项目,更改它们的顺序)
目前还无法做到。 https://youtrack.jetbrains.com/issue/IDEA-143090 - 关注此问题(点赞/投票/评论)以获取任何进展。
英文:
Do you know that you can use the universal PHP Class entry and just change the type of the object (and therefore the file template) there? That can be done right away when typing the file or class name -- just use <kbd>Arrow Up / Down</kbd> keys:
(GREEN rectangle area is where that <kbd>Up</kbd> / <kbd>Down</kbd> key will work; RED rectangle shows my custom file templates)
P.S. The template for PHP Enums
is also there, it just the screenshot was taken in a project with PHP 8.0 language level (need 8.1 for enums to appear).
P.P.S. The IDE will remember the last used template when you invoke this dialog again.
https://www.jetbrains.com/help/phpstorm/creating-php-classes.html
You can add new entries to this menu by creating custom File Templates at Settings/Preferences | Editor | File and Code Templates
https://www.jetbrains.com/help/phpstorm/settings-file-and-code-templates.html
Here are my test custom file templates:
And this is how they appear in that menu:
Customizing this menu (removing items, changing their order)
This is not possible at the moment. https://youtrack.jetbrains.com/issue/IDEA-143090 -- watch this ticket (star/vote/comment) to get notified with any progress.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论