mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 06:00:05 +08:00
update scala layer (#2852)
This commit is contained in:
parent
c2d56dd454
commit
d46e4a5b86
@ -25,9 +25,9 @@ scriptencoding utf-8
|
|||||||
" normal SPC l i q prompt for a qualified import
|
" normal SPC l i q prompt for a qualified import
|
||||||
" normal SPC l i o organize imports of current file
|
" normal SPC l i o organize imports of current file
|
||||||
" normal SPC l i s sort imports of current file
|
" normal SPC l i s sort imports of current file
|
||||||
" insert <c-j>i prompt for a qualified import
|
" insert <c-;>i prompt for a qualified import
|
||||||
" insert <c-j>o organize imports of current file
|
" insert <c-;>o organize imports of current file
|
||||||
" insert <c-j>s sort imports of current file
|
" insert <c-;>s sort imports of current file
|
||||||
"
|
"
|
||||||
" Debug key bindings:
|
" Debug key bindings:
|
||||||
"
|
"
|
||||||
@ -59,7 +59,7 @@ scriptencoding utf-8
|
|||||||
"
|
"
|
||||||
" Mode Key Function
|
" Mode Key Function
|
||||||
" -------------------------------------------------------------
|
" -------------------------------------------------------------
|
||||||
" normal SPC l r m run main class
|
" normal SPC l r run main class
|
||||||
"
|
"
|
||||||
" REPL key bindings:
|
" REPL key bindings:
|
||||||
"
|
"
|
||||||
@ -76,33 +76,46 @@ scriptencoding utf-8
|
|||||||
" -------------------------------------------------------------
|
" -------------------------------------------------------------
|
||||||
" normal SPC l Q bootstrap server when first-time-use
|
" normal SPC l Q bootstrap server when first-time-use
|
||||||
" normal SPC l h show Documentation of cursor symbol
|
" normal SPC l h show Documentation of cursor symbol
|
||||||
" normal SPC l R inline local refactoring of cursor symbol
|
" normal SPC l n inline local refactoring of cursor symbol
|
||||||
" normal SPC l e rename cursor symbol
|
" normal SPC l e rename cursor symbol
|
||||||
" normal SPC l g find Definition of cursor symbol
|
" normal SPC l g find Definition of cursor symbol
|
||||||
" normal SPC l t show Type of expression of cursor symbol
|
" normal SPC l t show Type of expression of cursor symbol
|
||||||
" normal SPC l p show Hierarchical view of a package
|
" normal SPC l p show Hierarchical view of a package
|
||||||
" normal SPC l r find Usages of cursor symbol
|
" normal SPC l u find Usages of cursor symbol
|
||||||
"
|
"
|
||||||
" <
|
" <
|
||||||
" @subsection Code formatting
|
" SpaceVim uses [`ensime-vim`](http://ensime.github.io/editors/vim/install/)
|
||||||
" To make neoformat support scala file, you should install scalariform.
|
" to provide code completion, format, sort imports etc, if has python support.
|
||||||
" [`scalariform`](https://github.com/scala-ide/scalariform)
|
" Also you can enable lsp layer to has a better experience.
|
||||||
" and set 'g:spacevim_layer_lang_scala_formatter' to the path of the jar.
|
"
|
||||||
|
"
|
||||||
|
" @subsection language server `metals-vim`
|
||||||
|
"
|
||||||
|
" Right now `metals-vim` works with `coc.nvim` to offer a richer user experience
|
||||||
|
" than other servers(LanguageClient-neovim or vim-lsp). Please make sure that
|
||||||
|
" `metals-vim` executable is in your `system $PATH`. Installation guide is here:
|
||||||
|
" [`metals-vim`](https://scalameta.org/metals/docs/editors/vim.html)
|
||||||
|
"
|
||||||
"
|
"
|
||||||
" @subsection Ensime-vim setup steps
|
" @subsection Ensime-vim setup steps
|
||||||
|
"
|
||||||
" The following is quick install steps, if you want to see complete details,
|
" The following is quick install steps, if you want to see complete details,
|
||||||
" please see: [`ensime`](http://ensime.github.io/editors/vim/install/)
|
" please see: [`ensime-vim`](http://ensime.github.io/editors/vim/install/)
|
||||||
"
|
"
|
||||||
" 1. Install vim`s plugin and its dependencies as following.
|
" 1. Install vim`s plugin and its dependencies as following.
|
||||||
|
"
|
||||||
" `pip install websocket-client sexpdata`,
|
" `pip install websocket-client sexpdata`,
|
||||||
|
"
|
||||||
" `pip install pynvim` (neovim only).
|
" `pip install pynvim` (neovim only).
|
||||||
|
"
|
||||||
" 2. Integration ENSIME with your build tools, here we use sbt.
|
" 2. Integration ENSIME with your build tools, here we use sbt.
|
||||||
" > add (sbt-ensime) as global plugin for sbt:
|
" add (sbt-ensime) as global plugin for sbt:
|
||||||
" Put code `addSbtPlugin("org.ensime" % "sbt-ensime" % "2.6.1")` in file
|
" Put code `addSbtPlugin("org.ensime" % "sbt-ensime" % "2.6.1")` in file
|
||||||
" '~/.sbt/plugins/plugins.sbt' (create if not exists).
|
" '~/.sbt/plugins/plugins.sbt' (create if not exists).
|
||||||
" > Armed with your build tool plugin, generate the `.ensime` config file from
|
" Armed with your build tool plugin, generate the `.ensime` config file from
|
||||||
" your project directory in command line, e.g. for sbt use `sbt ensimeConfig`,
|
" your project directory in command line, e.g. for sbt use `sbt ensimeConfig`,
|
||||||
" or `./gradlew ensime` for Gradle. the first time will take several minutes.
|
" or `./gradlew ensime` for Gradle. the first time will take several minutes.
|
||||||
|
"
|
||||||
" 3. The first time you use ensime-vim (per Scala version), it will `bootstrap` the
|
" 3. The first time you use ensime-vim (per Scala version), it will `bootstrap` the
|
||||||
" ENSIME server installation when opening a Scala file you will be prompted to
|
" ENSIME server installation when opening a Scala file you will be prompted to
|
||||||
" run |:EnInstall|. Do that and give it a minute or two to run.
|
" run |:EnInstall|. Do that and give it a minute or two to run.
|
||||||
@ -110,6 +123,18 @@ scriptencoding utf-8
|
|||||||
" up, and the indexer and analyzer are ready.
|
" up, and the indexer and analyzer are ready.
|
||||||
" Going forward, ensime-vim will automatically start the ENSIME server when you
|
" Going forward, ensime-vim will automatically start the ENSIME server when you
|
||||||
" edit Scala files in a project with an `.ensime` config present.
|
" edit Scala files in a project with an `.ensime` config present.
|
||||||
|
"
|
||||||
|
"
|
||||||
|
" @subsection Code formatting
|
||||||
|
"
|
||||||
|
" 1. To make neoformat support scala file, you should install scalariform.
|
||||||
|
" [`scalariform`](https://github.com/scala-ide/scalariform)
|
||||||
|
" and set 'g:spacevim_layer_lang_scala_formatter' to the path of the jar.
|
||||||
|
"
|
||||||
|
" 2. If lsp [`metals-vim`](https://scalameta.org/metals/docs/editors/overview.html)
|
||||||
|
" is enabled, it will automatically use
|
||||||
|
" [`scalafmt`](https://scalameta.org/scalafmt/docs/configuration.html)
|
||||||
|
" to format code.
|
||||||
|
|
||||||
|
|
||||||
function! SpaceVim#layers#lang#scala#plugins() abort
|
function! SpaceVim#layers#lang#scala#plugins() abort
|
||||||
@ -127,18 +152,16 @@ function! SpaceVim#layers#lang#scala#config() abort
|
|||||||
let g:scala_use_default_keymappings = 0
|
let g:scala_use_default_keymappings = 0
|
||||||
call SpaceVim#mapping#space#regesit_lang_mappings('scala', function('s:language_specified_mappings'))
|
call SpaceVim#mapping#space#regesit_lang_mappings('scala', function('s:language_specified_mappings'))
|
||||||
call SpaceVim#plugins#repl#reg('scala', 'scala')
|
call SpaceVim#plugins#repl#reg('scala', 'scala')
|
||||||
|
call SpaceVim#mapping#gd#add('scala', function('s:go_to_def'))
|
||||||
call add(g:spacevim_project_rooter_patterns, 'build.sbt')
|
call add(g:spacevim_project_rooter_patterns, 'build.sbt')
|
||||||
augroup SpaceVim_lang_scala
|
augroup SpaceVim_lang_scala
|
||||||
auto!
|
auto!
|
||||||
if !SpaceVim#layers#lsp#check_filetype('scala')
|
|
||||||
" no omnifunc for scala
|
|
||||||
" autocmd FileType scala setlocal omnifunc=scalacomplete#Complete
|
|
||||||
call SpaceVim#mapping#gd#add('scala', function('s:go_to_def'))
|
|
||||||
endif
|
|
||||||
" ftdetect/sbt.vim
|
|
||||||
autocmd BufRead,BufNewFile *.sbt set filetype=scala
|
autocmd BufRead,BufNewFile *.sbt set filetype=scala
|
||||||
|
if exists(':EnTypeCheck')
|
||||||
autocmd BufWritePost *.scala silent :EnTypeCheck
|
autocmd BufWritePost *.scala silent :EnTypeCheck
|
||||||
|
endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
let g:neoformat_enabled_scala = neoformat#formatters#scala#enabled()
|
let g:neoformat_enabled_scala = neoformat#formatters#scala#enabled()
|
||||||
let g:neoformat_scala_scalariform = {
|
let g:neoformat_scala_scalariform = {
|
||||||
\ 'exe': 'java',
|
\ 'exe': 'java',
|
||||||
@ -150,13 +173,14 @@ endfunction
|
|||||||
|
|
||||||
function! s:language_specified_mappings() abort
|
function! s:language_specified_mappings() abort
|
||||||
" ensime-vim {{{
|
" ensime-vim {{{
|
||||||
" nnoremap <silent><buffer> gd :EnDeclarationSplit v<CR>
|
if exists(':EnTypeCheck')
|
||||||
nmap <silent><buffer> <F4> :EnSuggestImport<CR>
|
nnoremap <silent><buffer> <F4> :EnSuggestImport<CR>
|
||||||
imap <silent><buffer> <F4> <esc>:EnSuggestImport<CR>
|
inoremap <silent><buffer> <F4> <esc>:EnSuggestImport<CR>
|
||||||
imap <silent><buffer> <c-j>i <esc>:EnAddImport<CR>
|
inoremap <silent><buffer> <c-;>i <esc>:EnAddImport<CR>
|
||||||
imap <silent><buffer> <c-j>o <esc>:EnOrganizeImports<CR>
|
inoremap <silent><buffer> <c-;>o <esc>:EnOrganizeImports<CR>
|
||||||
imap <silent><buffer> <c-j>s <esc>:SortScalaImports<CR>
|
if !SpaceVim#layers#lsp#check_filetype('scala')
|
||||||
nmap <silent><buffer> K :EnDocBrowse<CR>
|
nnoremap <silent><buffer> K :EnDocBrowse<CR>
|
||||||
|
endif
|
||||||
|
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','Q'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','Q'],
|
||||||
\ 'EnInstall',
|
\ 'EnInstall',
|
||||||
@ -164,12 +188,12 @@ function! s:language_specified_mappings() abort
|
|||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','h'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','h'],
|
||||||
\ 'EnDocBrowse',
|
\ 'EnDocBrowse',
|
||||||
\ 'show Documentation of cursor symbol', 1)
|
\ 'show Documentation of cursor symbol', 1)
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','R'],
|
|
||||||
\ 'EnInline',
|
|
||||||
\ 'Inline local refactoring of cursor symbol', 1)
|
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','e'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','e'],
|
||||||
\ 'EnRename',
|
\ 'EnRename',
|
||||||
\ 'Rename cursor symbol', 1)
|
\ 'Rename cursor symbol', 1)
|
||||||
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','n'],
|
||||||
|
\ 'EnInline',
|
||||||
|
\ 'Inline local refactoring of cursor symbol', 1)
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','g'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','g'],
|
||||||
\ 'EnDeclarationSplit v',
|
\ 'EnDeclarationSplit v',
|
||||||
\ 'find Definition of cursor symbol', 1)
|
\ 'find Definition of cursor symbol', 1)
|
||||||
@ -180,7 +204,7 @@ function! s:language_specified_mappings() abort
|
|||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','p'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','p'],
|
||||||
\ 'EnShowPackage',
|
\ 'EnShowPackage',
|
||||||
\ 'show Hierarchical view of a package', 1)
|
\ 'show Hierarchical view of a package', 1)
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','r'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','u'],
|
||||||
\ 'EnUsages',
|
\ 'EnUsages',
|
||||||
\ 'find Usages of cursor symbol', 1)
|
\ 'find Usages of cursor symbol', 1)
|
||||||
|
|
||||||
@ -204,9 +228,11 @@ function! s:language_specified_mappings() abort
|
|||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','i'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','i'],
|
||||||
\ 'EnDebugStep',
|
\ 'EnDebugStep',
|
||||||
\ 'step into next statement', 1)
|
\ 'step into next statement', 1)
|
||||||
|
nnoremap <buffer><F7> :EnDebugStep<CR>
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','o'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','o'],
|
||||||
\ 'EnDebugNext',
|
\ 'EnDebugNext',
|
||||||
\ 'step over next statement', 1)
|
\ 'step over next statement', 1)
|
||||||
|
nnoremap <buffer><F8> :EnDebugNext<CR>
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','O'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','O'],
|
||||||
\ 'EnDebugNext',
|
\ 'EnDebugNext',
|
||||||
\ 'step out of current function', 1)
|
\ 'step out of current function', 1)
|
||||||
@ -214,7 +240,7 @@ function! s:language_specified_mappings() abort
|
|||||||
|
|
||||||
" import {{{
|
" import {{{
|
||||||
let g:_spacevim_mappings_space.l.i = {'name' : '+Import'}
|
let g:_spacevim_mappings_space.l.i = {'name' : '+Import'}
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','c'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','i'],
|
||||||
\ 'EnSuggestImport',
|
\ 'EnSuggestImport',
|
||||||
\ 'Show candidates for importing of cursor symbol', 1)
|
\ 'Show candidates for importing of cursor symbol', 1)
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','q'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','q'],
|
||||||
@ -224,22 +250,40 @@ function! s:language_specified_mappings() abort
|
|||||||
\ 'EnOrganizeImports',
|
\ 'EnOrganizeImports',
|
||||||
\ 'Organize imports of current file', 1) " }}}
|
\ 'Organize imports of current file', 1) " }}}
|
||||||
" }}}
|
" }}}
|
||||||
" import vim-scala
|
endif
|
||||||
|
|
||||||
|
" import `vim-scala`
|
||||||
|
inoremap <silent><buffer> <C-;>s <Esc>:SortScalaImports<CR>
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','s'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','s'],
|
||||||
\ 'SortScalaImports',
|
\ 'SortScalaImports', 'sort imports', 1)
|
||||||
\ 'sort imports', 1)
|
|
||||||
|
if SpaceVim#layers#lsp#check_filetype('scala') && executable('metals-vim')
|
||||||
|
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
|
||||||
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
|
||||||
|
\ 'call SpaceVim#lsp#show_doc()', 'show Document', 1)
|
||||||
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'],
|
||||||
|
\ 'call SpaceVim#lsp#rename()()', 'rename Symbol', 1)
|
||||||
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'g'],
|
||||||
|
\ 'call SpaceVim#lsp#go_to_def()', 'goto Definition', 1)
|
||||||
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'u'],
|
||||||
|
\ 'call SpaceVim#lsp#references()', 'find References', 1)
|
||||||
|
endif
|
||||||
|
|
||||||
" Execute
|
" Execute
|
||||||
let g:_spacevim_mappings_space.l.r = {'name' : '+Run'}
|
let g:_spacevim_mappings_space.l.r = {'name' : '+Run'}
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','r', 'm'], 'call call('
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','r', 'm'], 'call call('
|
||||||
\ . string(function('s:execCMD')) . ', ["sbt run"])',
|
\ . string(function('s:execCMD')) . ', ["sbt run"])',
|
||||||
\ 'Run main class', 1)
|
\ 'Run main class', 1)
|
||||||
|
nnoremap <buffer><F10> :call <sid>execCMD('sbt run')<CR>
|
||||||
|
|
||||||
" Sbt
|
" Sbt
|
||||||
let g:_spacevim_mappings_space.l.b = {'name' : '+Sbt'}
|
let g:_spacevim_mappings_space.l.b = {'name' : '+Sbt'}
|
||||||
|
if exists(':EnTypeCheck')
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','b', 'e'], 'call call('
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','b', 'e'], 'call call('
|
||||||
\ . string(function('s:execCMD')) . ', ["sbt ensimeConfig"])',
|
\ . string(function('s:execCMD')) . ', ["sbt ensimeConfig"])',
|
||||||
\ 'Run sbt to generate .ensime file', 1)
|
\ 'Run sbt to generate .ensime file', 1)
|
||||||
|
endif
|
||||||
|
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','b', 'c'], 'call call('
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','b', 'c'], 'call call('
|
||||||
\ . string(function('s:execCMD')) . ', ["sbt ~compile"])',
|
\ . string(function('s:execCMD')) . ', ["sbt ~compile"])',
|
||||||
\ 'Run sbt continuous compile', 1)
|
\ 'Run sbt continuous compile', 1)
|
||||||
@ -280,7 +324,11 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! s:go_to_def() abort
|
function! s:go_to_def() abort
|
||||||
|
if SpaceVim#layers#lsp#check_filetype('scala') && executable('metals-vim')
|
||||||
|
call SpaceVim#lsp#go_to_def()
|
||||||
|
else
|
||||||
EnDeclarationSplit v
|
EnDeclarationSplit v
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:execCMD(cmd) abort
|
function! s:execCMD(cmd) abort
|
||||||
|
@ -120,6 +120,7 @@ let s:lsp_servers = {
|
|||||||
\ 'purescript' : ['purescript-language-server', '--stdio'],
|
\ 'purescript' : ['purescript-language-server', '--stdio'],
|
||||||
\ 'python' : ['pyls'],
|
\ 'python' : ['pyls'],
|
||||||
\ 'rust' : ['rustup', 'run', 'nightly', 'rls'],
|
\ 'rust' : ['rustup', 'run', 'nightly', 'rls'],
|
||||||
|
\ 'scala' : ['metals-vim'],
|
||||||
\ 'sh' : ['bash-language-server', 'start'],
|
\ 'sh' : ['bash-language-server', 'start'],
|
||||||
\ 'typescript' : ['typescript-language-server', '--stdio'],
|
\ 'typescript' : ['typescript-language-server', '--stdio'],
|
||||||
\ 'ruby' : ['solargraph.BAT', 'stdio'],
|
\ 'ruby' : ['solargraph.BAT', 'stdio'],
|
||||||
|
@ -1385,9 +1385,9 @@ MAPPINGS
|
|||||||
normal SPC l i q prompt for a qualified import
|
normal SPC l i q prompt for a qualified import
|
||||||
normal SPC l i o organize imports of current file
|
normal SPC l i o organize imports of current file
|
||||||
normal SPC l i s sort imports of current file
|
normal SPC l i s sort imports of current file
|
||||||
insert <c-j>i prompt for a qualified import
|
insert <c-;>i prompt for a qualified import
|
||||||
insert <c-j>o organize imports of current file
|
insert <c-;>o organize imports of current file
|
||||||
insert <c-j>s sort imports of current file
|
insert <c-;>s sort imports of current file
|
||||||
|
|
||||||
Debug key bindings:
|
Debug key bindings:
|
||||||
|
|
||||||
@ -1419,7 +1419,7 @@ MAPPINGS
|
|||||||
|
|
||||||
Mode Key Function
|
Mode Key Function
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
normal SPC l r m run main class
|
normal SPC l r run main class
|
||||||
|
|
||||||
REPL key bindings:
|
REPL key bindings:
|
||||||
|
|
||||||
@ -1436,32 +1436,46 @@ MAPPINGS
|
|||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
normal SPC l Q bootstrap server when first-time-use
|
normal SPC l Q bootstrap server when first-time-use
|
||||||
normal SPC l h show Documentation of cursor symbol
|
normal SPC l h show Documentation of cursor symbol
|
||||||
normal SPC l R inline local refactoring of cursor symbol
|
normal SPC l n inline local refactoring of cursor symbol
|
||||||
normal SPC l e rename cursor symbol
|
normal SPC l e rename cursor symbol
|
||||||
normal SPC l g find Definition of cursor symbol
|
normal SPC l g find Definition of cursor symbol
|
||||||
normal SPC l t show Type of expression of cursor symbol
|
normal SPC l t show Type of expression of cursor symbol
|
||||||
normal SPC l p show Hierarchical view of a package
|
normal SPC l p show Hierarchical view of a package
|
||||||
normal SPC l r find Usages of cursor symbol
|
normal SPC l u find Usages of cursor symbol
|
||||||
|
|
||||||
<
|
<
|
||||||
CODE FORMATTING
|
SpaceVim uses [`ensime-vim`](http://ensime.github.io/editors/vim/install/) to
|
||||||
To make neoformat support scala file, you should install scalariform.
|
provide code completion, format, sort imports etc, if has python support. Also
|
||||||
[`scalariform`](https://github.com/scala-ide/scalariform) and set
|
you can enable lsp layer to has a better experience.
|
||||||
'g:spacevim_layer_lang_scala_formatter' to the path of the jar.
|
|
||||||
|
|
||||||
|
LANGUAGE SERVER `METALS-VIM`
|
||||||
|
|
||||||
|
Right now `metals-vim` works with `coc.nvim` to offer a richer user experience
|
||||||
|
than other servers(LanguageClient-neovim or vim-lsp). Please make sure that
|
||||||
|
`metals-vim` executable is in your `system $PATH`. Installation guide is here:
|
||||||
|
[`metals-vim`](https://scalameta.org/metals/docs/editors/vim.html)
|
||||||
|
|
||||||
|
|
||||||
ENSIME-VIM SETUP STEPS
|
ENSIME-VIM SETUP STEPS
|
||||||
The following is quick install steps, if you want to see complete details,
|
|
||||||
please see: [`ensime`](http://ensime.github.io/editors/vim/install/)
|
|
||||||
|
|
||||||
1. Install vim`s plugin and its dependencies as following. `pip install
|
The following is quick install steps, if you want to see complete details,
|
||||||
websocket-client sexpdata`, `pip install pynvim` (neovim only).
|
please see: [`ensime-vim`](http://ensime.github.io/editors/vim/install/)
|
||||||
2. Integration ENSIME with your build tools, here we use sbt. > add
|
|
||||||
|
1. Install vim`s plugin and its dependencies as following.
|
||||||
|
|
||||||
|
`pip install websocket-client sexpdata`,
|
||||||
|
|
||||||
|
`pip install pynvim` (neovim only).
|
||||||
|
|
||||||
|
2. Integration ENSIME with your build tools, here we use sbt. add
|
||||||
(sbt-ensime) as global plugin for sbt: Put code `addSbtPlugin("org.ensime"
|
(sbt-ensime) as global plugin for sbt: Put code `addSbtPlugin("org.ensime"
|
||||||
% "sbt-ensime" % "2.6.1")` in file '~/.sbt/plugins/plugins.sbt' (create
|
% "sbt-ensime" % "2.6.1")` in file '~/.sbt/plugins/plugins.sbt' (create
|
||||||
if not exists). > Armed with your build tool plugin, generate the
|
if not exists). Armed with your build tool plugin, generate the `.ensime`
|
||||||
`.ensime` config file from your project directory in command line, e.g.
|
config file from your project directory in command line, e.g. for sbt use
|
||||||
for sbt use `sbt ensimeConfig`, or `./gradlew ensime` for Gradle. the
|
`sbt ensimeConfig`, or `./gradlew ensime` for Gradle. the first time will
|
||||||
first time will take several minutes.
|
take several minutes.
|
||||||
|
|
||||||
3. The first time you use ensime-vim (per Scala version), it will
|
3. The first time you use ensime-vim (per Scala version), it will
|
||||||
`bootstrap` the ENSIME server installation when opening a Scala file you
|
`bootstrap` the ENSIME server installation when opening a Scala file you
|
||||||
will be prompted to run |:EnInstall|. Do that and give it a minute or two
|
will be prompted to run |:EnInstall|. Do that and give it a minute or two
|
||||||
@ -1470,6 +1484,19 @@ please see: [`ensime`](http://ensime.github.io/editors/vim/install/)
|
|||||||
forward, ensime-vim will automatically start the ENSIME server when you
|
forward, ensime-vim will automatically start the ENSIME server when you
|
||||||
edit Scala files in a project with an `.ensime` config present.
|
edit Scala files in a project with an `.ensime` config present.
|
||||||
|
|
||||||
|
|
||||||
|
CODE FORMATTING
|
||||||
|
|
||||||
|
1. To make neoformat support scala file, you should install scalariform.
|
||||||
|
[`scalariform`](https://github.com/scala-ide/scalariform) and set
|
||||||
|
'g:spacevim_layer_lang_scala_formatter' to the path of the jar.
|
||||||
|
|
||||||
|
2. If lsp
|
||||||
|
[`metals-vim`](https://scalameta.org/metals/docs/editors/overview.html) is
|
||||||
|
enabled, it will automatically use
|
||||||
|
[`scalafmt`](https://scalameta.org/scalafmt/docs/configuration.html) to
|
||||||
|
format code.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
LANG#XML *SpaceVim-layer-lang-xml*
|
LANG#XML *SpaceVim-layer-lang-xml*
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user