Atom Ensime
This is a work in progress to try to use Ensime functionality in Atom Way early still and will most likely be very buggy. Or maybe not start at all. Please try it out, be patient and report any issues!
Prerequisites
- sbt (used to bootstrap server)
- .ensime file. generate with sbt gen-ensime
Getting started
- Open a project with a .ensime in root
- Make sure to put path of sbt in settings.
- cmd-shift-P Ensime: Start.
- Then you can use the features marked x below :)
Complementing packages
Automatically installed:
- language-scala for syntax highlighting.
- hyperclick for code navigation. Ensime hooks in as provider.
Recomended:
- Project manager is really handy to keep track of projects.
- Need plugin to navigate back to last cursor position when "code surfing". Maybe https://atom.io/packages/last-cursor-position
Features:
-
Jump to definition (cmd-click or f4)
-
Hover for type info
-
Errors and warnings (Cmnds for typecheck file, typecheck buffer, typecheck all). Also setting for typecheck current file on save or while typing.
-
Basic autocompletion
-
Format source file
-
mark applied implicits (conversions and params)
-
show applied implicits
-
Goto type by simple typing prefix (like cmd-N in Idea or cmd-shift-T in Eclipse?)
-
Organize imports
-
Import type at point
-
Better errors and warnings with markings in gutter
-
"explicify" applied implicits
-
Find all subclasses of the class under the cursor
-
Find all usages of the function under the cursor
-
insert your suggestion
Dev
- checkout from git straight into .atom/packages (or ln -s). Need to have the right name on the folder: "Ensime".
- run apm install
- "Window: reload" (ctrl-option-cmd l) to reload plugin from source while developing
- In developer tools:
client = atom.packages.getActivePackage('Ensime').mainModule.client
client.getImportSuggestions('ApiLogRequest')
Discuss:
https://groups.google.com/forum/#!searchin/ensime/log/ensime/1dWUQwnFoyk/0O12KPjaIBgJ https://gitter.im/ensime/ensime-atom
Technical TODO:
- checkout typescript plugin for hover for type info
- option to start server detached for ease of debugging: https://nodejs.org/api/child_process.html#child_process_options_detached
- update server log in a panel in atom
- Use port file to check for running server
- Remove "start-server" and let init do it all
- EditorControl leaks and keeps swank client on stop. Fix some cleanup!
- Remove flowController-thing and look at Haskell IDE.
- Make "start ensime" to start server(maybe) and client and "stop ensime" kill both
- setting for typechecking current file: ask, on save, while typing + delay ms setting
- only try start server if no port-file
- put console logging under dev-flag or just move to separate log
- Handle types of autocompletion. Weird swank?
- TEEEESTS! Mostly because turnaround is killing me
- re-insert activation events when this hits atom/settings-view#371
- Make update of server implicit from startup'
- Seems we're dependent on language-scala package. At least code-links doesn't seem to realize .scala are source.scala)
- ditch swank for jerk
- Setting for autocomplete - "excludeLowerPriority"
- Autocomplete: :type-sig (((("x" "Int") ("y" "Int"))) "Int")
- Separate each feature in own Editor Controller?
- See if we can use code-links for mouse clicks https://atom.io/packages/code-links (Not gonna do it)
- Check if we can get rid of terminal escape stuff from log. Look at term2 or ask.
- getPath is deprecated: https://github.com/atom/atom/blob/master/src/project.coffee#L471 Maybe need to ask about where .ensime is like Emacs.
- Use path.dirname(module.filename) instead of package name lookup? https://github.com/paulpflug/vue-hello-world/blob/master/lib/vue-hello-world.coffee#L31
- Use .vue https://github.com/vuejs/vueify#compiler-api
- If error with "not found" -> alt-enter for quick import just like idea
- Check out https://github.com/OmniSharp/omnisharp-atom Seems we can learn a lot!
- Create FRP stream for editors that features can use.
- Wait for analyzer ready msg - (:return (:abort 209 "Analyzer is not ready! Please wait.") 4)
- server will stop logging when atom is reloaded since stdio is piped via node. Pipe to file directly from process and tail -f to buffer in atom?
- add a bottom panel with tabs (one for errors/warnings, one for server log maybe)
- Look how https://github.com/OmniSharp/omnisharp-atom/wiki makes autocomplete and linter install automatically
- Rewrite core parts in scala.js, reuse msg classes from ensime and so forth. Make atom interface for scala.js.
Inspiration (steal if you can)
- https://github.com/lukehoban/atom-ide-flow/
- code-links
- https://github.com/atom/atom/blob/master/src/text-editor-component.coffee#L365
- https://github.com/TypeStrong/atom-typescript/
- https://github.com/chaika2013/ide-haskell/
Links
- https://github.com/ensime/
- Protocol: https://github.com/ensime/ensime-server/blob/master/swank/src/main/scala/org/ensime/server/protocol/swank/SwankProtocol.scala
- Emacs command ref: https://github.com/ensime/ensime-server/wiki/Emacs-Command-Reference
- Ensime google group: https://groups.google.com/forum/#!forum/ensime
- Startup of server from Emacs https://github.com/ensime/ensime-emacs/blob/master/ensime-startup.el
- Space pen https://github.com/atom/space-pen/blob/master/src/space-pen.coffee
- Space pen views https://github.com/atom/atom-space-pen-views/blob/master/src/scroll-view.coffee
- Find and replace:https://github.com/atom/find-and-replace/blob/master/lib/project/results-pane.coffee