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 114928 - bad selection after inserting template
Summary: bad selection after inserting template
Status: RESOLVED INVALID
Alias: None
Product: ruby
Classification: Unclassified
Component: Editing (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Erno Mononen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-06 17:48 UTC by jamespb
Modified: 2009-09-17 17:44 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
user directory (2.49 MB, application/octet-stream)
2007-09-06 21:13 UTC, jamespb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jamespb 2007-09-06 17:48:47 UTC
Define a template 'dc' with:

  # ${cursor}
  #
  # Takes:
  #   ${0 default=":foo"} => {$1 default="description"}
  #   
  # Returns:
  # 
  #   ${3}
  #   
  # See also:
  # 
  # ${4}


type dc<tab>, and 'o =>' is selected, and the tab stops are also in the wrong places.


Product Version: NetBeans Ruby IDE 070906 Java: 1.6.0_01; Java HotSpot(TM) Client VM 1.6.0_01-b06 System: Windows Vista
version 6.0 running on x86; Cp1252; en_US (nbrubyide) Userdir: C:\Users\James\AppData\Roaming\.nbrubyide\dev
Comment 1 Torbjorn Norbye 2007-09-06 18:16:39 UTC
I don't see the same behavior.  When I entered that template and expanded it, for me, I get ":foo" as selected, and I
can tab through the different tabstops. (P.S. If you intended ${3} and ${4} to just be tabstops instead of containing
"3" and "4", you can use ${3 default=""} ).

However, I've seen some lexing problems as of yesterday (and filed issue 114836); several RHTML formatting tests are
failing. I wonder if this is another symptom.
Comment 2 jamespb 2007-09-06 19:28:53 UTC
Weird that it doesn't repro for you.  I just tried it in a empty file (thinking it might have been context-dependent)
and got the reported behavior.  Sounds like I should just try it again when the other lexing problems are fixed.

Yeah, the ${3} and ${4} were pretty useless; I was playing with variable substitution and hadn't quite figured it out.
Comment 3 Torbjorn Norbye 2007-09-06 20:47:56 UTC
I discovered what the lexer issue was an that's RHTML specific, so wouldn't explain this.

But in trying to reproduce it I ran into what is possibly a different bug, or possibly related. I filed a new issue for
it, issue 114942.)

Also, can you attach your

{userdir} / config/Editors/text/x-ruby/CodeTemplates/org-netbeans-modules-editor-settings-CustomCodeTemplates.xml

file such that I can take a look at it and reproduce it with your template? 

Alternatively, -my- dc template definition in that file looks like this:

    <codetemplate abbreviation="dc" xml:space="preserve">
        <code>  # ${cursor}
  #
  # Takes:
  #   ${0 default=":foo"} =&gt; {$1 default="description"}
  #   
  # Returns:
  # 
  #   ${3}
  #   
  # See also:
  # 
  # ${4}
</code>
    </codetemplate>

Is yours the same?
Comment 4 jamespb 2007-09-06 21:13:24 UTC
Created attachment 48324 [details]
user directory
Comment 5 jamespb 2007-09-06 21:23:27 UTC
I included my entire userdir.

Once this happens, NetBeans editing seems to be in a weird state.  I've seen:

- unable to save any files
- cut looks like it just turns the selected text to spaces; it doesn't adjust the rest of the text in the file
- ctrl-shift-end goes to the end of the file, but beeps and I see this status msg in the bottom left corner:

Cannot initialize code templates while scanning in process.
Comment 6 jamespb 2007-10-16 19:39:30 UTC
FYI, you can repro this with one of the default templates - 'begin' has weird behavior tabbing through the arguments. 
Just create a new method, type in 'begin<tab>'.


Product Version: NetBeans Ruby IDE 20071016112612
Java: 1.6.0_01; Java HotSpot(TM) Client VM 1.6.0_01-b06
System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nbrubyide)
Userdir: C:\Users\James\AppData\Roaming\.nbrubyide\dev
Comment 7 Erno Mononen 2009-03-12 14:35:25 UTC
Is this still reproducible for you in 6.7 M2? I'm not able reproduce.
Comment 8 jamespb 2009-03-12 16:22:46 UTC
FYI, I haven't written any Ruby for quite a while - I'm unlikely to install a new NetBeans any time soon, sorry.
Comment 9 Erno Mononen 2009-03-12 16:35:07 UTC
Sorry to hear that, you'll be missed in the NB Ruby community - hope you'll get back to Ruby and NB some day.
Comment 10 Tomas Danek 2009-09-17 17:44:47 UTC
Without requested information for long time - INVALID. We can't do anything in this case. Reporter, please add requested
information and reopen issue. Thanks in advance.