[英]Shortcut/feature for prepending $this automatically in Intellij/Phpstorm
Is it possible/does such feature exist that when I write an instance variable name (without $this->) it would search for a declared variable? 是否存在/是否存在这样的功能,即当我编写实例变量名称(不带$ this->)时,它会搜索已声明的变量吗? I think it would save a bit of time not writing $this-> anytime I need to access an instance variable.
我认为在我需要访问实例变量时不写$ this->会节省一些时间。
Currently such functionality is not available in PhpStorm. 目前,PhpStorm中不提供此类功能。
https://youtrack.jetbrains.com/issue/WI-19345 -- watch this ticket (star/vote/comment) to get notified on progress. https://youtrack.jetbrains.com/issue/WI-19345-观看这张票(star / vote / comment)以获取进度通知。
Right now I may only suggest to write custom Live Template that would convert t[TAB]
(or whatever abbreviation you desire) to $this->
with code completion popup already shown. 现在,我可能只建议编写自定义实时模板 ,该模板会将
t[TAB]
(或您想要的任何缩写)转换为$this->
并且已经显示了代码完成弹出窗口。
Related: https://youtrack.jetbrains.com/issue/WI-551 相关: https : //youtrack.jetbrains.com/issue/WI-551
If all you need is save yourself the trouble of writing $this->
, join the club. 如果您所需
$this->
就是省去编写$this->
的麻烦,请加入该俱乐部。 :) Macros are here for rescue. :)宏在此处用于救援。
I solved this problem by recording a Macro and then binding it with a keyboard shortcut: 我通过录制宏,然后使用键盘快捷键将其绑定来解决此问题:
I chose Ctrl+.
我选择了
Ctrl+.
as the shortcut and now I am more than happy. 作为捷径,现在我很高兴。 :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.