duanputian5341 2015-01-07 13:18
浏览 156
已采纳

PHPStorm中的自定义宏

I don't mean the Macros in the sense of the 'Edit > Macros' menu option. When creating a new external tool (Preferences > Tools > External Tools), you can insert macros into the 'Program', 'Parameters', and 'Working Directory' fields. I'm curious if there is a way to either set up custom 'macros' here or to use environment variables as macros.

What I'm trying to do is build a set of external tools that relate to a specific script that runs. I want to be able to export these tools (through export preferences) and have everyone on my team import them without having to change the working directory or location of the program. I figured a nice way would be for everyone to set up a macro of the same name with their own custom location, or to set up an environment variable (of the same name with custom location) and just reference the same variable in every external tool. But I can't seem to find how to customize these.

If this isn't possible, but another way to go about achieving this is, please share!

Thanks in advance!

  • 写回答

1条回答 默认 最新

  • doukuilian8365 2015-01-07 15:09
    关注

    1. Nope -- custom macro have to be coded in Java as any other plugin

    2. You cannot reference environment variables via macro -- there is none for that

    3. I may only suggest to create a bunch of shell/batch scripts (that will actually do the job) and call them in External Tools.

    If you setup the same Path Variable (Settings | Build, Execution, Deployment | Path Variables) on all of such computers (for example: MY_TOOLS) then path to program used in External Tool will be stored using that path variable instead of full path, which allows you to have such scripts located on different folders on each computer (e.g. on one it could be C:\Tools, on another it could be D:\Projects\Tools and so on -- but in External Tools (inside, invisible to you) it will be stored as %MY_TOOLS%\script.cmd).

    P.S. Instead of (or better -- in addition to) using External Tools functionality you could look into build/automation tools that could be more suitable for such tasks (really depends on the actual task, actually): Phing, Gulp, Grunt -- PhpStorm has nice integration with them.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用