NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Insert braces around a single Else line


Joined: 04 Apr 2017
Posts: 40
Reply with quote
Hi,

I'm trying to make some existing code more readable (to me). I don't like the ELSE part of an IF being followed by a single line without braces around the line.

Is there a way to highlight a line, and press a hot key that will enclose the line with opening and closing braces?


So, in other words an easy way to transform this:


else
$var = "what the...?"

into


else
{
$var = "what the...?"
}
View user's profileFind all posts by NSUserSend private message


Joined: 30 May 2006
Posts: 95
Reply with quote
I use autocorrection for such a case (Tools -> Settings -> Editor -> Autocorrection).
For example when writing translated strings I have defined autocorrection to replace "yiit" into "Yii::t('app', '');" - which works nicely.

However, you need multiline replacement, which is not supported ATM, only single line (build 19025).
Looks like potential feature request, which may take months, even years, if ever .. Smile
View user's profileFind all posts by lubosdzSend private message


Joined: 04 Apr 2017
Posts: 40
Reply with quote
Ok, thanks for the clarification, lubosdz.

lubosdz wrote:
I use autocorrection for such a case (Tools -> Settings -> Editor -> Autocorrection).
For example when writing translated strings I have defined autocorrection to replace "yiit" into "Yii::t('app', '');" - which works nicely.

However, you need multiline replacement, which is not supported ATM, only single line (build 19025).
Looks like potential feature request, which may take months, even years, if ever .. Smile
View user's profileFind all posts by NSUserSend private message
Insert braces around a single Else line
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic