NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
feature req: a smarter auto-close brackets and quotes ??


Joined: 14 Sep 2006
Posts: 9
Reply with quote
Hi!

i must say PhpEd is THE best IDE for PHP right now!

keep up the good work guys!!!!

also i have a feature request: please read this its important:

when i type and opening round bracket '(' , the editor automatically closes it with ')'
and that is totally ok, unless i type first some text and i want to enclose it in round brackets:

for example if i type a text:

string

and i want to enclose it in round brackets (or quotes), if i put cursor in front of first char 's' and type opening round bracket, editor automatically adds a closing bracket like this:
()string
and this is not logical thing to do (at least its not a good for me).

i would like an option in settings that says
AUTO CLOSE BRACKETS/QUOTES IN FRONT OF TEXT [YES][NO]

so if switch this off, and type text, and type opening bracket in front of first char of text, editor would not close it:

(string

then i can go to the end of string and type closing bracket manually.

or MAYBE editor can automatically add closing bracket at the end of that string like this:

(string)

the same goes with the quotes and single quotes (") (') and (`)

if i type it in front of first character of some text, then editor should not close it automatically, and if there is no text in front of it, then it should be closed automatically by the editor (current way of things).

this behaviour could be changed in settings for example...

i hope i managed to explain this, im sure that lots of people find this anoying...

what do you gouys think of this idea???

thanks,
Slobodan Pavkov
View user's profileFind all posts by spavkovSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
what if we implement it a bit differently? Suppose you have a string and want to surround it by quotes or brackets, you'll select it and press opening bracket or quote to achieve that. Would this satisfy you? Smile
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Sep 2006
Posts: 9
Reply with quote
Hi!

first of all thanks for prompt reply!

the solution you suggested is good , and it should exist too.

BUT: this demands a user to use the mouse, and if you are a programmer, you know how lazy programmers
are to move fingers from keyboard to the mouse...

i like to do as much as possible ONLY with the keys, without the mouse...

call me mad, but this is faster and easier... once you learn all the shortcuts Smile

but if only i am like this, it would not be an issue, but i bet that many PHP programmers are like that...

its really annoying to do this thing over and over: type some code, then i want to enclose it in brackets, (or quotes)
and then i go to the beginning of that text, type opening bracket/quote, and editor inserts a closing one !!!
then i delete this closing one, and go to the end of the text and type the closing bracket/quote by myself...

i do this hundreds of times a day, believe me.

and if i switch to DO NOT CLOSE BRACKETS/QUOTES in settings, then i miss this when i do not want to enclose text...

so its a case of: you cant live with it, and you cant live without it Smile

so please reconsider this...

as i said: your solution is great and implement it too, but consider a solution without using a mouse !!!

tnx,
Slobo
View user's profileFind all posts by spavkovSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
btw you can select text without mouse actually, Ctrl+Shift+right arrow works quite good.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Sep 2006
Posts: 9
Reply with quote
You are right about that shortcut, but its still more buttons to press...

computers should work for humans, not vice versa Smile

its much easier that computer 'decides' when it should auto-close brackets/quotes, and when it should not do it.

if you would put some logic in there it would help.

Why pressing Ctrl-Shift-Right when computer can do that for you Smile

?

Regards
Slobo
View user's profileFind all posts by spavkovSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Yet, "computer" can't decide where the string ends.
Suppose I have
if ($a == some strange text here && $b) {
}
and cursor is just left to word "some" and you enter quotation mark. Where would computer place closing quotation mark? After "some"? After "here"? After $b?
How would it make a proper decision?
What if text is like below?

if (
$a
==
some
strange
text
here
&&
$b
) {

}
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Sep 2006
Posts: 9
Reply with quote
I Agree its a tough one.

i was thinking about this also, there are few possible answers...

1. editor can put closing bracket/quote after the last non-space character in the line, like this:
if i type:
$var1 == 10

and later I add opening bracket in front of $var1 like this:
($var1 == 10
then editor can be 'smart' and add closing bracket after the last non-space character in that line:
($var1 == 10)

(this is the best solution i could find so far).

2. editor can be 'smart' and auto-close brackets/quotes ONLY if there is NO TEXT in front of the opening bracket.
- if there is no text => close bracket/quote
- if there is a text there, dont close it

so if there is a text:
$var1 == 10
and later I add opening bracket in front of $var1 like this:
($var1 == 10
then editor can be 'smart' and dont do nothing (do not auto-close bracket).

then i can go to the end of that line with END key and close bracket by myself.
(this way i would not have to first delete the one that editor created, and then create my own, at the end of line.


both solutions are usefull and could be implemented easily...
all this behaviour could be configured with settings to meet the users desires.

DONT AUTO CLOSE BRACKETS/QUOTES WHEN THERE IS TEXT AFTER OPENING BRACKET [ ]

or

PUT AUTO-CLOSING BRACKET/QUOTE AT THE END OF THE CURRENT LINE [ ]

and also if user do not want this 'smart' auto-close he/she can switch off this settings checkboxes, right? Smile

i hope you will find this satisfactory Smile

let me know what you think...

tnx
Slobo
View user's profileFind all posts by spavkovSend private message
feature req: a smarter auto-close brackets and quotes ??
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