This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 188774 - Please do not auto-complete my quotes
Summary: Please do not auto-complete my quotes
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal with 11 votes (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
: 207151 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-20 00:35 UTC by karmaflute
Modified: 2015-09-24 14:56 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
no quote option (104.96 KB, image/png)
2012-08-19 23:58 UTC, skydiver
Details

Note You need to log in before you can comment on or make changes to this bug.
Description karmaflute 2010-07-20 00:35:04 UTC
Take this code for example:

if (!$value == "2')

Ok, I want to replace the single quote with a double quote. So I highlight the single quote and when I type a double quote I get this:

if (!$value == "2"'")

Another case. I have the following code:

if (!$value == 2)

I want to replace the "2" with some string. So I highlight the "2" and type a double quote hoping to replace my selection with the new character. But no.. it surrounds my selection with quotes instead:

if (!$value == "2")

Please. Don't. Do. That.

I'm perfectly capable of deciding when and where to insert my own quotes without the IDE doing it for me.
Comment 1 skadamson 2010-08-27 20:50:27 UTC
Seconded. This is extremely frustrating behavior. I don't want the quotes to wrap the highlighted text. I want the stuff I am typing to replace the highlighted text, every time.

This happens to me multiple times a day:

Code is 
echo $str;

I decide I would rather echo a literal 'string' instead. I double-click on "$str" and start typing. What I get is:

echo '$str'string' 

Can we please have an option to turn this behavior off!
Comment 2 codeslinger_compsalot 2010-09-08 20:08:16 UTC
This is an edge case, in some scenarios this behavior is useful.

However, I agree with the others, in the vast majority of normal use scenarios the default behavior is very annoying.  it forces people to relearn a new way of dealing with selected text that is contrary to how 98% of the other editor software out there works.
Comment 3 karmaflute 2010-09-09 00:45:19 UTC
I found out that this can be disabled by unchecking the box for Tools -> Options -> Editor -> Code Completion -> Insert Closing Brackets Automatically.

However.. I like having closing brackets inserted automatically. Well, actually, I don't. I hate it. But NetBeans insists on automatically indenting after I make an opening bracket. So I have to hit backspace three times (tabs are three spaces), insert the closing bracket, up-arrow, end-key, then hit enter, every time I close the bracket and get back to the indent.

Pain in the neck.

But if I enabled it then NetBeans would insist on completing other things besides closing brackets which make programming even more unpleasant. So, closing brackets off. It's the lesser of two evils..

Oh, and when programming HTML in a .php document NetBeans still autocompletes quotes/dquotes.. even with auto-closing brackets disabled.

The only reason I'm still using NetBeans is because I haven't found anything I like better. Finding an IDE you can get comfortable with is hard. Sometimes it's more like deciding which one you dislike the least.
Comment 4 skadamson 2010-09-09 22:34:36 UTC
Thank you! I can confirm that unchecking the box "Insert Closing Brackets Automatically" stops the described behavior in single quote / double quote / slash on highlighted text.

Personally, I do like the automatic adding of brackets enough to live with the quote behavior, unfortunately. That in addition to the fact that there would be no way whatsoever to guess that behavior based on the name of the option (having nothing to do with brackets) leads me to conclude that this should remain an issue worth addressing. (Ideally, have a distinct selectable option)

For your issue, I think selecting "HTML" in the Language pull down in the same tab (Code Completion) I see two options which might yield a solution to your issue.
Comment 5 karmaflute 2010-09-10 02:00:57 UTC
"For your issue, I think selecting "HTML" in the Language pull down in the same
tab (Code Completion) I see two options which might yield a solution to your
issue."

Thank you! This does stop NetBeans from autocompleting quotes in HTML. But sadly there is no option for this in the settings for C++, Java, or PHP.
Comment 6 Filip Zamboj 2010-09-15 12:32:38 UTC
batch reassigning
Comment 7 zombat 2010-12-30 01:20:11 UTC
I would dearly love to see this fixed as well.

I can't think of a "normal" use case for this feature that justifies overriding the expected behaviour of highlighting something and then starting to type (ie. deleting whatever you have highlighted and replacing it with the typed quote character).  Are there a lot of languages where you would type a lot of unquoted strings, then go back later and double-click them all to highlight and type a quote?  It seems better suited to a Source menu option, similiar to "Remove trailing spaces".  There could be a "Quote selection" option with a CTRL-key shortcut that would do the same thing.  Anyone needing to go through their code and surround things with quotes could easily do so using the mouse and the CTRL-key combination.

This is probably related to Bug 188189.  Perhaps smart-quote options could be grouped somewhere in the settings, and toggled selectively.
Comment 8 hodge 2011-06-07 13:00:44 UTC
I agree that this should be an individually selectable option.  This issue is assigned to the php "product" but it should be fixed for Java as well.
Comment 9 unai 2011-07-28 21:34:20 UTC
(In reply to comment #8)
> I agree that this should be an individually selectable option.  This issue is
> assigned to the php "product" but it should be fixed for Java as well.

I second that!
Comment 10 Petr Pisl 2011-10-14 09:44:57 UTC
Will be change in the next release.
Comment 11 Marian Mirilovic 2012-02-23 08:56:02 UTC
10 votes ... P2
Comment 12 Ondrej Brejla 2012-03-21 14:05:34 UTC
Fixed in web-main: http://hg.netbeans.org/web-main/rev/10fd5688dc66

(Tools -> Options -> Editor -> Code Completion -> PHP -> Smart Quotes Completion)
Comment 13 Quality Engineering 2012-03-22 11:13:36 UTC
Integrated into 'main-golden', will be available in build *201203220400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/10fd5688dc66
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #188774 - Please do not auto-complete my quotes
Comment 14 Ondrej Brejla 2012-03-26 09:15:54 UTC
*** Bug 207151 has been marked as a duplicate of this bug. ***
Comment 15 skydiver 2012-08-19 23:58:22 UTC
Created attachment 123292 [details]
no quote option
Comment 16 skydiver 2012-08-20 00:01:57 UTC
(In reply to comment #12)
> Fixed in web-main: http://hg.netbeans.org/web-main/rev/10fd5688dc66
> 
> (Tools -> Options -> Editor -> Code Completion -> PHP -> Smart Quotes
> Completion)

NetBeans IDE 7.1.2 (Build 201204101705)
The quotes option is nowhere to be found (screenshot attached in a different post).
Comment 17 Ondrej Brejla 2012-08-20 07:32:04 UTC
Target milestone is 7.2...not 7.1.2.
Comment 18 joey33 2012-09-04 05:02:50 UTC
BRING IT BACK, pls.

It cuts both ways, 7.2 doesn't wrap selection with quotes but at the same time it doesn't wrap selection with brackets, be it suare, curly or paranthesis.

I've upgraded to 7.2 and spent an hour searching for a way to have it working.

It was a bliss to me - can't NB have it as an option? I got used to that in 7.0 and 7.1 and 7.2RC so much and found it a surpassing feature over other editors.

Take for example a block of code which you decide to put in an IF block, - > you could select it, press opening paranthesis and magic happened, the whole block was wrapped. Now it's gone.
Comment 19 joey33 2012-09-04 05:09:52 UTC
(In reply to comment #18)
> BRING IT BACK, pls.
> 
> It cuts both ways, 7.2 doesn't wrap selection with quotes but at the same time
> it doesn't wrap selection with brackets, be it suare, curly or paranthesis.
> 
> I've upgraded to 7.2 and spent an hour searching for a way to have it working.
> 
> It was a bliss to me - can't NB have it as an option? I got used to that in 7.0
> and 7.1 and 7.2RC so much and found it a surpassing feature over other editors.
> 
> Take for example a block of code which you decide to put in an IF block, - >
> you could select it, press opening paranthesis and magic happened, the whole
> block was wrapped. Now it's gone.

IT works!

Had to relaunch NB. 

Checking/unchecking 'smart code completion' in code formatting->php worked only for closing brackets when applying changes live. After relaunch it wraps selection with brackets, quotes etc. again:)
Comment 20 dphizler 2015-09-24 14:56:17 UTC
I created an account simply to say that the solutions mentionned here did not work for me.

If I happen to start my code with the wrong type of quotes, there is nothing I can do, I must retardedly copy my code to Notepad++ because your product sucks.