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 104177 - Instant rename does not appear to work
Summary: Instant rename does not appear to work
Status: RESOLVED WORKSFORME
Alias: None
Product: ruby
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: Macintosh Mac OS X
: P2 blocker (vote)
Assignee: Torbjorn Norbye
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-17 14:58 UTC by Gregory Murphy
Modified: 2007-07-03 14:46 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gregory Murphy 2007-05-17 14:58:53 UTC
Using NB 6 M9, and Ruby Editing plugin v 0.62

Invoking instant rename (command - 'r') results in the error message "Cannot
perform instant rename here", in every context that I can think of: over local,
instance, and global variables, both where they are declared and where they are
used. Either I don't understand this feature, or it isn't working.
Comment 1 Torbjorn Norbye 2007-05-17 23:56:58 UTC
This works for me. Can you isolate this down to a simple scenario where I can reproduce it?

It works only for local variables, parameters and dynamic variables.

For example:


def (foo)
    print foo
    bar = 5
    print bar
    [1,2,3].each { |baz| 
        print baz
    }
end

In the above, you should be able to instant rename foo, bar and baz - any reference to them (e.g. both 
"declaration" and usage.)
Comment 2 Gregory Murphy 2007-05-18 22:42:04 UTC
I create a new Ruby Application project. I remove all code from main.rb, and
then paste in:

def (foo)
    print foo
    bar = 5
    print bar
    [1,2,3].each { |baz| 
        print baz
    }
end

I save the file, and the cursor over 'foo', 'bar', and 'baz', both decl and
reference, and in all six cases, typing command + r results in the "Cannot
perform instance rename". 
Comment 3 Torbjorn Norbye 2007-05-22 01:16:41 UTC
Sorry, there was an error in my example (I typed code into issuezilla, I didn't cut & paste).  It's missing a 
function name; replace

def (foo)

with

def bar(foo)

At this point, does instant renaming work? You can't use it on uncompileable source code.
Comment 4 Gregory Murphy 2007-05-22 05:17:06 UTC
I added the method name, and now instant rename works, in all six contexts.

I swear that for the longest time, I couldn't get this to work. Perhaps every
time I tried it, there was a syntax error somewhere in my file.

Comment 5 Torbjorn Norbye 2007-05-23 01:07:59 UTC
I've modified it such that it now gives more specific error messages; in particular, if it can't rename due 
to parsing errors, it should say so.

IDE:-------------------------------------------------
IDE: [5/22/07 5:05 PM] Committing started
Checking in gsf/api/src/org/netbeans/api/gsf/InstantRenamer.java;
/cvs/scripting/gsf/api/src/org/netbeans/api/gsf/InstantRenamer.java,v  <--  InstantRenamer.java
new revision: 1.2; previous revision: 1.1
done
Checking in gsf/src/org/netbeans/modules/editor/retouche/Bundle.properties;
/cvs/scripting/gsf/src/org/netbeans/modules/editor/retouche/Bundle.properties,v  <--  
Bundle.properties
new revision: 1.2; previous revision: 1.1
done
Checking in gsf/src/org/netbeans/modules/editor/retouche/InstantRenameAction.java;
/cvs/scripting/gsf/src/org/netbeans/modules/editor/retouche/InstantRenameAction.java,v  <--  
InstantRenameAction.java
new revision: 1.3; previous revision: 1.2
done
Checking in ruby/editing/manifest.mf;
/cvs/scripting/ruby/editing/manifest.mf,v  <--  manifest.mf
new revision: 1.59; previous revision: 1.58
done
Checking in ruby/editing/nbproject/project.xml;
/cvs/scripting/ruby/editing/nbproject/project.xml,v  <--  project.xml
new revision: 1.22; previous revision: 1.21
done
Checking in ruby/editing/src/org/netbeans/modules/ruby/Bundle.properties;
/cvs/scripting/ruby/editing/src/org/netbeans/modules/ruby/Bundle.properties,v  <--  
Bundle.properties
new revision: 1.5; previous revision: 1.4
done
Checking in ruby/editing/src/org/netbeans/modules/ruby/RenameHandler.java;
/cvs/scripting/ruby/editing/src/org/netbeans/modules/ruby/RenameHandler.java,v  <--  
RenameHandler.java
new revision: 1.5; previous revision: 1.4
done
Checking in ruby/kit/nbproject/project.xml;
/cvs/scripting/ruby/kit/nbproject/project.xml,v  <--  project.xml
new revision: 1.90; previous revision: 1.89
done
Checking in gsf/nbproject/project.xml;
/cvs/scripting/gsf/nbproject/project.xml,v  <--  project.xml
new revision: 1.22; previous revision: 1.21
done
Checking in gsf/nbproject/project.properties;
/cvs/scripting/gsf/nbproject/project.properties,v  <--  project.properties
new revision: 1.44; previous revision: 1.43
done
Checking in ruby/kit/manifest.mf;
/cvs/scripting/ruby/kit/manifest.mf,v  <--  manifest.mf
new revision: 1.72; previous revision: 1.71
done
Checking in gsf/api/manifest.mf;
/cvs/scripting/gsf/api/manifest.mf,v  <--  manifest.mf
new revision: 1.21; previous revision: 1.20
done
IDE: [5/2
Comment 6 Jiri Kovalsky 2007-07-03 14:05:22 UTC
Reassigning this issue to newly created 'ruby' component.
Comment 7 Jiri Kovalsky 2007-07-03 14:46:05 UTC
Changing target milestone of all resolved Ruby issues from TBD to 6.0 Beta 1 build.