Remove some fixed todo's and moved one to jruby-parser as an issue: https://github.com/jruby/jruby-parser/issues/29. removed a bunch of todos I don't understand (RFE's and mixture of things which do not seem to exist anymore)
authorenebo@netbeans.org
Sun, 08 Dec 2013 12:53:22 -0600
changeset 4556e276e451257b
parent 4555 3773928e70d0
child 4557 123da219e4f8
Remove some fixed todo's and moved one to jruby-parser as an issue: https://github.com/jruby/jruby-parser/issues/29. removed a bunch of todos I don't understand (RFE's and mixture of things which do not seem to exist anymore)
ruby.debugger/src/org/netbeans/modules/ruby/debugger/ToolTipAnnotation.java
ruby/src/org/netbeans/modules/ruby/RubyRenameHandler.java
     1.1 --- a/ruby.debugger/src/org/netbeans/modules/ruby/debugger/ToolTipAnnotation.java	Sun Dec 08 12:20:16 2013 -0600
     1.2 +++ b/ruby.debugger/src/org/netbeans/modules/ruby/debugger/ToolTipAnnotation.java	Sun Dec 08 12:53:22 2013 -0600
     1.3 @@ -46,11 +46,9 @@
     1.4  
     1.5  import java.io.IOException;
     1.6  import javax.swing.JEditorPane;
     1.7 -import javax.swing.text.BadLocationException;
     1.8  import javax.swing.text.Element;
     1.9  import javax.swing.text.StyledDocument;
    1.10  import org.jrubyparser.ast.INameNode;
    1.11 -import org.jrubyparser.ast.InstVarNode;
    1.12  import org.jrubyparser.ast.Node;
    1.13  import org.jrubyparser.ast.NodeType;
    1.14  import org.netbeans.modules.ruby.AstUtilities;
    1.15 @@ -149,23 +147,17 @@
    1.16  
    1.17      static String getExpressionToEvaluate(FileObject fo, int offset) {
    1.18          Node root = AstUtilities.getRoot(fo);
    1.19 -        if (root == null) {
    1.20 -            return null;
    1.21 -        }
    1.22 -        Node node = AstUtilities.findNodeAtOffset(root, offset);
    1.23 -        if (node == null) {
    1.24 -            return null;
    1.25 -        }
    1.26 +        if (root == null) return null;
    1.27 +
    1.28 +        Node node = root.getNodeAt(offset);
    1.29 +        if (node == null) return null;
    1.30 +
    1.31          // handles the case when the caret is placed just before the
    1.32          // expression to evaluate, e.g. "^var.foo"
    1.33 -        if (node.getNodeType() == NodeType.NEWLINENODE) {
    1.34 -            node = AstUtilities.findNodeAtOffset(root, offset + 1);
    1.35 -        }
    1.36 -        if (shouldEvaluate(node) && node instanceof INameNode) {
    1.37 -            return ((INameNode) node).getLexicalName();
    1.38 -        }
    1.39 +        if (node.getNodeType() == NodeType.NEWLINENODE) node = root.getNodeAt(offset+1);
    1.40 +        if (shouldEvaluate(node) && node instanceof INameNode) return ((INameNode) node).getLexicalName();
    1.41 +
    1.42          return null;
    1.43 -
    1.44      }
    1.45  
    1.46      private static boolean shouldEvaluate(Node node) {
     2.1 --- a/ruby/src/org/netbeans/modules/ruby/RubyRenameHandler.java	Sun Dec 08 12:20:16 2013 -0600
     2.2 +++ b/ruby/src/org/netbeans/modules/ruby/RubyRenameHandler.java	Sun Dec 08 12:53:22 2013 -0600
     2.3 @@ -56,46 +56,9 @@
     2.4  import org.openide.util.NbBundle;
     2.5  
     2.6  /**
     2.7 - * Handle renaming of local elements
     2.8 - * @todo I should be able to rename top-level methods as well since they
     2.9 - *   are private
    2.10 - * @todo Rename |j| in the following will only rename "j" inside the block!
    2.11 - * <pre>
    2.12 -i = 50
    2.13 -j = 200
    2.14 -k = 100
    2.15 -x = [1,2,3]
    2.16 -x.each do |j|
    2.17 -  puts j
    2.18 -end
    2.19 -puts j
    2.20 - * </pre>
    2.21 - * @todo When you fix, make sure BlockarReuse is also fixed!
    2.22 - * @todo Try renaming "hello" in the exception here; my code is confused
    2.23 - *   about what I'm renaming (aliases method name) and the refactoring dialog
    2.24 - *   name is wrong! This is happening because it's also changing GlobalAsgnNode for $!
    2.25 - *   but its parent is LocalAsgnNode, and -its- -grand- parent is a RescueBodyNode! 
    2.26 - *   I should special case this!
    2.27 - * <pre>
    2.28 -def hello
    2.29 -  begin
    2.30 -    ex = 50
    2.31 -    puts "test"
    2.32 -  
    2.33 -  rescue Exception => hello
    2.34 -    puts hello
    2.35 -  end
    2.36 -end
    2.37 - *
    2.38 - * </pre>
    2.39 - *
    2.40 - * @author Tor Norbye
    2.41 + * Handles renaming of local elements.
    2.42   */
    2.43  public class RubyRenameHandler implements InstantRenamer {
    2.44 -    
    2.45 -    public RubyRenameHandler() {
    2.46 -    }
    2.47 -
    2.48      @Override
    2.49      public boolean isRenameAllowed(ParserResult info, int caretOffset, String[] explanationRetValue) {
    2.50          Node root = AstUtilities.getRoot(info);
    2.51 @@ -122,13 +85,12 @@
    2.52  
    2.53      @Override
    2.54      public Set<OffsetRange> getRenameRegions(ParserResult info, int caretOffset) {
    2.55 -        Node closest = AstUtilities.findNodeAtOffset(info, caretOffset);
    2.56 -        if (closest == null || !(closest instanceof ILocalVariable)) return Collections.emptySet();
    2.57 +        Node variable = AstUtilities.findNodeAtOffset(info, caretOffset);
    2.58 +        if (variable == null || !(variable instanceof ILocalVariable)) return Collections.emptySet();
    2.59  
    2.60 -        ILocalVariable variable = (ILocalVariable) closest;
    2.61          Set<OffsetRange> regions = new HashSet<OffsetRange>();
    2.62  
    2.63 -        for (ILocalVariable occurrence: variable.getOccurrences()) {
    2.64 +        for (ILocalVariable occurrence: ((ILocalVariable) variable).getOccurrences()) {
    2.65              OffsetRange range = LexUtilities.getLexerOffsets(info, 
    2.66                      AstUtilities.offsetRangeFor(occurrence.getNamePosition()));
    2.67  
    2.68 @@ -137,15 +99,4 @@
    2.69  
    2.70          return regions;
    2.71      }
    2.72 -
    2.73 -    // TODO: Check
    2.74 -    //  quick tip renaming
    2.75 -    //  unused detection
    2.76 -    //  occurrences marking
    2.77 -    //  code completion
    2.78 -    //  live code templates
    2.79 -    // ...anyone else who calls findBlock
    2.80 -    //
    2.81 -    // Test both parent blocks, sibling blocks and descendant blocks
    2.82 -    // Make sure the "isUsed" detection is smarter too.
    2.83 -}
    2.84 +}
    2.85 \ No newline at end of file