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 109937 - #{} autocomplete
Summary: #{} autocomplete
Status: NEW
Alias: None
Product: ruby
Classification: Unclassified
Component: Code Completion (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@ruby
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-17 00:55 UTC by jerrett
Modified: 2011-01-28 20:10 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jerrett 2007-07-17 00:55:38 UTC
The new #{} in a string autocomplete is *really* annoying, when you are trying to put # in there for some other reason


Perhaps modify it to autocomplete to trigger after #{ (add the }) .. 


or maybe have it look at the option for "Close braces automatically" (i have that disabled, but it still autocompletes #{})
Comment 1 jerrett 2007-07-17 00:57:21 UTC
I just noticed that even though i have "Insert closing brackets automatically" is disabled, it still inserts closing
brackets. 



I actually like it everywhere else though, just not with the #{} - and I would like it there too, if it was
automatically adding the closing bracket - instead of adding the opening AND closing bracket :)
Comment 2 Torbjorn Norbye 2007-07-17 04:32:16 UTC
I didn't realize the code wasn't hooked up to the editor-wide "insert matching bracket" setting, I'm fixing that now.

But regarding the "#{" behavior; this was added specifically beause TextMate users asked for it.  When I received this bug I forwarded it to the 
dev@ruby.netbeans.org alias and asked what TextMate is doing to avoid this feature getting in the way, and here are two comments I received:

"TextMate doesn't do anything special. I think it's just a matter of being aware of the interpolation context you're in. If I'm inside a double quoted string, I 
expect # to start an interpolation. If I want literal #'s, I use single quotes."

"I agree, it doesn't bother me in TM either, my brain is programmed to expect it.  Would sure be nice to keep it in, somehow.  Could you have an option for 
"turn on TextMate-style expansions"? :) "

The #{} expansion should only be kicking in in double-quoted strings (where #{} expressions are valid), and not in single-quoted strings. 
Is there a reason you're entering a lot of "#"'s in double quoted strings?  I'm just wondering what your use case is.  I can imagine people relying on #{} 
insertions a lot (e.g. to print out strings with embedded value substitutions).  Entering "#" as part of user output seems a lot less common, unless it's part 
of some common API (I remember BASIC used it in its formatting output API, similar to printf). 

In other words, is this biting you a lot, or is it pretty rare? If it's rare it might be worthwhile the additional productivity offered for the more common 
operation. But if this is really a conflict which happens a lot I'll need to think of some other solution. (I'd like to avoid options as much as possible.)
Comment 3 jerrett 2007-07-17 17:49:49 UTC
I've been doing a bunch of Hpricot stuff lately, which uses CSS selectors... @document.at("div#someid"). 


I suppose it's more likely that a # will be followed by {} than not, but it seems a bit odd to have it predict what I
might want. I'm used to auto-complete closing things that have to be closed, not opening and closing things that might
need to be there :)

If it auto-closed the } after you type #{ it would work more like autocomplete and less like magicks, but would still
give the added handy-ness. I agree with you though that trying to avoid more options is smart.

 
Anyway, food for thought - It's not occurring that often, it's just annoying when it does!
Comment 4 callagga 2007-07-29 11:13:03 UTC
Totally agreed/support this one
Comment 5 callagga 2007-07-29 22:50:52 UTC
whoops - I actually meant I like the auto-complete the way it apparently is (although I haven't seen this working yet).
 As a hobbyist programmer this make sense to me and suits my usage.  I'm assuming that it would only work within the
appropriate context, for example mainly in the case when you are quoting a string within an *.RHTML file.