Skip to content

Commit

Permalink
Fix issue where java compiler notes were not being refreshed correctl…
Browse files Browse the repository at this point in the history
…y. Let Java compiler see output classes for dependencies on Scala. Fix some bugs in sbt dependency discovery.
  • Loading branch information
aemoncannon committed Aug 24, 2011
1 parent 4ba4238 commit 303e399
Show file tree
Hide file tree
Showing 11 changed files with 405 additions and 55 deletions.
16 changes: 14 additions & 2 deletions etc/manual.ltx
@@ -1,7 +1,7 @@
\documentclass{article}

\usepackage[utf8]{inputenc}

\usepackage{graphics}
\usepackage{amsmath}

\newenvironment{mylisting}
Expand Down Expand Up @@ -655,7 +655,19 @@ Emacs starts the ENSIME server using the server.sh script in the \emph{bin} fold


\subsection{The Swank Protocol}
The Emacs ENSIME client communicates with the server using the Swank protocol. This protocol was originally developed for the SLIME lisp environment for Emacs and is therefore very 'lispy'. A socket connection is maintained for the duration of the session. The client and server exchange messages encoded as S-Expressions, separated by hex-encoded message lengths. See the E-Lisp function \emph{ensime-net-send} in ensime.el for details on how messages are sent from Emacs, and the functions readMessage and writeMessage in org.ensime.protocol.SwankProtocol for the Scala side of the conversation. What follows is a commented excerpt from the initialization of an ENSIME session. These SExps were copied from the \emph{*ensime-events*} buffer in Emacs which logs all protocol events (useful for learning the protocol!). Server messages are indented. Comments prefixed with \#.
The Emacs ENSIME client communicates with the server using the Swank protocol. This protocol was originally developed for the SLIME lisp environment for Emacs. A socket connection is maintained for the duration of the session. The client and server exchange s-expressions. At the wire level, these messages are encoded as sequences of ASCII bytes. Each message is prepended with a fixed-size header denoting its length.

To send an s-expression, determine its ASCII length and then encode that integer as a padded six-digit hexadecimal value. Write this value to the output socket first, then followed by the ASCII form of the s-expression. On the receiving side, the reader loop should read six ASCII characters into a buffer and convert that into an integer, then read that number of ASCII characters from the socket, parsing the result into an s-expression.\\

\vspace{5 mm}

\includegraphics{wire_protocol.png} \\

\vspace{7 mm}

See the E-Lisp function \emph{ensime-net-send} in ensime.el for details on how messages are sent from Emacs, and the function \emph{ensime-net-encode-length} for the implementation of the header encoding. See the functions readMessage and writeMessage in org.ensime.protocol.SwankProtocol to see how the messaging is handled in Scala.

At the application level, the s-expressions encode RPC calls, RPC responses, and events. RPC calls are used to make requests of the server. Events are generally used for the server to communicate un-prompted, asynchronous activity to the client -- such as an error or warning generated during compilation. What follows is a commented excerpt from the initialization of an ENSIME session. These s-expressions were copied from the \emph{*ensime-events*} buffer in Emacs which logs all protocol events (useful for learning the application protocol!). Server messages are indented. Comments prefixed with \#.

\begin{mylisting}
\begin{verbatim}
Expand Down
Binary file added etc/wire_protocol.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
321 changes: 321 additions & 0 deletions etc/wire_protocol.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion project/Build.scala
Expand Up @@ -128,10 +128,11 @@ object EnsimeBuild extends Build {
val cwd = Some(new File("etc"))
doSh("pdflatex manual.ltx", cwd)!!log
doSh("cat manual_head.html > " + target, cwd)!!log
doSh("tth -r -u -Lmanual < manual.ltx >> " + target, cwd)!!(log)
doSh("tth -r -u -e2 -Lmanual < manual.ltx >> " + target, cwd)!!(log)
doSh("cat manual_tail.html >> " + target, cwd)!!log
log.info("Publishing manual to web...")
doSh("scp " + target + " www@aemon.com:~/public/aemon/file_dump/", cwd)!!(log)
doSh("scp wire_protocol.png www@aemon.com:~/public/aemon/file_dump/", cwd)!!(log)
None
}

Expand Down

0 comments on commit 303e399

Please sign in to comment.