Skip to content

Latest commit

 

History

History
107 lines (71 loc) · 3.53 KB

File metadata and controls

107 lines (71 loc) · 3.53 KB

CodeFellow

Scala development tool for Vim and Sbt

Note: CodeFellow is still in alpha state!

Features

The following features are already implemented in Vim:

  • Member completion
  • Scope completion
  • Get type information for expressions
  • Compiler errors are shown in Vim (quickfix + markers)
  • Support for multi-module builds (each module will have it’s own classpath)

Planned:

  • Jump to definition
  • Automatically add ‘(’ and ‘)’ based on the method return type and parameters
  • Completion for named arguments in method invocations
  • Organize imports (like in Eclipse)

Requirements

  • Scala 2.8
  • Sbt project
  • Vim (tested with version 7.2)
    • Compiled with Python support
    • (Optional) Compiled with +balloon_eval for mouse hover type information

Installation

1. Build CodeFellow

git clone git://github.com/romanroe/codefellow.git
cd codefellow
sbt update publish-local

2. Install the Vim plugin

cp <<codefellow_dir>>/vim/plugin/codefellow.vim ~/.vim/plugin/

3. Add the CodeFellow plugin to your project (project/plugins/Plugins.scala)

import sbt._
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
  val codefellow = "de.tuxed" % "codefellow-plugin" % "0.3"
}

4. Mixin the CodeFellow trait to your project definition

class YourProject(info: ProjectInfo)
extends ParentProject(info)
with de.tuxed.codefellow.plugin.CodeFellowPlugin { 
  ...
}

5. Run the plugin:

sbt codefellow

6. Start the CodeFellow deamon from your project root directory (this step will get merged with the above one in the future)

java -cp <codefellow_dir>>/project/boot/scala-2.8.0.RC5/lib/scala-library.jar:\
         <codefellow_dir>>/project/boot/scala-2.8.0.RC5/lib/scala-compiler.jar:\
         <codefellow_dir>>/codefellow-core/target/scala_2.8.0.RC5/classes \
         de.tuxed.codefellow.Launch

7. Start Vim and open a Scala file that belongs to your project

Usage

Note: The first invocation of a CodeFellow feature might take a couple of seconds since the compiler daemon for each module in your build will be started on demand.

8. Customize connection settings. see vim/autoload/codefellow.vim
section “connection to server / optional server startup”

9. debugging:
execute:
set this in your ~/.vimrc:
let g:codefellow_verbose = 1
py doDebug=True
also watch the logfile: g:codefellow_server_logfile
g:codefellow_last_exception contains the text of the last received failure

The following key bindings are available:

Key Mode Description
Ctrl+s Ctrl+m insert mode Activate member completion function and trigger omni completion (triggers buffer save)
Ctrl+s Ctrl+s insert mode Activate scope completion function and trigger omni completion (triggers buffer save)
F9 command mode Compile the current file and show compiler errors
Ctrl+s Ctrl+t or F1 command mode Print type information of expression under cursor

Screencast

Check out the screencast to see CodeFellow in action!

Contributions

Thanks a lot to Marc Weber and Eric Sessoms !

Acknowledgement

  • Almost all functionality for the code completion is already implemented in the Scala compiler. CodeFellow would not be possible without the work of the Scala compiler team!
  • I learned most about the Scala compiler by looking at and using the source code from Aemon Cannon’s emacs mode ensime. Thank you!