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.

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

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP