Permalink
Browse files

Version 0.2.9

Added refactoring commands.
Changed key mapping for vimside#command#SymbolAtPoint() and vimside#command#PreviousPosition().
Made the test source code so that there are no compile errors.
  • Loading branch information...
1 parent 7be20df commit 1cf8b4bd454dbae7643b8f6807ad75dfb1de6d95 richard emberson committed with Dec 2, 2012
View
36 README
@@ -11,11 +11,10 @@ Vimside communicates with the Ensime server using Shougo vimproc
( git://github.com/Shougo/vimproc ),
a very clean and elegant C-language binding to sockets (and also pipes,
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
-ensime_2.9.2-0.9.8.1.tar.gz and ensime_2.10.0-SNAPSHOT-0.9.7.tar.gz
+ensime_2.9.2-0.9.8.1.tar.gz and ensime_2.10.0-RC3-0.9.8.2.tar.gz
downloads.
Look at the plugin/vimside.vim file for key mappings: how to start the
@@ -120,6 +119,24 @@ Current Supported Ensime Commands:
Useful.
Implementations: 1
+ Refactoring
+ Rename the symbol at point.
+ Organize imports.
+ Extract local.
+ Extract method.
+ Inline local.
+ Add import for type at point.
+ Import suggestions
+
+ Useful.
+ Implementations: 1
+
+ Building
+ Build the entire project.
+ Rebuild the project incrementally.
+ Useful.
+ Implementations: 1
+
Popup Menu
Bring up Popup menu with all Vimside commands (requires Forms library).
Useful for folks who have not yet learned the key mappings.
@@ -162,18 +179,6 @@ Ensime Capabilities to be Supported:
Scalex
Seems to be a dead project (see: http://scalex.org/)
- Refactoring
- Rename the symbol at point.
- Organize imports.
- Extract local.
- Extract method.
- Inline local.
- Add import for type at point.
-
- Building
- Build the entire project.
- Rebuild the project incrementally.
-
Run Application
Debug Application
@@ -191,4 +196,3 @@ Ensime Capabilities to be Supported:
And others
-
View
@@ -98,6 +98,17 @@ Current Supported Ensime Commands:
Useful.
Implementations: 1
+ Refactoring
+ Rename the symbol at point.
+ Organize imports.
+ Extract local.
+ Extract method.
+ Inline local.
+ Not supported yet: Add import for type at point.
+
+ Useful.
+ Implementations: 1
+
Popup Menu
Bring up Popup menu with all Vimside commands (requires Forms library).
Useful for folks who have not yet learned the key mappings.
@@ -140,14 +151,6 @@ Ensime Capabilities to be Supported:
Scalex
Seems to be a dead project (see: http://scalex.org/)
- Refactoring
- Rename the symbol at point.
- Organize imports.
- Extract local.
- Extract method.
- Inline local.
- Add import for type at point.
-
Building
Build the entire project.
Rebuild the project incrementally.
@@ -316,7 +319,7 @@ https://github.com/aemoncannon/ensime/downloads.
I highly recommend getting these (Scala 2.9.2 and/or 2.10.0-SNAPSHOT)
rather than trying to build the Ensime Scala code yourself.
-Ensime is not a Vim plugin. It is a Scale program. It has to be installed
+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:
@@ -325,7 +328,7 @@ from:
One can the follow the instructions there and build it.
I have never done this. Rather, I have downloaded a pre-build bundle.
-One for Scala 2.9 and another for Scala 10.0. These can be found at:
+One for Scala 2.9 and another for Scala 2.10.0. These can be found at:
https://github.com/aemoncannon/ensime/downloads
@@ -123,7 +123,7 @@ endfunction
function! vimside#command#TypecheckAll() range
if exists("g:vimside.started") && g:vimside.started
- call vimside#command#typecheck_all()
+ call vimside#command#typecheck_all#Run()
else
call s:ERROR("Ensime must be started first")
endif
@@ -146,10 +146,150 @@ function! vimside#command#FormatSource() range
endfunction
+"----------------------------------------------
+" Refactor functions
+"----------------------------------------------
+function! vimside#command#RefactorRename(mode) range
+ if exists("g:vimside.started") && g:vimside.started
+ if a:mode == 'n'
+ call s:ClearVisualSelection()
+ elseif a:mode == 'v'
+ let s:firstline = a:firstline
+ let s:firstcol = col("'<")
+ let s:lastline = a:lastline
+ let s:lastcol = col("'>")
+ let s:visualmode = visualmode()
+ else
+ throw "s:DoMode unknown mode argument: ". a:mode
+ endif
+
+ call vimside#command#refactor#Rename()
+ else
+ call s:ERROR("Ensime must be started first")
+ endif
+endfunction
+
+function! vimside#command#RefactorOrganizeImports() range
+ if exists("g:vimside.started") && g:vimside.started
+ call vimside#command#refactor#OrganizeImports()
+ else
+ call s:ERROR("Ensime must be started first")
+ endif
+endfunction
+
+function! vimside#command#RefactorExtractLocal(mode) range
+ if exists("g:vimside.started") && g:vimside.started
+ if a:mode == 'n'
+ call s:ClearVisualSelection()
+ elseif a:mode == 'v'
+ let s:firstline = a:firstline
+ let s:firstcol = col("'<")
+ let s:lastline = a:lastline
+ let s:lastcol = col("'>")
+ let s:visualmode = visualmode()
+ else
+ throw "s:DoMode unknown mode argument: ". a:mode
+ endif
+
+ call vimside#command#refactor#ExtractLocal()
+ else
+ call s:ERROR("Ensime must be started first")
+ endif
+endfunction
+
+function! vimside#command#RefactorExtractMethod(mode) range
+ if exists("g:vimside.started") && g:vimside.started
+ if a:mode == 'n'
+ call s:ClearVisualSelection()
+ elseif a:mode == 'v'
+ let s:firstline = a:firstline
+ let s:firstcol = col("'<")
+ let s:lastline = a:lastline
+ let s:lastcol = col("'>")
+ let s:visualmode = visualmode()
+ else
+ throw "s:DoMode unknown mode argument: ". a:mode
+ endif
+
+ call vimside#command#refactor#ExtractMethod()
+ else
+ call s:ERROR("Ensime must be started first")
+ endif
+endfunction
+
+function! vimside#command#RefactorInlineLocal(mode) range
+ if exists("g:vimside.started") && g:vimside.started
+ if a:mode == 'n'
+ call s:ClearVisualSelection()
+ elseif a:mode == 'v'
+ let s:firstline = a:firstline
+ let s:firstcol = col("'<")
+ let s:lastline = a:lastline
+ let s:lastcol = col("'>")
+ let s:visualmode = visualmode()
+ else
+ throw "s:DoMode unknown mode argument: ". a:mode
+ endif
+
+ call vimside#command#refactor#InlineLocal()
+ else
+ call s:ERROR("Ensime must be started first")
+ endif
+endfunction
+
+function! vimside#command#RefactorAddImportTypeAtPoint() range
+ if exists("g:vimside.started") && g:vimside.started
+ call vimside#command#refactor#AddImportTypeAtPoint()
+ else
+ call s:ERROR("Ensime must be started first")
+ endif
+endfunction
+
+function! s:ClearVisualSelection()
+ if exists("s:firstline")
+ unlet s:firstline
+ unlet s:firstcol
+ unlet s:lastline
+ unlet s:lastcol
+ unlet s:visualmode
+ endif
+endfunction
+
+" return [found, start, end]
+function! vimside#command#GetVisualSelection()
+ if exists("s:firstline")
+call s:LOG("vimside#command#GetVisualSelection: s:firstline=". s:firstline)
+call s:LOG("vimside#command#GetVisualSelection: s:firstcol=". s:firstcol)
+call s:LOG("vimside#command#GetVisualSelection: s:lastline=". s:lastline)
+call s:LOG("vimside#command#GetVisualSelection: s:lastcol=". s:lastcol)
+ let start = line2byte(s:firstline)+s:firstcol-1
+ let end = line2byte(s:lastline)+s:lastcol-1
+ return [1, start, end]
+ else
+ return [0, -1, -1]
+ endif
+endfunction
+
+
+"----------------------------------------------
+" Popup Menu functions
+"----------------------------------------------
function! vimside#command#MakePopUp(mode) range
if exists("g:vimside.started") && g:vimside.started
+ if a:mode == 'n'
+ call s:ClearVisualSelection()
+ elseif a:mode == 'v'
+ let s:firstline = a:firstline
+ let s:firstcol = col("'<")
+ let s:lastline = a:lastline
+ let s:lastcol = col("'>")
+ let s:visualmode = visualmode()
+ else
+ throw "s:DoMode unknown mode argument: ". a:mode
+ endif
+
call vimside#command#popup_menu#Run(a:mode)
else
call s:ERROR("Ensime must be started first")
@@ -22,9 +22,13 @@ let g:completions_results = []
function! vimside#command#completions#Run(findstart, base)
" call s:LOG("vimside#command#completions#Run( findstart=". a:findstart .", base=". a:base)
+ if ! exists("g:vimside.started")
+ return
+ endif
if ! g:vimside.started
return
endif
+
" call s:LOG("vimside#command#completions#Run( completions_phase=". s:completions_phase)
if s:completions_phase == 0
Oops, something went wrong.

0 comments on commit 1cf8b4b

Please sign in to comment.