|
From: <caw...@us...> - 2007-03-26 13:21:49
|
Revision: 2225
http://svn.sourceforge.net/rubyeclipse/?rev=2225&view=rev
Author: cawilliams
Date: 2007-03-26 06:18:35 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
do a little tweaking so we still suggest locals ( ihad turned that off for a while). Also add a hack so we save the last good AST for a RubyScript, and use that when we get elements in the local document
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-03-26 13:08:53 UTC (rev 2224)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-03-26 13:18:35 UTC (rev 2225)
@@ -42,6 +42,7 @@
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.internal.core.RubyElement;
+import org.rubypeople.rdt.internal.core.RubyScript;
import org.rubypeople.rdt.internal.core.RubyType;
import org.rubypeople.rdt.internal.core.parser.RubyParser;
import org.rubypeople.rdt.internal.core.search.ExperimentalIndex;
@@ -95,10 +96,9 @@
// FIXME If we're invoked on the class declaration (it's super class) don't do this!
// FIXME Traverse the IRubyElement model, not nodes (and don't reparse)?
if (fContext.isMethodInvokationOrLocal()) {
- suggestMethodsForEnclosingType(script);
+ suggestMethodsForEnclosingType(script);
}
- // FIXME What about instance and class variables?
-// getDocumentsRubyElementsInScope();
+ getDocumentsRubyElementsInScope();
}
if (fContext.isGlobal()) { // looks like a global
suggestGlobals();
@@ -284,7 +284,7 @@
// FIXME Try to stop all the multiple re-parsing of the source! Can
// we parse once and pass the root node around?
// Parse
- Node rootNode = (new RubyParser()).parse(fContext.getCorrectedSource());
+ Node rootNode = ((RubyScript) fContext.getScript()).lastGoodAST;
if (rootNode == null) {
return;
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2007-03-26 13:08:53 UTC (rev 2224)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2007-03-26 13:18:35 UTC (rev 2225)
@@ -74,7 +74,8 @@
public WorkingCopyOwner owner;
protected String name;
-
+ public Node lastGoodAST;
+
/**
* @param name
*/
@@ -133,6 +134,7 @@
try {
RubyParser parser = new RubyParser();
ast = parser.parse((IFile) getResource(), new CharArrayReader(contents));
+ lastGoodAST = ast;
RubyScriptStructureBuilder visitor = new RubyScriptStructureBuilder(this, unitInfo, newElements);
if (ast != null) ast.accept(visitor);
unitInfo.setIsStructureKnown(true);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|