Newbie questions about integrating with Githubs Atom editor

624 views
Skip to first unread message

Viktor Hedefalk

unread,
Jun 25, 2014, 6:43:26 PM6/25/14
to ens...@googlegroups.com
Hi all,

I am wondering if it would be possible to get some pointers or advice regarding integrating Ensime into Githubs atom.io editor. And if someone else is at all interested in this?

I have used Ensime a bit before using both Emacs and later Sublime but went back to IDE:s and I'm currently mostly using IDEA.

However, I just found out Github finally decided to really FOSS their editor Atom so I figured I would maybe try to give it a shot. I don't know how much time I will have to spend on this, but right now I got kind of inspired. On parental leave :)

I see that this project has started moving again which makes me really happy. Oh, I'm sorry if this email is long and dumb, I just figured I could try to absorb as much info from you guys before I start anything stupid. Since this list seems to have gotten revived I just thought it might be a good idea to ask and also state my intention instead of just working on my own in the dark.

I'll just start listing questions:

* What is your feel about adding a protocol, say json instead of swank? The atom editor is a browser and extended with js or Coffescript or whatever that compiles to js. However, I figured I would start out with Ensime server as is and maybe just reuse this: https://github.com/swank-js/swank-js/blob/master/swank-protocol.js from the client with existing communication protocol. One thing at a time and I definitely wouldn't want to fork the server unnecessarily. However, it might just be a bit weird to cross the bridge using a lispy exchange format when its js communicating with Scala? And then I read under C.4 over here http://ensime.github.io/ensime-src/index.html#tth_sEcC and got the feel that it probably wouldn't be that hard to add a protocol. But then _again_, I've seen that both Sublime and TextMate plugins DID use swank so I guess there's a good reason? And I guess its simple enough to just use swank anyways. What do you think? Could we add a flag to the server startup selecting client protocol and have different implementations of org.ensime.protocol.Protocol?

* Is there something you guys miss in Ensime that a full-fletched IDE like Eclipse and IDEA have? I saw that the old issue of navigating to attached sources of dependencies might have been solved. Big applause! That was my biggest issue before. Is there something that might make it hard to continue adding functionality to match up with the IDE:s? I haven't even really looked into the architecture of the server, but am I right that it uses the official Presentation Compiler, just the same as Eclipse? Then it should be possible to have it all, right? Just a matter of doing the work, no? :) I guess maybe showing implicit parameters and conversion is still missing. I think I'm kind of dependent on that functionality sometimes when using libs that do a lot of that. What I'm wondering is basically if there's anything architectural that would stop us from going the full nine yards feature-wise or if it's _just_ putting in the hard work?

* I just attended scaladays and watching the scala.js presentation I got a wonky idea. I _think_ Sébastien showed a demo of browser code communicating with server code using Akka actors on both sides. Akka actors compiled into js on the client though, but still code-wise all Scala. They've come really far with that compiler backend and had even compiled Shapeless into js. How far-fetched might it be to start working on a actor-based server AND client using this technique for Atom do you think? This is probably most about getting the build right to have a scala.js sbt project building into a Atom plugin structure so maybe this is not the right forum to ask about that though. And maybe it's a bad idea since it couldn't be shared with Emacs, only used in Atom, right? Or can Emacs have js-parts in plugins, no? Only elisp? 

Anyway, for me that would be a really pleasant programming environment. Would be a bigger change than just changing protocol over the existing socket-thing, but simply Scala actors and case classes for communication, wouldn't that be sweet? :)

* And related to the last question, does anybody have some insight into Atom? I haven't really looked too deeply into it but I got the feeling that it would be pretty easy to extend, even compared to other editors like Sublime. At least the graphical part I think. But I don't really know yet. Haven't seen any full-fletched language support things, just some basic grammars for highlighting.

Anyway, if anyone has any insight on problems I might struck or any tips or any info, I'd be really glad!

* One more very concrete question: as of yet I only have a very basic start (using swank). I have an atom plugin that can run "Ensime:Init" and then I start the server, read the port-file, ask for swank:connection-info and log the answer to the js-console. I now just added reading the .ensime file and sending it with swank:init-project, but when I do that I get no answers from the server. Sending only 

000026(:swank-rpc (swank:connection-info) 1)
I get a quick answer 00005e(:return (:ok (:pid nil :implementation (:name "ENSIME-ReferenceServer") :version "0.8.7")) 1)
but when I do: 000026(:swank-rpc (swank:connection-info) 1) and then (without waiting for reply): 011039(:swank-rpc (swank:init-project ( :subprojects ( ( :name "dfkka" :module-name "dfkka" :depends-on-modules ( ) :package "se.uniply" :version "14.6-SNAPSHOT" :compile-deps ( "/Users/viktor/.sbt/boot/scala-2.10.4/lib/scala-library.jar" "/Users/viktor/.ivy2/cache/net.liftweb/lift-webkit_2.10/jars/lift-webkit_2.10-2.5.jar" "/Users/viktor/.ivy2/cache/net.liftweb/lift-util_2.10/jars/lift-util_2.10-2.5.jar" ...
I don't get any answer to either of the calls…? Is it so that I have to wait for the first message's answer before it's ok to send the next call? Is there any log from the Ensime server where I can se what's going on server side?


Thanks,
Viktor

Aemon Cannon

unread,
Jun 25, 2014, 9:52:19 PM6/25/14
to ens...@googlegroups.com
On Wed, Jun 25, 2014 at 6:43 PM, Viktor Hedefalk <hede...@gmail.com> wrote:
Hi all,

I am wondering if it would be possible to get some pointers or advice regarding integrating Ensime into Githubs atom.io editor. And if someone else is at all interested in this?

I have used Ensime a bit before using both Emacs and later Sublime but went back to IDE:s and I'm currently mostly using IDEA.

However, I just found out Github finally decided to really FOSS their editor Atom so I figured I would maybe try to give it a shot. I don't know how much time I will have to spend on this, but right now I got kind of inspired. On parental leave :)
 
Sounds great.


I see that this project has started moving again which makes me really happy. Oh, I'm sorry if this email is long and dumb, I just figured I could try to absorb as much info from you guys before I start anything stupid. Since this list seems to have gotten revived I just thought it might be a good idea to ask and also state my intention instead of just working on my own in the dark.

I'll just start listing questions:

* What is your feel about adding a protocol, say json instead of swank? The atom editor is a browser and extended with js or Coffescript or whatever that compiles to js. However, I figured I would start out with Ensime server as is and maybe just reuse this: https://github.com/swank-js/swank-js/blob/master/swank-protocol.js from the client with existing communication protocol. One thing at a time and I definitely wouldn't want to fork the server unnecessarily. However, it might just be a bit weird to cross the bridge using a lispy exchange format when its js communicating with Scala? And then I read under C.4 over here http://ensime.github.io/ensime-src/index.html#tth_sEcC and got the feel that it probably wouldn't be that hard to add a protocol. But then _again_, I've seen that both Sublime and TextMate plugins DID use swank so I guess there's a good reason? And I guess its simple enough to just use swank anyways. What do you think? Could we add a flag to the server startup selecting client protocol and have different implementations of org.ensime.protocol.Protocol?

In the long term I do think it'd make sense for the server to speak a more standard format (in addition to sexps), but for the purposes of getting atom off the ground I'd recommend just parsing sexps. It's really a negligible portion of the overall work.



* Is there something you guys miss in Ensime that a full-fletched IDE like Eclipse and IDEA have? I saw that the old issue of navigating to attached sources of dependencies might have been solved. Big applause! That was my biggest issue before. Is there something that might make it hard to continue adding functionality to match up with the IDE:s? I haven't even really looked into the architecture of the server, but am I right that it uses the official Presentation Compiler, just the same as Eclipse? Then it should be possible to have it all, right? Just a matter of doing the work, no? :) I guess maybe showing implicit parameters and conversion is still missing. I think I'm kind of dependent on that functionality sometimes when using libs that do a lot of that. What I'm wondering is basically if there's anything architectural that would stop us from going the full nine yards feature-wise or if it's _just_ putting in the hard work?

We do use the standard presentation compiler.  We have to deal with more latency than other IDEs (server to client) , but that hasn't been much of a problem so far. In my mind the trickiest thing is that we don't share an in-memory source file representation between client and server, so keeping things synced can be a bit awkward (generally we use the disk as the sync channel).


* I just attended scaladays and watching the scala.js presentation I got a wonky idea. I _think_ Sébastien showed a demo of browser code communicating with server code using Akka actors on both sides. Akka actors compiled into js on the client though, but still code-wise all Scala. They've come really far with that compiler backend and had even compiled Shapeless into js. How far-fetched might it be to start working on a actor-based server AND client using this technique for Atom do you think? This is probably most about getting the build right to have a scala.js sbt project building into a Atom plugin structure so maybe this is not the right forum to ask about that though. And maybe it's a bad idea since it couldn't be shared with Emacs, only used in Atom, right? Or can Emacs have js-parts in plugins, no? Only elisp? 

Anyway, for me that would be a really pleasant programming environment. Would be a bigger change than just changing protocol over the existing socket-thing, but simply Scala actors and case classes for communication, wouldn't that be sweet? :)


Sounds fancy. My two cents is that making a standard, javascripty plugin is going to be a lot easier to maintain in the long term and more likely to attract contributors from the atom world.
 
* And related to the last question, does anybody have some insight into Atom? I haven't really looked too deeply into it but I got the feeling that it would be pretty easy to extend, even compared to other editors like Sublime. At least the graphical part I think. But I don't really know yet. Haven't seen any full-fletched language support things, just some basic grammars for highlighting.

Anyway, if anyone has any insight on problems I might struck or any tips or any info, I'd be really glad!


I know nothing about it. The first thing I'd research would be long-lived tcp connections, with asynchronous handling of socket events. If that's doable, you're in good shape.
 
* One more very concrete question: as of yet I only have a very basic start (using swank). I have an atom plugin that can run "Ensime:Init" and then I start the server, read the port-file, ask for swank:connection-info and log the answer to the js-console. I now just added reading the .ensime file and sending it with swank:init-project, but when I do that I get no answers from the server. Sending only 

000026(:swank-rpc (swank:connection-info) 1)
I get a quick answer 00005e(:return (:ok (:pid nil :implementation (:name "ENSIME-ReferenceServer") :version "0.8.7")) 1)
but when I do: 000026(:swank-rpc (swank:connection-info) 1) and then (without waiting for reply): 011039(:swank-rpc (swank:init-project ( :subprojects ( ( :name "dfkka" :module-name "dfkka" :depends-on-modules ( ) :package "se.uniply" :version "14.6-SNAPSHOT" :compile-deps ( "/Users/viktor/.sbt/boot/scala-2.10.4/lib/scala-library.jar" "/Users/viktor/.ivy2/cache/net.liftweb/lift-webkit_2.10/jars/lift-webkit_2.10-2.5.jar" "/Users/viktor/.ivy2/cache/net.liftweb/lift-util_2.10/jars/lift-util_2.10-2.5.jar" ...
I don't get any answer to either of the calls…? Is it so that I have to wait for the first message's answer before it's ok to send the next call? Is there any log from the Ensime server where I can se what's going on server side?

Ensime server prints lots of info the stdout. There should be no problem with sending several messages as you are doing -- they will be handled in fifo order.
 

Thanks,
Viktor

--
You received this message because you are subscribed to the Google Groups "ENSIME" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ensime+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Viktor Hedefalk

unread,
Jun 26, 2014, 5:39:06 AM6/26/14
to ens...@googlegroups.com
Hi,

Thanks for the quick reply!

 
In the long term I do think it'd make sense for the server to speak a more standard format (in addition to sexps), but for the purposes of getting atom off the ground I'd recommend just parsing sexps. It's really a negligible portion of the overall work.


Yeah, I figured as much.

We do use the standard presentation compiler.  We have to deal with more latency than other IDEs (server to client) , but that hasn't been much of a problem so far. In my mind the trickiest thing is that we don't share an in-memory source file representation between client and server, so keeping things synced can be a bit awkward (generally we use the disk as the sync channel).

 
Hm, yeah. Compared to the slowness of using something like Eclipse for text editing I can't believe that local network latency can really be an issue?
How is this syncing typically handled? The editor sends a swank:builder-update-files whenever a file is saved? Are there any issues with this?
 
Sounds fancy. My two cents is that making a standard, javascripty plugin is going to be a lot easier to maintain in the long term and more likely to attract contributors from the atom world.

Yeah, too much of setup time to get started I think. I'll just drop that for now. More interested to have some basic functionality in Atom up and running as quick as possible.

I know nothing about it. The first thing I'd research would be long-lived tcp connections, with asynchronous handling of socket events. If that's doable, you're in good shape.
 

I just used a node.js net module to open the connection: http://nodejs.org/api/net.html#net_net_connect_path_connectlistener

It seems to work (at least with a single message :) ) Will look into why it failed when sending the second message.
 

Ensime server prints lots of info the stdout. There should be no problem with sending several messages as you are doing -- they will be handled in fifo order.

Cool, I'll try to figure it out.

Thanks a lot for the info!

Cheers,
Viktor 

Rory Graves

unread,
Jun 27, 2014, 9:00:45 AM6/27/14
to ens...@googlegroups.com


On Thursday, June 26, 2014 10:39:06 AM UTC+1, Viktor Hedefalk wrote:
Hi,

Thanks for the quick reply!

 
In the long term I do think it'd make sense for the server to speak a more standard format (in addition to sexps), but for the purposes of getting atom off the ground I'd recommend just parsing sexps. It's really a negligible portion of the overall work.



Yeah, I figured as much.

I'm actually working on separating out the 'swank calls' and the underlying 'swank wire format'  - i.e. turning the calls into a set of case classes - with an encoder to sexps.  Once this is done it should be very easy to create a converter for json instead. 
  

We do use the standard presentation compiler.  We have to deal with more latency than other IDEs (server to client) , but that hasn't been much of a problem so far. In my mind the trickiest thing is that we don't share an in-memory source file representation between client and server, so keeping things synced can be a bit awkward (generally we use the disk as the sync channel).

 
Hm, yeah. Compared to the slowness of using something like Eclipse for text editing I can't believe that local network latency can really be an issue?
How is this syncing typically handled? The editor sends a swank:builder-update-files whenever a file is saved? Are there any issues with this?
 
Sounds fancy. My two cents is that making a standard, javascripty plugin is going to be a lot easier to maintain in the long term and more likely to attract contributors from the atom world.


I'm actually really intersted in this approach too - effectively making ensime manage the source and server it over the wire - obviously for atom this is great, might be quite invasive on the emacs model.
 
Yeah, too much of setup time to get started I think. I'll just drop that for now. More interested to have some basic functionality in Atom up and running as quick as possible.

I know nothing about it. The first thing I'd research would be long-lived tcp connections, with asynchronous handling of socket events. If that's doable, you're in good shape.
 

I just used a node.js net module to open the connection: http://nodejs.org/api/net.html#net_net_connect_path_connectlistener

It seems to work (at least with a single message :) ) Will look into why it failed when sending the second message.

Thats cool.
 
 

Ensime server prints lots of info the stdout. There should be no problem with sending several messages as you are doing -- they will be handled in fifo order.

Cool, I'll try to figure it out.

Thanks a lot for the info!

Cheers,
Viktor 


Cheers

Rory 

Viktor Hedefalk

unread,
Jun 28, 2014, 12:35:22 PM6/28/14
to ens...@googlegroups.com
I'm actually working on separating out the 'swank calls' and the underlying 'swank wire format'  - i.e. turning the calls into a set of case classes - with an encoder to sexps.  Once this is done it should be very easy to create a converter for json instead. 

That sounds excellent!


I'm actually really intersted in this approach too - effectively making ensime manage the source and server it over the wire - obviously for atom this is great, might be quite invasive on the emacs model.
 

Yeah, I figure I'll leave it for now and just try to get some basic functionality into Atom as quickly as possible instead.



I have a few more questions for you guys:


1) I triggered a (swank:builder-init) which started a full build. My .ensime states:

  :target "/Users/viktor/dev/projects/uniply/target/scala-2.10/classes"

However, it all got built out to "/Users/viktor/dev/projects/uniply" which is root-dir of the project. 

2) My test project correctly build using sbt, but running (swank:typecheck-all) with Ensime I got a bunch of errors. However, running (swank:builder-init) triggered a build that said:

[info] Compile success at Jun 28, 2014 5:03:41 PM [52.322s]
compile:  OUT
Writing: (:background-message 104 "Build complete.")
Writing: (:return (:ok ()) 2)  

Might this be classpath issues? 

It's mostly errors compiling generated code from scalaxb under src_managed:

Writing: (:scala-notes (:is-full nil :notes ((:severity error :msg "could not find implicit value for evidence parameter of type scalaxb.CanWriteXML[scala.xml.Node]" :beg 2042 :end 2067 :line 46 :col 52 :file "/Users/viktor/dev/projects/uniply/target/scala-2.10/src_managed/main/sbt-scalaxb/scalaxb/soap11.scala"))))
Writing: (:scala-notes (:is-full nil :notes ((:severity error :msg "not enough arguments for method apply: (implicit evidence$5: scalaxb.CanWriteXML[scala.xml.Node])scalaxb.DataRecord[scala.xml.Node] in object DataRecord. Unspecified value parameter evidence$5." :beg 2042 :end 2067 :line 46 :col 52 :file "/Users/viktor/dev/projects/uniply/target/scala-2.10/src_managed/main/sbt-scalaxb/scalaxb/soap11.scala"))))
Writing: (:scala-notes (:is-full nil :notes ((:severity error :msg "could not find implicit value for evidence parameter of type scalaxb.CanWriteXML[scala.xml.Node]" :beg 2165 :end 2190 :line 48 :col 45 :file "/Users/viktor/dev/projects/uniply/target/scala-2.10/src_managed/main/sbt-scalaxb/scalaxb/soap11.scala")))) get errors related to generated code

but there's also errors in my own code:

Writing: (:scala-notes (:is-full nil :notes ((:severity error :msg "No implicit view available from dfk.ka.model.Form.EnumVal => dfk.ka.model.Form.EnumVal." :beg 1820 :end 1848 :line 51 :col 63 :file "/Users/viktor/dev/projects/uniply/src/main/scala/dfk/ka/snippet/Projects.scala"))))

This I figured could maybe be related to the fact that I _might_ have duplicate versions of the same dependency (lift in this case) due to not having correctly set exclusion rules on transitive deps. But I haven't looked into it. All errors seems to be implicit lookup though so I figured I should ask...?


3) I realized I don't really know what functionality to start with and how to correctly use Ensime from Atom. I always figured I should use sbt ~compile in a terminal on the side as my "real build" and then mostly use Ensime for live typechecking and auto-complete and code navigation and all that good stuff. But then, how does Ensime keep track of new .class -files? I guess this approach is wrong? I need Ensime to do the build to be able to have full control on what's going on? If I edit files on the side with another editor then I can't send swank:builder-update-files and then it gets messed up, right?

If anyone has any pointers on what I should start with functionality-wise to get something usable up as quickly as possible that would be awesome!


Thanks,
Viktor


eric....@gmail.com

unread,
Jul 4, 2014, 5:16:47 PM7/4/14
to ens...@googlegroups.com
On Saturday, June 28, 2014 9:35:22 AM UTC-7, Viktor Hedefalk wrote:
[...]
> 1) I triggered a (swank:builder-init) which started a full build. My .ensime states:
>
>   :target "/Users/viktor/dev/projects/uniply/target/scala-2.10/classes"
>
> However, it all got built out to "/Users/viktor/dev/projects/uniply" which is root-dir of the project. 

Looking at the server code, it could be because the target directory didn't exist.

> 2) My test project correctly build using sbt, but running (swank:typecheck-all) with Ensime I got a bunch of errors. However, running (swank:builder-init) triggered a build that said:
>
>
> [info] Compile success at Jun 28, 2014 5:03:41 PM [52.322s]
> compile:  OUT
> Writing: (:background-message 104 "Build complete.")
> Writing: (:return (:ok ()) 2)  
>
>
> Might this be classpath issues? 
>

That sounds like it might be it but it's hard to tell. One thing you could try is run ensime from emacs and look at how the swank messages differ from the ones you see with Atom.

[...]
> 3) I realized I don't really know what functionality to start with and how to correctly use Ensime from Atom. I always figured I should use sbt ~compile in a terminal on the side as my "real build" and then mostly use Ensime for live typechecking and auto-complete and code navigation and all that good stuff. But then, how does Ensime keep track of new .class -files? I guess this approach is wrong? I need Ensime to do the build to be able to have full control on what's going on? If I edit files on the side with another editor then I can't send swank:builder-update-files and then it gets messed up, right?

Currently, ensime loads and parses all source files, and makes little use of .class files. When you modify a source, you send a "swank:typecheck-file" message and everything gets re-parsed (the file to typecheck gets done first so the user gets instant feedback). That ensures that all parse trees are always up to date, and that errors that would propagate to other files are detected. This approach has drawbacks for very large projects but works very well for small to medium ones.

The swank:builder-init and swank:builder-update-files cause the project to be compiled, which gives you error/warning messages if any, but this has no effect on the typecheck/auto-complete stuff.

If you modify a file outside of emacs, a full rebuild (swank:buulder-init) will take the changes into account since the builder reads files from disk. But emacs wouldn't know to send a swank:builder-update-files command.

>
> If anyone has any pointers on what I should start with functionality-wise to get something usable up as quickly as possible that would be awesome!
>

I think the starting point is to implement swank:typecheck-file (or swank:typecheck-all), not much works without it.

Eric

samwei...@gmail.com

unread,
Mar 29, 2015, 5:58:32 AM3/29/15
to ens...@googlegroups.com
Hi Viktor,

I stumbled upon this old thread because I have been looking for a plugin that integrates enzime with atom.

Did you make any progress on this project or did you find any other plugin that accomplishes this?

Cheers,
Sam

Viktor Hedefalk

unread,
Mar 31, 2015, 6:50:03 AM3/31/15
to ens...@googlegroups.com, samwei...@gmail.com
Hi Sam,

funny, I just went in here to check up because I'm just starting to look into this again as of yesterday.

Sorry though, I haven't made much progress yet. Parental leave hasn't been providing the loads of spare time I wished :) I basically haven't touched a line of code since summer.

All I have is commands that starts up the server, reads .ensime and inits the project and then parses returned s-expressions into js objects and does some simple outputs in the status bar. The code is in no shape to hit daylight yet, but I feel a bit motivated right now to look into it again. Give me a couple of weeks and I might be able to put something up!

My plan now is to look into the Typescript plugin:


and try to leverage their ui code for error reporting. I think however, they maybe just use 


for the type of error reporting we need at first. But they have some other interesting things I think for code completion and such. 

This will be highly on selfish need-basis for me right now I must warn. My highest priority might be basic code navigation. I need to be able do cmd-click or some shortcut on the cursor to move into the definition of symbols. That + background sbt might be enough to quit Idea for the project I'm working on right now. But hopefully I can get something decent up pretty soon and then accept pull requests. *hint, hint*. 

However, I must also warn that this is the first Coffeescript I have ever written and it feels pretty hacky. If I'm going to use the typescript plugin ui code (which is written in typescript) I might move over to typescript. Haven't used that either though :)

Feature-wise I think my prio is:

1) go to definition
2) hover (or something) for type info
3) error reporting
4) view applied implicits


Anyway, any input is highly appreciated! Anything like "look at this other plugin that seems cooler than atom-typescript" to "your doing it all wrong" :)

It's a lot more fun to try to do this if there is interest from someone else!


Cheers,
Viktor

Alexey Alekhin

unread,
Mar 31, 2015, 7:59:36 AM3/31/15
to ens...@googlegroups.com, samwei...@gmail.com
Hi Viktor,

I'm also interesting in this. Actually, the only thing that I need to switch to atom completely is sbt in background with jump-to-error. But integrating ensime would be much better of course.
I would also recommend you to take a look at the UI of this plugin:
https://atom.io/packages/ide-haskell

--
Best regards,
Alexey

--
You received this message because you are subscribed to a topic in the Google Groups "ENSIME" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ensime/1dWUQwnFoyk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ensime+un...@googlegroups.com.

Viktor Hedefalk

unread,
Mar 31, 2015, 8:43:38 AM3/31/15
to ens...@googlegroups.com, samwei...@gmail.com, alexey....@me.com
Hi Alexey,

Awesome! The Haskell plugin looks great, need to try it out!

A quick glance at the source I see they have built their own UI stuff I think. While the Typescript one used autocomplete-plus for autocompletions and linter for error reporting. I'm not sure which way to go right now. The linter seems to have an API that is too intrusive where you just provide a "linter" like https://atom.io/packages/linter-scalac and the linter lib handles the lifecycle and everything. I basically think we need to control everything from within our ensime package and basically just call functions like "report error on file, line, col, text" and "clear all errors". Maybe that is there somewhere in linter, but I haven't found it yet.

Basically I think I want to use the standard libs as much as possible for everything ui related but still have control. autocomplete-plus seems nice.



Regarding sbt and jump-to-error, do you mean something like:


That probably shouldn't be too hard, but maybe that's a separate project…? Hm, I think actually iterm2 which I use, has the feature to open file names in separate programs… Seems hardcoded to Sublime for me though, can't get it to go to Atom right now…


Keep it coming!

Cheers,
Viktor

Viktor Hedefalk

unread,
Mar 31, 2015, 9:03:31 AM3/31/15
to ens...@googlegroups.com, samwei...@gmail.com, alexey....@me.com
Yeah, iterm2 _should_ be able to do just hyperlink the errors from sbt into atom, but for some reason I'm stuck with Sublime. Report here:


Cheers,
Viktor

Rory Graves

unread,
Mar 31, 2015, 5:38:34 PM3/31/15
to ens...@googlegroups.com
Hey Guys,

Really excited that somebody is playing with integrating ensime with Atom.  I've been working slowly towards something bigger - a web based ide based on an Atom gui. e.g.

  • A web server hosting ensime + project inside a docker image
  • Full IDE support via a Ace (the js editor powering Atom) front end. (i.e. all of the goodies - completion etc).
  • Collaberation, code views and funky stuff.

Between working on the ensime core and the ensime analyser stuff I've started playing with creating a scalajs wrapper around Ace.

Its all a long way off, but I should get a chuck of time in a few months to pull together a full prototype - until then I am adding supporting features to Ensime to better support other editors.  @fommil has also been working on a better protocol layer so we can support Swank and json protocols to make integration easier.

Cheers

Rory

You received this message because you are subscribed to the Google Groups "ENSIME" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ensime+un...@googlegroups.com.

Viktor Hedefalk

unread,
Apr 1, 2015, 4:21:34 AM4/1/15
to ens...@googlegroups.com
Hi Rory,

That sounds awesome! Really cool!

Late yesterday I actually started looking into the protocol to see if it would be hard to make a json version. It seems that you have been separating it out pretty neatly, but there is no branch with json already implemented is there?

I've been using argonaut.io successfully for doing scala json before so that was what I was going to try out. It's purely function type class based and really neat. And fast.

However, I need to be really lazy about this right now, and I already have js that seems to work reasonable with swank so I'm going to leave that off for now. I need to get going with the atom ui stuff first. But if there is some work going on with json, I would definitely want to use it. Also it would be really cool to share more of the common stuff that is bound to turn up between atom and ace!

For now I'm going to just hack away with my crappy coffescript or typescript and see if I can get anything useful done. But please let me now if/when you're ready to share some of your work and I'll definitely piggback :)

No, but seriously, it would be great to have the common stuff shared and not re-invent anything.

Cheers,
Viktor

Sam Halliday

unread,
Apr 2, 2015, 6:03:33 AM4/2/15
to ens...@googlegroups.com

Viktor Hedefalk

unread,
Apr 2, 2015, 7:54:42 AM4/2/15
to ens...@googlegroups.com
Sweet!

Viktor Hedefalk

unread,
Apr 3, 2015, 12:49:33 PM4/3/15
to ens...@googlegroups.com
Hi, I'm trying to setup so that Atom starts the server the same way that Emacs does it. Until now I have just started it separately with a script. So I installed Ensime in Emacs and run it a project and then:

"You can study the generated .ensime_cache/build.sbt file in an ENSIME project to learn how to start the server."

However,

~/dev/projects/kostbevakningen/.ensime_cache $ ll
total 8
drwxr-xr-x   6 viktor  staff   204B Apr  3 18:25 ./
drwxr-xr-x  27 viktor  staff   918B Apr  2 23:34 ../
drwxr-xr-x   3 viktor  staff   102B Apr  3 18:25 dep-src/
drwxr-xr-x  27 viktor  staff   918B Apr  2 23:35 index-1.0/
-rw-r--r--   1 viktor  staff     6B Apr  3 18:21 port
drwxr-xr-x   3 viktor  staff   102B Apr  2 23:34 sql-1.0/

Is it only there temporarily or how does it work? Has it moved maybe? Is it 

Cheers,
Viktor

Viktor Hedefalk

unread,
Apr 3, 2015, 12:51:34 PM4/3/15
to ens...@googlegroups.com
Hi, I'm trying to setup so that Atom starts the server the same way that Emacs does it. Until now I have just started it separately with a script. So I installed Ensime in Emacs and run it a project and then:

"You can study the generated .ensime_cache/build.sbt file in an ENSIME project to learn how to start the server."

However,

~/dev/projects/kostbevakningen/.ensime_cache $ ll
total 8
drwxr-xr-x   6 viktor  staff   204B Apr  3 18:25 ./
drwxr-xr-x  27 viktor  staff   918B Apr  2 23:34 ../
drwxr-xr-x   3 viktor  staff   102B Apr  3 18:25 dep-src/
drwxr-xr-x  27 viktor  staff   918B Apr  2 23:35 index-1.0/
-rw-r--r--   1 viktor  staff     6B Apr  3 18:21 port
drwxr-xr-x   3 viktor  staff   102B Apr  2 23:34 sql-1.0/

Is it only there temporarily or how does it work? Has it moved maybe? Is it 

Cheers,
Viktor

On Thursday, April 2, 2015 at 1:54:42 PM UTC+2, Viktor Hedefalk wrote:

Sam Halliday

unread,
Apr 3, 2015, 12:51:50 PM4/3/15
to ens...@googlegroups.com
yeah, this changed a month or two ago. A few people are doing what you're doing.

Have a look in the ensime-startup.el file. Nowadays we just use sbt to download the jars and tell us the classpath, then we start the JVM process directly. It's a lot cleaner.

Viktor Hedefalk

unread,
Apr 3, 2015, 3:54:15 PM4/3/15
to ens...@googlegroups.com
Thanks!

And sorry for double-posting unfinished msg :)

Cheers,
Viktor

Viktor Hedefalk

unread,
Apr 4, 2015, 6:25:47 PM4/4/15
to ens...@googlegroups.com
Hi,

I just wanted to say that I made a little bit of progress. I have basic working "jump to definition" in Atom. Opens the file (reuses pane if already open) and puts cursor at definition. (I love that you guys have unzipped the sources of my deps already so I didn't have to think about that :)

I also found that iterm2 nightly have working "open file path in app" which works "ok". https://code.google.com/p/iterm2/issues/detail?id=3476

Basically I can sbt ~compile and cmd-click file names in the error messages and they will open in the last used project in Atom. However, the line number isn't carried over so it wont be good enough. But I'm pretty pumped up about taking the Atom Ensime integration further. So probably will start looking into error highlighting. Or maybe start with a error panel.

Anyway, I think it looks promising integrating Ensime and Atom.

I still run the server manually (just copied the script from Emacs). And the code is terrible so give me another week to wrap something up that is a little less embarrassing and more approachable.

My agenda looks something like:

- [x] jump to definition
- [ ] key shortcuts
- [ ] mouse interaction (cmd-click for jump to definition)
- [ ] errors and warnings
- [ ] get server "bundled" the same way Emacs does it
- [ ] hover (or something) for type info
- [ ] autocompletion
- [ ] view applied implicits
- [ ] json instead of swank

Any input highly appreciated!

Cheers,
Viktor

Viktor Hedefalk

unread,
Apr 5, 2015, 11:32:38 AM4/5/15
to ens...@googlegroups.com
Hm, it seemed to really work well, but now I sometimes get logs like these:

17:27:33.727 [default-akka.actor.default-dispatcher-16] INFO  o.e.s.protocol.swank.SwankProtocol - Received msg: (:swank-rpc (swank:type-at-point "/Users/viktor/dev/projects/kostbevakningen/src/main/scala/bootstrap/liftweb/Boot.scala" 320) 6)
17:27:33.731 [default-akka.actor.default-dispatcher-16] INFO  o.e.s.protocol.swank.SwankProtocol - Writing: (:return (:ok nil) 6)

where position 320 is right over a symbol. Is there any prerequisites that need to be fulfilled to ask type-at-point?

Cheers,
Viktor

laugh...@gmail.com

unread,
Apr 5, 2015, 12:27:16 PM4/5/15
to ens...@googlegroups.com
Hi Viktor!

Thanks for the tip about iTerm2. It work for me with the stable version two. And to jump to the line, you should use "Run command" option with "atom \1:\2".
Glad to hear that you have some progress already!

Viktor Hedefalk

unread,
Apr 5, 2015, 4:52:46 PM4/5/15
to ens...@googlegroups.com, laugh...@gmail.com
Cool,

I couldn't get the line number thing to work though. You sure you put 'atom \1:\2' there? For me nothing happens. Atom isn't opened. atom is on path though. Weird.



On the subject of type-at-point I also get half-baked answers like:

22:32:44.542 [default-akka.actor.default-dispatcher-9] INFO  o.e.s.protocol.swank.SwankProtocol - Received msg: (:swank-rpc (swank:type-at-point "/Users/viktor/dev/projects/kostbevakningen/src/main/scala/se/kostbevakningen/snippet/EditIngredient.scala" 1490) 3)
22:32:46.789 [default-akka.actor.default-dispatcher-9] INFO  o.e.s.protocol.swank.SwankProtocol - Writing: (:return (:ok (:arrow-type nil :name "<notype>" :type-id 1 :decl-as nil :full-name "<none>.<none>" :type-args nil :members nil :pos nil :outer-type-id nil)) 3)

This definitely worked yesterday, it's weird…

Using Emacs I got stackoverflows from the richpresentation compiler:

22:44:59.175 [default-akka.actor.default-dispatcher-16] ERROR o.e.core.RichPresentationCompiler - Error during askOption
java.lang.StackOverflowError: null
at scala.tools.nsc.Global.log(Global.scala:305) ~[scala-compiler-2.11.5.jar:na]
at scala.tools.nsc.Global.devWarning(Global.scala:295) ~[scala-compiler-2.11.5.jar:na]
at scala.tools.nsc.Global.devWarning(Global.scala:289) ~[scala-compiler-2.11.5.jar:na]
at scala.reflect.internal.Symbols$NoSymbol.owner(Symbols.scala:3520) ~[scala-reflect-2.11.5.jar:na]
at org.ensime.model.Helpers$class.symbolIndexerName(Helpers.scala:106) ~[server_2.11.jar:0.9.10-SNAPSHOT]
at org.ensime.core.RichPresentationCompiler.symbolIndexerName(RichPresentationCompiler.scala:184) ~[server_2.11.jar:0.9.10-SNAPSHOT]
at org.ensime.model.Helpers$class.symbolIndexerName(Helpers.scala:106) ~[server_2.11.jar:0.9.10-SNAPSHOT]
at org.ensime.core.RichPresentationCompiler.symbolIndexerName(RichPresentationCompiler.scala:184) ~[server_2.11.jar:0.9.10-SNAPSHOT]
at org.ensime.model.Helpers$class.symbolIndexerName(Helpers.scala:106) ~[server_2.11.jar:0.9.10-SNAPSHOT]
at org.ensime.core.RichPresentationCompiler.symbolIndexerName(RichPresentationCompiler.scala:184) ~[server_2.11.jar:0.9.10-SNAPSHOT]
...


Cheers,
Viktor

Alexey Alekhin

unread,
Apr 5, 2015, 4:59:00 PM4/5/15
to Viktor Hedefalk, ens...@googlegroups.com
Try putting there the full path to atom executable instead

Viktor Hedefalk

unread,
Apr 6, 2015, 8:13:27 AM4/6/15
to ens...@googlegroups.com, hede...@gmail.com, laugh...@gmail.com
Thanks, that works!

Cheers,
Viktor

Viktor Hedefalk

unread,
Apr 21, 2015, 5:34:00 AM4/21/15
to ens...@googlegroups.com, hede...@gmail.com, laugh...@gmail.com
Hi again,

I have a proof of concept that has a few features implemented now. If someone with a bit of patience want to try it out I'd be really happy! Got to warn though that I haven't tested it on many projects or environments, so that is kind of what I'm asking help to do :)

Here's the link with at bit of status:



To install, just apm install ensime or do it from within atom gui.

I just pushed a version where I think server updates finally works as in Emacs. So at first startup, the package notices that there is no classpath file for the scala/ensime version combo and runs sbt to download deps and write out a classpath file. and when this is done the server starts up. There might be some issues here with timeouts and stuff. I wanted this all to be implicit so that the user didn't have to first run a "update server" task and then "start ensime server", "start ensime client" or whatever, so there's only "ensime: start" now which is supposed to do it all just like Emacs. However, there might be bugs here and timeouts are a problem maybe. If on a cell and don't have the deps in .ivy the one's I set up are probably too short, but I felt I needed some kind of timeout behaviour though. Haven't thought it through really :)

Oh, also, it just assumes you're in a project with .ensime. No choosing of file name yet.

Anyway, please try it and report issues or give me any feedback!

Features are:

* hover for type
* alt-click for go to definition
* simple error reporting on cmd, save or while typing
* autocomplete on tab

Everything is rather crude and basic but I wanted to have a proof of concept as quickly as possible. I'm all ears to suggestions!

I think for myself I'm gonna work on better error reporting and implicit info and try to get the current features better generally.

Cheers,
Viktor

Rory Graves

unread,
Apr 21, 2015, 5:46:44 AM4/21/15
to ens...@googlegroups.com, hede...@gmail.com, laugh...@gmail.com
That is very cool!  That's really amazing progress. Will try this as soon as I have he chance. 

Cheers

Rory

Martin Mauch

unread,
Apr 21, 2015, 8:29:33 AM4/21/15
to ens...@googlegroups.com, laugh...@gmail.com, hede...@gmail.com
I just tried atom-ensime and could get F4 for jump to definition and alt+hover for type inspection to work.
Typing a tab after a dot just inserts a tab in my case. Do I have to configure something for the autocompletion?

Viktor Hedefalk

unread,
Apr 21, 2015, 8:37:44 AM4/21/15
to Martin Mauch, ens...@googlegroups.com, laugh...@gmail.com
Hm…

Oh, maybe you need the autocomplete-plus package. Yeah, I think that's it! I kindof thought the automatic deps management of atom would just sort that out, but not in this case.

Thing is that for this feature the autocomplete-plus is pulling the strings and the ensime package is just a "provider". So yeah, without autocomplete-plus, no autocomplete. 


Thanks for reporting! Will put it in readme.

Aemon Cannon

unread,
Apr 21, 2015, 10:57:08 AM4/21/15
to ens...@googlegroups.com, Martin Mauch, laugh...@gmail.com
Impressive progress!
Reply all
Reply to author
Forward
0 new messages