From 7ceb04b003ea11c98631cfa22fa43a1295947c37 Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Sat, 20 Jul 2013 00:49:36 +0530 Subject: [PATCH] bye bye defunct code --- pdex/Todo, GSoC 2013.txt | 11 +- .../mode/experimental/ASTGenerator.java | 113 +----------------- 2 files changed, 8 insertions(+), 116 deletions(-) diff --git a/pdex/Todo, GSoC 2013.txt b/pdex/Todo, GSoC 2013.txt index aff776f5e..90d0f1a1c 100644 --- a/pdex/Todo, GSoC 2013.txt +++ b/pdex/Todo, GSoC 2013.txt @@ -36,20 +36,21 @@ x - Completion for array access, strings[0]. Finer details +* 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(done). Argument list as tooltip if possible? +* - Show declaring class for completions +*! 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. +* - Diamond operator isn't supported for now. Bummer. +* - Icons for completions? Or overkill right now? x! - Ignore String case while finding completion candidates x - Multiple 3rd party classes found in various packages. Not a chance no more. 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(done). Argument list as tooltip if possible? x Cursor positioning should be after the first ( if arguments present, else after () x Display the type of Completion(method return type, variable type) in the popup. - facing some issues for local types. Fixed. x Sorted list of completion candidates - fields, then methods. It's unsorted presently. -* - Show declaring class for completions -*! 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. -* - Diamond operator isn't supported for now. Bummer. 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 -* - Icons for completions? Or overkill right now? + 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 b271bf074..79975f006 100644 --- a/pdex/src/processing/mode/experimental/ASTGenerator.java +++ b/pdex/src/processing/mode/experimental/ASTGenerator.java @@ -944,123 +944,14 @@ public class ASTGenerator { { System.out.println("ChildExpr is null"); } - /*ASTNode det = resolveExpression(nearestNode, testnode,noCompare); - // Find the parent of the expression - // in a().b, this would give me the return type of a(), so that we can - // find all children of a() begininng with b - System.err.println("DET " + getNodeAsString(det)); - if (det != null) { - TypeDeclaration td = null; - SimpleType stp = extracTypeInfo(det); - if (det instanceof MethodDeclaration) { - if (((MethodDeclaration) det).getReturnType2() instanceof SimpleType) { - stp = (SimpleType) (((MethodDeclaration) det).getReturnType2()); - td = (TypeDeclaration) findDeclaration(stp.getName()); - } - } else if (det instanceof FieldDeclaration) { - if (((FieldDeclaration) det).getType() instanceof SimpleType) { - stp = (SimpleType) (((FieldDeclaration) det).getType()); - td = (TypeDeclaration) findDeclaration(stp.getName()); - } - } else if (det instanceof VariableDeclarationStatement) { - stp = (SimpleType) (((VariableDeclarationStatement) det) - .getType()); - td = (TypeDeclaration) findDeclaration(stp.getName()); - } - System.out.println("ST is " + stp.getName()); - // Now td contains the type returned by a() - System.err.println(getNodeAsString(det) + " defined in " - + getNodeAsString(td)); - ASTNode child = resolveChildExpression(testnode); - if (td != null) { - - System.out.println("Completion candidate: " - + getNodeAsString(child)); - for (int i = 0; i < td.getFields().length; i++) { - List vdfs = td.getFields()[i] - .fragments(); - for (VariableDeclarationFragment vdf : vdfs) { - if (noCompare) { - candidates - .add(new CompletionCandidate(getNodeAsString2(vdf))); - } else if (vdf.getName().toString() - .startsWith(child.toString())) - candidates - .add(new CompletionCandidate(getNodeAsString2(vdf))); - } - - } - for (int i = 0; i < td.getMethods().length; i++) { - if (noCompare) { - candidates - .add(new CompletionCandidate(getNodeAsString2(td - .getMethods()[i]), td.getName().toString(), "", - CompletionCandidate.METHOD)); - } else if (td.getMethods()[i].getName().toString() - .startsWith(child.toString())) - candidates - .add(new CompletionCandidate(getNodeAsString2(td - .getMethods()[i]), td.getName().toString(), "", - CompletionCandidate.METHOD)); - } - } else { - if (stp != null) { - candidates = getMembersForType(stp.getName().toString(), - child.toString(), noCompare, - false); - } - } - - } else if (word.length() - word2.length() == 1) { - System.out.println(word + " w2 " + word2); -// int dC = 0; -// for (int i = 0; i < word.length(); i++) { -// if(word.charAt(i) == '.') -// dC++; -// } -// if(dC == 1 && word.charAt(word.length() - 1) == '.'){ - System.out.println("All members of " + word2); - candidates = getMembersForType(word2, "", true, true); -// } - } else { - System.out.println("Some members of " + word2); - int x = word2.indexOf('.'); - if (x != -1) { - candidates = getMembersForType(word2.substring(0, x), - word2.substring(x + 1), false, - true); - } - } - if(candidates.size() == 0){ - System.out.println("candidates empty"); - String childExpr = resolveChildExpression(testnode) - .toString(); - System.out.println("Parent expression : " + resolveParentExpression(testnode)); - System.out.println("Child expression : " + childExpr); - - if(!noCompare){ - System.out.println("Original testnode " + getNodeAsString(testnode)); - testnode = resolveParentExpression(testnode); - System.out.println("Corrected testnode " + getNodeAsString(testnode)); - } - ClassMember expr = resolveExpression3rdParty(nearestNode, testnode, noCompare); - if(expr == null){ - System.out.println("Expr is null"); - }else { - System.out.println("Expr is " + expr.toString()); - candidates = getMembersForType(expr, - childExpr, noCompare, false); - } - }*/ } - updatePredictions(word); - + updatePredictions(word); + } }; worker.execute(); - } private void updatePredictions(final String word) {