diff --git a/pdex/Todo, GSoC 2013.txt b/pdex/Todo, GSoC 2013.txt index 4c2bcd119..3e1af0643 100644 --- a/pdex/Todo, GSoC 2013.txt +++ b/pdex/Todo, GSoC 2013.txt @@ -21,8 +21,7 @@ x! Library CC for nested would be tricky. Need to jump from local->compiled code - Making very good progress here. The elegance of recurion - Hats off! - Many of the cases seem to have been covered, and I'm achieving more and more code unification as I'm working through the problem step by step - Looks almost complete now, nearly all cases covered(July 13th) -* Scope handling? Static/non static scope? -x Display the type of Completion(method return type, variable type) in the popup. +* Scope handling? Static/non static scope? x! Should I implement wrapper for ASTNode? - possibly needed for code completion with compiled and non-compiled code. Done. * Trie implementation would be lower priority, "premature optimisation is pure evil". Get all features of CC working good enough and then plan this. x Differentiating between multiple statements on the same line. How to? Done with offset handling. @@ -31,10 +30,13 @@ Finer details * - Multiple 3rd party classes found in various packages x Obj a1; a1.-> completion doesn't work before it is instantiated. Look into that. Began working again by itself. Yay! * printStuff(int,float,String) - completion endings have to be appropriate. Right now it's just printStuff(,,). Cursor positioning also needs to be taken care of. Argument list as tooltip if possible? +x Cursor positioning should be after the first ( if arguments present, else after () +* Display the type of Completion(method return type, variable type) in the popup. + - facing some issues for local types * Sorted list of completion candidates - fields, then methods. It's unsorted presently. *! p5 enhanced stuff in java, how does it fit in with everything else, and edge cases. Possibly add support for them. Offset handling improvements should help here. -* Reflection API - getMethods vs getDeclaredMethods. -* Need to add offset correction to ASTGenerator and its lookup methods. Or leave it for later? All set to implement +x Reflection API - getMethods vs getDeclaredMethods. declared. +x Need to add offset correction to ASTGenerator and its lookup methods. Or leave it for later? All set to implement Completion List x Dynamically update the list instead of recreating on every keystroke(new list data, pos, etc.) diff --git a/pdex/src/processing/mode/experimental/ASTGenerator.java b/pdex/src/processing/mode/experimental/ASTGenerator.java index 3827b1bc8..7235d6fbd 100644 --- a/pdex/src/processing/mode/experimental/ASTGenerator.java +++ b/pdex/src/processing/mode/experimental/ASTGenerator.java @@ -242,14 +242,14 @@ public class ASTGenerator { return; jtree.setModel(new DefaultTreeModel(codeTree)); ((DefaultTreeModel) jtree.getModel()).reload(); - if (!frame2.isVisible()) { - frame2.setVisible(true); - } - if (!frameAutoComp.isVisible()) { - - frameAutoComp.setVisible(true); - - } +// if (!frame2.isVisible()) { +// frame2.setVisible(true); +// } +// if (!frameAutoComp.isVisible()) { +// +// frameAutoComp.setVisible(true); +// +// } // if (!jdocWindow.isVisible()) { // long t = System.currentTimeMillis(); // loadJars(); @@ -764,7 +764,7 @@ public class ASTGenerator { // Bottom up traversal of the AST to look for possible definitions at // higher levels. - nearestNode = nearestNode.getParent(); + //nearestNode = nearestNode.getParent(); while (nearestNode != null) { // If the current class has a super class, look inside it for // definitions. @@ -991,11 +991,11 @@ public class ASTGenerator { DefaultTableModel tm = new DefaultTableModel( candi, new String[] { "Suggestions" }); - tableAuto.setModel(tm); - tableAuto.validate(); - tableAuto.repaint(); -// CompletionCandidate[] candidatesArray = candidates -// .toArray(new CompletionCandidate[candidates.size()]); + if(tableAuto.isVisible()){ + tableAuto.setModel(tm); + tableAuto.validate(); + tableAuto.repaint(); + } errorCheckerService.getEditor().textArea() .showSuggestion(defListModel,word); } diff --git a/pdex/src/processing/mode/experimental/CompletionCandidate.java b/pdex/src/processing/mode/experimental/CompletionCandidate.java index dcf7da4cc..3c8b76481 100644 --- a/pdex/src/processing/mode/experimental/CompletionCandidate.java +++ b/pdex/src/processing/mode/experimental/CompletionCandidate.java @@ -51,7 +51,9 @@ public class CompletionCandidate implements Comparable{ cstr.append(","); } } - + if(method.getParameterTypes().length == 1) { + cstr.append(' '); + } label.append(")"); label.append(" : "+method.getReturnType().getSimpleName()); cstr.append(")"); @@ -88,6 +90,9 @@ public class CompletionCandidate implements Comparable{ cstr.append(","); } } + if(params.size() == 1) { + cstr.append(' '); + } label.append(")"); label.append(" : "+method.getReturnType2()); cstr.append(")"); diff --git a/pdex/src/processing/mode/experimental/CompletionPanel.java b/pdex/src/processing/mode/experimental/CompletionPanel.java index 4fd04bbb9..b3e4fe363 100644 --- a/pdex/src/processing/mode/experimental/CompletionPanel.java +++ b/pdex/src/processing/mode/experimental/CompletionPanel.java @@ -107,8 +107,19 @@ public class CompletionPanel { System.err.println(subWord+" <= subword,Inserting suggestion=> " + selectedSuggestion); textarea.getDocument().insertString(insertionPosition, selectedSuggestion, null); - textarea.setCaretPosition(insertionPosition - + selectedSuggestion.length()); + if(selectedSuggestion.endsWith(")")) + { + if(!selectedSuggestion.endsWith("()")){ + int x = selectedSuggestion.indexOf('('); + if(x != -1){ + //System.out.println("X................... " + x); + textarea.setCaretPosition(insertionPosition + (x+1)); + } + } + } + else { + textarea.setCaretPosition(insertionPosition + selectedSuggestion.length()); + } return true; } catch (BadLocationException e1) { e1.printStackTrace();