Commits

sk  committed 8768e71

Intermediate commit - trying to make debug hover for repl.

  • Participants
  • Parent commits c8300b6

Comments (0)

Files changed (4)

File META-INF/MANIFEST.MF

 Require-Bundle: org.eclipse.core.runtime,
  org.junit4;bundle-version="4.5.0",
  org.lispdev.log;bundle-version="1.0.0",
- org.eclipse.debug.core;bundle-version="3.5.1"
+ org.eclipse.debug.core;bundle-version="3.5.1",
+ org.lispdev.repl;bundle-version="1.0.0"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Export-Package: org.lispdev.swank,

File src/org/lispdev/swank/ISwank.java

   @Deprecated
   void addListener(SwankEvent writeString, SwankRunnable displayRunnable);
 
-  /**
-   * To be used only in LispImplementation
+  /*
+   * To be used only in LispImplementation:
    */
   public LispNode getInspectFrameLocal(String threadNum,
       String frameNum, String varNum, long timeout);
-  /**
-   * To be used only in LispImplementation
-   */
   public LispNode inspectNthPart(String partNum, long timeout);
+  public LispNode inspectReplResult(String id, long timeout);
 
 }

File src/org/lispdev/swank/LispImplementation.java

 
 import org.eclipse.debug.core.DebugException;
 import org.lispdev.log.Log;
+import org.lispdev.repl.IPartitionData;
 import org.lispdev.swank.debug.LispDebugTarget;
 import org.lispdev.swank.debug.LispValue;
 import org.lispdev.swank.debug.LispVariable;
 <--(:return (:ok
  ((:name "SB-DEBUG::ARG-0" :id 0 :value "(F 4)")
   (:name "SB-DEBUG::ARG-1" :id 0 :value "#<NULL-LEXENV>"))) 4)
+
+   * The details about variables values are obtained using swank inspector.
+   * The result for each variable is a tree rooted at the variable.
+   * To inspect a variable at deeper level of the tree one needs to
+   * call swank inspector starting from the root. This makes code of
+   * populating tree more complex.
+
  */
   /**
-   * Converts {@link LispNode} n, which is result of call to sendGetFrameLocals
-   * to array of LispVariables.
+   * Converts {@link LispNode} n, which is result of call to
+   * {@link ISwank#getInspectFrameLocal} to array of {@link LispVariable}s.
    */
   public LispVariable[] getLispVariables(final LispDebugTarget target,
       final String thread, final String frame, final LispNode n)
     return res;
   }
 
+  /*
+  -->(:emacs-rex (swank:init-inspector "(swank:get-repl-result #10r1)" ) nil :repl-thread 3)
+  <--(:return (:ok (:title "#<(SIMPLE-ARRAY CHARACTER (4)) {B05859F}>" :id 8 :content (("Dimensions" ": " (:value "(4)" 0) "
+  " "Element type" ": " (:value "CHARACTER" 1) "
+  " "Total size" ": " (:value "4" 2) "
+  " "Adjustable" ": " (:value "NIL" 3) "
+  " "Contents:" "
+  " "0" ": " (:value "#\\t" 4) "
+  " "1" ": " (:value "#\\h" 5) "
+  " "2" ": " (:value "#\\i" 6) "
+  " "3" ": " (:value "#\\s" 7) "
+  ") 34 0 34))) 3)
+
+   */
+  public LispVariable inspectReplResult(final LispDebugTarget target,
+      final IPartitionData data)
+  {
+    if( data == null || data.getContext() == null
+        || !data.getContext().equals("inspectable") )
+    {
+      return null;
+    }
+    final ISwank swank = target.getSwank();
+    final IInspectCmd cmd = new IInspectCmd()
+    {
+      @Override
+      public InspectInfo inspect(final LispVariable parent)
+      {
+        final LispNode r = swank.inspectReplResult(data.getId(), 500);
+        return getInspectInfo(target, parent, r);
+      }
+    };
+    LispVariable res = new LispVariable(target, null, "name",
+        "value", cmd);
+    return res;
+  }
+
 /*
  * (:read-string thread tag)
   <--(:read-string 1 1)

File src/org/lispdev/swank/SwankInterface.java

     swank.sendEvalRaw(msg, callBack);
   }
 
+  public LispNode inspectReplResult(String id, long timeout)
+  {
+    String msg =
+      "(swank:init-inspector \"(swank:get-repl-result #10r" + id + ")\" )";
+    return swank.sendEvalAndGrabRaw(msg, "nil", timeout);
+  }
+
   public synchronized void sendInspectInspectedPart(String partNum,
       SwankRunnable callBack)
   {