你可以在 PhpStorm 中自定义 “新建文件” 菜单吗?

huangapple go评论51阅读模式
英文:

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.

你可以在 PhpStorm 中自定义 “新建文件” 菜单吗?

答案1

得分: 0

你知道你可以使用通用的 PHP 类 入口,只需更改对象的类型(因此文件模板也会更改)吗?在键入文件或类名时,只需使用<kbd>上箭头 / 下箭头</kbd>键即可:

你可以在 PhpStorm 中自定义 “新建文件” 菜单吗?
(绿色矩形区域是<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

以下是我的测试自定义文件模板:

你可以在 PhpStorm 中自定义 “新建文件” 菜单吗?

以及它们在该菜单中的显示方式:

你可以在 PhpStorm 中自定义 “新建文件” 菜单吗?


自定义此菜单(删除项目,更改它们的顺序)

目前还无法做到。 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:

你可以在 PhpStorm 中自定义 “新建文件” 菜单吗?
(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:

你可以在 PhpStorm 中自定义 “新建文件” 菜单吗?

And this is how they appear in that menu:

你可以在 PhpStorm 中自定义 “新建文件” 菜单吗?


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.

huangapple
  • 本文由 发表于 2023年2月6日 17:11:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/75359312.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定