Skip to content

Commit

Permalink
Version 0.2.21: Type and Package Inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
richard emberson authored and vim-scripts committed Apr 1, 2013
1 parent bec24e4 commit e58b889
Show file tree
Hide file tree
Showing 24 changed files with 3,808 additions and 129 deletions.
196 changes: 188 additions & 8 deletions README
@@ -1,10 +1,27 @@
This is a mirror of http://www.vim.org/scripts/script.php?script_id=4298 This is a mirror of http://www.vim.org/scripts/script.php?script_id=4298


This is the pre-alpha release of Vimside (Vim Scala IDE). Vimside is This is the alpha release of Vimside (Vim Scala IDE). Vimside is
built upon the ENSIME server: github: https://github.com/aemoncannon/ensime built upon the ENSIME server: github: https://github.com/aemoncannon/ensime
manual: http://aemoncannon.github.com/ensime/index.html manual: http://aemoncannon.github.com/ensime/index.html


I expect to continue to update the sources on github frequently, flushing Two outstanding Ensime features to be implemented are more
regression tests and debugging.

With this release, variable at bottom of the plugin/vimside.vim file
have been added which allows one to turn on logging during Vimside Option
loading. For the Vimside logger, Options must first be loaded
in order to configure it. Thus, no logging when loading Options.
So, I added a non-configurable logger that only logs in the
vimside#options#manager.vim file. Hopefully, this will help
users figure out whats happening during option loading.

Also, the example project code has been moved under the directory
data/vimside/projects - since there are now two example projects
and will be a couple more in the future. Additionally, the tests
have been moved under data/vimside/tests. I will be adding more
unit/regression tests in the future.

I expect to continue to update the sources on github frequently, flushing
out the features. https://github.com/megaannum/vimside out the features. https://github.com/megaannum/vimside


Vimside communicates with the Ensime server using Shougo vimproc Vimside communicates with the Ensime server using Shougo vimproc
Expand All @@ -14,7 +31,7 @@ ptys, files, etc.). Vimside also uses Shougo vimshell to launch and
communicate with the Scala Repl. communicate with the Scala Repl.


The current pre-alpha has only be run against the Ensime pre-built The current pre-alpha has only be run against the Ensime pre-built
ensime_2.9.2-0.9.8.1.tar.gz and ensime_2.10.0-0.9.8.5.tar.gz ensime_2.9.2-0.9.8.9.tar.gz and ensime_2.10.0-0.9.8.9.tar.gz
downloads. downloads.


Look at the plugin/vimside.vim file for key mappings: how to start the Look at the plugin/vimside.vim file for key mappings: how to start the
Expand Down Expand Up @@ -166,16 +183,19 @@ Current Supported Ensime Commands:
Very Useful. Very Useful.
Implementations: 1 Implementations: 1



Ensime Capabilities to be Supported:

Package Inspector Package Inspector
Inspect imported package, current file's package and the package Inspect imported package, current file's package and the package
specified in the ensime configuration ':package'. specified in the ensime configuration ':package'.
Very Useful.
Implementations: 1


Type Inspector Type Inspector
Click on type and see information, Click on information and see its Click on type and see information, Click on information and see its
information. Move about Inspector history. information. Move about Inspector history.
Very Useful.
Implementations: 1

Ensime Capabilities to be Supported:


Scalex Scalex
Seems to be a dead project (see: http://scalex.org/) Seems to be a dead project (see: http://scalex.org/)
Expand All @@ -197,3 +217,163 @@ Ensime Capabilities to be Supported:


And others And others


Key Mappings
" Start Ensime
if has("gui_running")
<m-x>
else
<Leader>vs
endif
" Stop Vimside
<Leader>vS

" TAB
" Start completing a method/variable.
<tab>

" Inspect the type of the expression under the cursor.
<Leader>ti
" Inspect package at point
<Leader>tp
" Inspect the project package if set in envime configure file.
<Leader>to


" M-. (dot)
" Jump to definition of symbol under cursor.
" Note that the Meta/Alt keys, while easy to use with GVim, are,
" at best, an advanture and, at worst, impossible, to get working
" with non-GVim - thus the mapping is different for non-gui-running.
if has("gui_running")
<m-.>
else
<Leader>m.
endif

" M-, (comma)
" Pop back to previously visited position.
if has("gui_running")
<m-,>
else
<Leader>m,
endif

" Select the surrounding syntactic context. Subsequent taps of '.'
" and ',' will grow and shrink the selection, respectively.
<Leader>v.
<Leader>v,

" Search globally for methods or types.
<Leader>vv

" Scalex search for methods or types.
" NOT IMPLEMENTED YET

" Show (web api) documentation for symbol at point
<Leader>vt

" Mouse Hover
" Echo the type of the expression under the cursor.
<Leader>vh

" Inspect the package of the current source file.
" NOT IMPLEMENTED YET

" List all references to the symbol under the cursor.
<Leader>vr

" Switch to the sbt command-line (works for sbt projects only)
" s sbt switch
<Leader>ss
" sbt do compile
<Leader>sc
" sbt do clean
<Leader>sn
" sbt do package
<Leader>sp
" sbt do exit
<Leader>se

" invoke the sbt command interpreter
<Leader>si

" Switch to the scala interpreter, with project classes in the classpath.
<Leader>vz

" Typecheck the current file.
<Leader>vc

" Typecheck all files in the project.
<Leader>va

" (Re-)Show all errors and warnings in the project.
<Leader>ve

" Format the current Scala source file.
<Leader>vf

" Undo a refactoring or formatting change.
" NOT IMPLEMENTED YET

" Go to the next compilation note in the current buffer.
" NOT IMPLEMENTED YET

" C-c C-d x
" Where x is one of:
" d Start and run the debugger.
" r Start and run the debugger.
" b Set a breakpoint.
" u Clear a breakpoint.
" s Step.
" n Step over.
" o Step out.
" c Continue from a breakpoint.
" q Kill the debug session.
" i Inspect the local variable at cursor.
" t Show backtrace.
" a Clear all breakes
" NOT IMPLEMENTED YET

" Where x is one of:
" r Rename the symbol at point.
<Leader>rr
" o Organize imports.
<Leader>ro
" l Extract local.
<Leader>rl
" m Extract method.
<Leader>rm
" i Inline local.
<Leader>ri
" t Add import for type at point.
<Leader>rt

" Import suggestions
<Leader>vi

" Where x is one of:
" b Build the entire project.
" r Rebuild the project, incrementally.
<Leader>vbb
<Leader>vbr

" Reload the .ensime file and recompile the project. Useful if you hit
" a server bug.
" NOT IMPLEMENTED YET

" Start the automatic configuration file generator.
" NOT IMPLEMENTED YET

" Make PopUp
<Leader>vp

" browse source roots
<Leader>vBs
" browse referenct source roots
<Leader>vBr

" option editor
<Leader>voe



72 changes: 56 additions & 16 deletions README.md
Expand Up @@ -11,11 +11,37 @@ Only a small number of all of the ENSIME capabilities have
been implemented and it has only been tested against the been implemented and it has only been tested against the
very small Scala/Java test source project bundled with it. very small Scala/Java test source project bundled with it.


There is now included initial support for SBT (simple build tool). With lastest checkin, there is the first cut of the Type and
Package Inspector. There will certainly be bugs.
For types, place cursor over type and enter \<Leader>ti.
For package, place cursor over package path and enter \<Leader>tp.
Do not know if the project package inspector works yet.

Inspector keymaps:

<Leader>ti inspect type (cursor over type)
<Leader>tp inspect package (cursor over package path at top of file)
<Leader>to inspect project package

Inspector control:

In inspector pressing <F1> gets help.
<Leader> q : quit
<Leader> <CR> : inspect type at point
<Leader> <TAB> : next type
<Leader> <C-n> : next type
<Leader> <S-TAB>: previous type (S-TAB may not work)
<Leader> <C-p> : previous type
<Leader> n : next history
<Leader> p : previous history

Entering and leaving Type Inspector multiple times has not been
tested very much.

There is now included support for SBT (simple build tool).
The test project is in the data/tests/sbt directory. The The test project is in the data/tests/sbt directory. The
plugin/vimside.vim file has key mappings for functions that plugin/vimside.vim file has key mappings for functions that
start, compile, clean, package and exit from the SBT. start, compile, clean, package and exit from the SBT.
More support will be added in future weeks (Sun Feb 10 2013).


I have checked the source into github primarily so that I have checked the source into github primarily so that
the source is somewhere other than on my local machines. the source is somewhere other than on my local machines.
Expand All @@ -25,9 +51,9 @@ frequently, flushing out the features.
###Current Supported Ensime Commands: ###Current Supported Ensime Commands:
|feature|description|implementations| |feature|description|implementations|
|-------|-----------|---| |-------|-----------|---|
|Start Ensime|makes sure that the current environment and Option settings are correct and then launches the Ensime backend server. The Ensime server writes a file where it puts the socket port that its client should use. Vimside reads that file, gets the port number, and provides Ensime with configuration information.|| |Start Ensime|makes sure that the current environment and Option settings are correct and then launches the Ensime backend server. The Ensime server writes a file where it puts the socket port that its client should use. Vimside reads that file, gets the port number, and provides Ensime with configuration information.|1|
|Stop Ensime|There is also an autocmd that will kill the Ensime server when the user exists Vim.|| |Stop Ensime|There is also an autocmd that will kill the Ensime server when the user exists Vim.|1|
|Map `<Tab>` to Omni-Code Completion in insert mode|This mapping maybe overridden by the mapping is some other plugin (like a snipmate binding), So, if it does not seem to work for you list the current mappings and see what is overriding it. Very Useful.|| |Map `<Tab>` to Omni-Code Completion in insert mode|This mapping maybe overridden by the mapping is some other plugin (like a snipmate binding), So, if it does not seem to work for you list the current mappings and see what is overriding it. Very Useful.|1|
|Symbol At Point|With cursor on variable, jump to the definition of its symbol. One can easily jump back and forth. The Emacs key binding uses the Meta key. In GVim I could get this to work and so in GVim the key mapping mirrors the Emacs Ensime key binding. But, with Vim in an XTerm, I could not get the Meta/Alt key to be recognized (and there is NO single place where there is a definitive, failsafe guide for getting Meta/Alt key mappings to work, so I have a different binding for Vim. Very useful.|1| |Symbol At Point|With cursor on variable, jump to the definition of its symbol. One can easily jump back and forth. The Emacs key binding uses the Meta key. In GVim I could get this to work and so in GVim the key mapping mirrors the Emacs Ensime key binding. But, with Vim in an XTerm, I could not get the Meta/Alt key to be recognized (and there is NO single place where there is a definitive, failsafe guide for getting Meta/Alt key mappings to work, so I have a different binding for Vim. Very useful.|1|
|Selection Expand/Contract|Select the surrounding syntactic context and easily shrink/grow the selection.|2| |Selection Expand/Contract|Select the surrounding syntactic context and easily shrink/grow the selection.|2|
|Global Public Search|Search for method or types through project code using space separated search terms. Useful.|1| |Global Public Search|Search for method or types through project code using space separated search terms. Useful.|1|
Expand All @@ -47,12 +73,12 @@ frequently, flushing out the features.
|Browse Reference Source Roots|Directory browser of project reference sources (Java and Scala libraries).|2| |Browse Reference Source Roots|Directory browser of project reference sources (Java and Scala libraries).|2|
|Option Viewer/Editor|Bring up the Option Viewer/Editor (requires Forms library). Lets one see all of the Vimside configurable Options and their current value. To be implemented will be an Editor allowing for the modification of some "dynamic" Options at runtime.|1| |Option Viewer/Editor|Bring up the Option Viewer/Editor (requires Forms library). Lets one see all of the Vimside configurable Options and their current value. To be implemented will be an Editor allowing for the modification of some "dynamic" Options at runtime.|1|
|Completions|OmmiCompletions using `<c-x><c-o>`.Very Useful.|1| |Completions|OmmiCompletions using `<c-x><c-o>`.Very Useful.|1|
|Package Inspector|Inspect imported package, current file's package and the package specified in the ensime configuration `:package`. Very Useful|1|
|Type Inspector|Click on type and see information, Click on information and see its information. Move about Inspector history. In Inspector help <F1>. Very Useful|1|


###Ensime Capabilities to be Supported: ###Ensime Capabilities to be Supported:
|feature|description| |feature|description|
|---|---| |---|---|
|Package Inspector|Inspect imported package, current file's package and the package specified in the ensime configuration `:package`.|
|Type Inspector|Click on type and see information, Click on information and see its information. Move about Inspector history.
|Scalex|Seems to be a dead project (see: http://scalex.org/)| |Scalex|Seems to be a dead project (see: http://scalex.org/)|
|Run Application|| |Run Application||
|Debug Application|Start and run the debugger. Start and run the debugger. Set a breakpoint. Clear a breakpoint. Step. Step over. Step out. Continue from a breakpoint. Kill the debug session. Inspect the local variable at cursor. Show backtrace.| |Debug Application|Start and run the debugger. Start and run the debugger. Set a breakpoint. Clear a breakpoint. Step. Step over. Step out. Continue from a breakpoint. Kill the debug session. Inspect the local variable at cursor. Show backtrace.|
Expand Down Expand Up @@ -240,7 +266,7 @@ Also you'll need to run `make` in vimproc directory.
###[Manual](http://aemoncannon.github.com/ensime/index.html/) ###[Manual](http://aemoncannon.github.com/ensime/index.html/)


In addition, for ENSIME, there are pre-built releases available at: https://github.com/aemoncannon/ensime/downloads. In addition, for ENSIME, there are pre-built releases available at: https://github.com/aemoncannon/ensime/downloads.
I highly recommend getting these (Scala 2.9.2 and/or 2.10.0-RC) I highly recommend getting these (Scala 2.9.2 and/or 2.10.0)
rather than trying to build the Ensime Scala code yourself. rather than trying to build the Ensime Scala code yourself.


Ensime is not a Vim plugin. It is a Scala program. It has to be installed and built or a pre-build version has to be used. It can be downloaded from: https://github.com/aemoncannon/ensime Ensime is not a Vim plugin. It is a Scala program. It has to be installed and built or a pre-build version has to be used. It can be downloaded from: https://github.com/aemoncannon/ensime
Expand All @@ -259,9 +285,9 @@ The Ensime build directory has the following layout using
lib/ lib/
README.md README.md


or `ensime_2.10.0-RC3-0.9.8.2`: or `ensime_2.10.0-0.9.8.5`:


ensime_2.10.0-RC3-0.9.8.2/ ensime_2.10.0-0.9.8.5/
bin/ bin/
elisp/ elisp/
lib/ lib/
Expand All @@ -272,7 +298,7 @@ It is important that the value of the `vimside-scala-version`
Option agrees with the Ensime build version. For Option agrees with the Ensime build version. For
`ensime_2.9.2-0.9.8.1` (the default value): `ensime_2.9.2-0.9.8.1` (the default value):
call owner.Set("vimside-scala-version", "2.9.2") call owner.Set("vimside-scala-version", "2.9.2")
and for `ensime_2.10.0-RC3-0.9.8.2`: and for `ensime_2.10.0-0.9.8.5`:
call owner.Set("vimside-scala-version", "2.10.0") call owner.Set("vimside-scala-version", "2.10.0")


These values can be set in `data/vimside/options_user.vim`. These values can be set in `data/vimside/options_user.vim`.
Expand Down Expand Up @@ -314,7 +340,7 @@ For example:
call owner.Set("ensime-dist-dir", "ensime_2.9.2-0.9.8.1") call owner.Set("ensime-dist-dir", "ensime_2.9.2-0.9.8.1")


or or
call owner.Set("ensime-dist-dir", "ensime_2.10.0-RC3-0.9.8.2") call owner.Set("ensime-dist-dir", "ensime_2.10.0-0.9.8.5")


Alternatively, you can specify the full path to the ensime distribution Alternatively, you can specify the full path to the ensime distribution
using the Option `ensime-dist-path`. As an example, if you installed using the Option `ensime-dist-path`. As an example, if you installed
Expand All @@ -326,10 +352,24 @@ the Option as:
If you set the `ensime-dist-path`, it is checked first and if it exists it If you set the `ensime-dist-path`, it is checked first and if it exists it
is used rather than the `ensime-install-path` and `ensime-dist-dir` combination. is used rather than the `ensime-install-path` and `ensime-dist-dir` combination.


Currently, Vimside does not support the Ensime SBT commands (yet to be With SBT support, there is a SBT Plugin that supports integration with
implemented). When such support is created, there is an additional the ENSIME IDE:
library, an SBT Plugin that supports integration with the ENSIME IDE:
https://github.com/aemoncannon/ensime-sbt-cmd https://github.com/aemoncannon/ensime-sbt-cmd
Follow the directions there and add

addSbtPlugin("org.ensime" % "ensime-sbt-cmd" % "VERSION")

to your ~/.sbt/plugins/plugins.sbt file
Where "VERSION" it the version of Ensime supported which, as
the ensime-sbt-cmd README.md states, is 0.1.1. So, the above
should be:

addSbtPlugin("org.ensime" % "ensime-sbt-cmd" % "0.1.1")

Entering "ensime generate" while running sbt does indeed
generate a ".ensime" file. I have not tested whether or not
that generated file can actually be used by Vimside and
passed to the backend Ensime server.


---- ----


Expand Down Expand Up @@ -392,7 +432,7 @@ So, in the `options_user.vim` one might have:
in a project file there might be: in a project file there might be:


call owner.Update("vimside-scala-version", "2.10.0") call owner.Update("vimside-scala-version", "2.10.0")
call owner.Update("ensime-dist-dir", "ensime_2.10.0-RC3-0.9.8.2") call owner.Update("ensime-dist-dir", "ensime_2.10.0-0.9.8.5")
call owner.Update("ensime-config-file-name", "_ensime") call owner.Update("ensime-config-file-name", "_ensime")


An alternative approach is to also treat the `data/vimside/` test code An alternative approach is to also treat the `data/vimside/` test code
Expand Down

0 comments on commit e58b889

Please sign in to comment.