Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4324/src/org/python/pydev/editor/codecompletion
Modified Files:
PythonShell.java PyCodeCompletion.java
Log Message:
self. getting instance variables too.
Index: PythonShell.java
===================================================================
RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/PythonShell.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PythonShell.java 13 Sep 2004 17:11:49 -0000 1.2
--- PythonShell.java 13 Sep 2004 19:47:54 -0000 1.3
***************
*** 269,272 ****
--- 269,301 ----
/**
+ * @param token
+ * @param docToParse
+ * @return
+ */
+ public List getClassCompletions(String token, String str) {
+ String s = "@@CLASS_GLOBALS("+token+"):"+str+"\nEND@@";
+ try {
+ this.write(s);
+
+ return getCompletions();
+ } catch (IOException e) {
+ e.printStackTrace();
+ try {
+ this.endIt();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ try {
+ this.startIt();
+ } catch (IOException e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ }
+ return getInvalidCompletion();
+ }
+ }
+
+ /**
* @return
*/
***************
*** 294,296 ****
--- 323,327 ----
}
+
+
}
\ No newline at end of file
Index: PyCodeCompletion.java
===================================================================
RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/PyCodeCompletion.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** PyCodeCompletion.java 13 Sep 2004 17:11:50 -0000 1.4
--- PyCodeCompletion.java 13 Sep 2004 19:47:54 -0000 1.5
***************
*** 97,110 ****
String docToParse = getDocToParse(doc, documentOffset);
! if (theActivationToken.replace('.',' ').trim().equals("self")){
! // System.out.println("serverCompletion - self.");
! Location loc = Location.offsetToLocation(doc, documentOffset);
! AbstractNode closest = ModelUtils.getLessOrEqualNode(edit.getPythonModel(),loc);
! Scope scope = closest.getScope().findContainingClass();
! String token = scope.getStartNode().getName();
!
! List completions = serverShell.getTokenCompletions(token, docToParse);
theList.addAll(completions);
--- 97,114 ----
String docToParse = getDocToParse(doc, documentOffset);
! String trimmed = theActivationToken.replace('.',' ').trim();
! if (trimmed.equals("") == false){
! List completions;
! if (trimmed.equals("self")){
! Location loc = Location.offsetToLocation(doc, documentOffset);
! AbstractNode closest = ModelUtils.getLessOrEqualNode(edit.getPythonModel(),loc);
! Scope scope = closest.getScope().findContainingClass();
! String token = scope.getStartNode().getName();
! completions = serverShell.getClassCompletions(token, docToParse);
! }else{
! completions = serverShell.getTokenCompletions(trimmed, docToParse);
! }
theList.addAll(completions);
***************
*** 147,151 ****
newDoc += wholeDoc.substring(lineInformation.getOffset() + lineInformation.getLength(), docLength);
! System.out.println("DOC:"+newDoc);
} catch (BadLocationException e1) {
--- 151,155 ----
newDoc += wholeDoc.substring(lineInformation.getOffset() + lineInformation.getLength(), docLength);
! // System.out.println("DOC:"+newDoc);
} catch (BadLocationException e1) {
|