mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 02:50:06 +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 o organize 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-j>o organize imports of current file
|
||||
" insert <c-j>s sort imports of current file
|
||||
" insert <c-;>i prompt for a qualified import
|
||||
" insert <c-;>o organize imports of current file
|
||||
" insert <c-;>s sort imports of current file
|
||||
"
|
||||
" Debug key bindings:
|
||||
"
|
||||
@ -59,7 +59,7 @@ scriptencoding utf-8
|
||||
"
|
||||
" Mode Key Function
|
||||
" -------------------------------------------------------------
|
||||
" normal SPC l r m run main class
|
||||
" normal SPC l r run main class
|
||||
"
|
||||
" REPL key bindings:
|
||||
"
|
||||
@ -76,33 +76,46 @@ scriptencoding utf-8
|
||||
" -------------------------------------------------------------
|
||||
" normal SPC l Q bootstrap server when first-time-use
|
||||
" 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 g find Definition 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 r find Usages of cursor symbol
|
||||
" normal SPC l u find Usages of cursor symbol
|
||||
"
|
||||
" <
|
||||
" @subsection Code formatting
|
||||
" 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.
|
||||
" SpaceVim uses [`ensime-vim`](http://ensime.github.io/editors/vim/install/)
|
||||
" to provide code completion, format, sort imports etc, if has python support.
|
||||
" Also you can enable lsp layer to has a better experience.
|
||||
"
|
||||
"
|
||||
" @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
|
||||
"
|
||||
" 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.
|
||||
"
|
||||
" `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" % "2.6.1")` in file
|
||||
" '~/.sbt/plugins/plugins.sbt' (create if not exists).
|
||||
" > 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`,
|
||||
" or `./gradlew ensime` for Gradle. the first time will take several minutes.
|
||||
" add (sbt-ensime) as global plugin for sbt:
|
||||
" Put code `addSbtPlugin("org.ensime" % "sbt-ensime" % "2.6.1")` in file
|
||||
" '~/.sbt/plugins/plugins.sbt' (create if not exists).
|
||||
" 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`,
|
||||
" 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
|
||||
" 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.
|
||||
@ -110,6 +123,18 @@ scriptencoding utf-8
|
||||
" up, and the indexer and analyzer are ready.
|
||||
" Going forward, ensime-vim will automatically start the ENSIME server when you
|
||||
" 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
|
||||
@ -127,18 +152,16 @@ function! SpaceVim#layers#lang#scala#config() abort
|
||||
let g:scala_use_default_keymappings = 0
|
||||
call SpaceVim#mapping#space#regesit_lang_mappings('scala', function('s:language_specified_mappings'))
|
||||
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')
|
||||
augroup SpaceVim_lang_scala
|
||||
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 BufWritePost *.scala silent :EnTypeCheck
|
||||
if exists(':EnTypeCheck')
|
||||
autocmd BufWritePost *.scala silent :EnTypeCheck
|
||||
endif
|
||||
augroup END
|
||||
|
||||
let g:neoformat_enabled_scala = neoformat#formatters#scala#enabled()
|
||||
let g:neoformat_scala_scalariform = {
|
||||
\ 'exe': 'java',
|
||||
@ -150,96 +173,117 @@ endfunction
|
||||
|
||||
function! s:language_specified_mappings() abort
|
||||
" ensime-vim {{{
|
||||
" nnoremap <silent><buffer> gd :EnDeclarationSplit v<CR>
|
||||
nmap <silent><buffer> <F4> :EnSuggestImport<CR>
|
||||
imap <silent><buffer> <F4> <esc>:EnSuggestImport<CR>
|
||||
imap <silent><buffer> <c-j>i <esc>:EnAddImport<CR>
|
||||
imap <silent><buffer> <c-j>o <esc>:EnOrganizeImports<CR>
|
||||
imap <silent><buffer> <c-j>s <esc>:SortScalaImports<CR>
|
||||
nmap <silent><buffer> K :EnDocBrowse<CR>
|
||||
if exists(':EnTypeCheck')
|
||||
nnoremap <silent><buffer> <F4> :EnSuggestImport<CR>
|
||||
inoremap <silent><buffer> <F4> <esc>:EnSuggestImport<CR>
|
||||
inoremap <silent><buffer> <c-;>i <esc>:EnAddImport<CR>
|
||||
inoremap <silent><buffer> <c-;>o <esc>:EnOrganizeImports<CR>
|
||||
if !SpaceVim#layers#lsp#check_filetype('scala')
|
||||
nnoremap <silent><buffer> K :EnDocBrowse<CR>
|
||||
endif
|
||||
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','Q'],
|
||||
\ 'EnInstall',
|
||||
\ 'bootstrap server when first-time-use', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','h'],
|
||||
\ 'EnDocBrowse',
|
||||
\ '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'],
|
||||
\ 'EnRename',
|
||||
\ 'Rename cursor symbol', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','g'],
|
||||
\ 'EnDeclarationSplit v',
|
||||
\ 'find Definition of cursor symbol', 1)
|
||||
xnoremap <silent><buffer> <space>lt :EnType selection<CR>
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','t'],
|
||||
\ 'EnType',
|
||||
\ 'show Type of expression of cursor symbol', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','p'],
|
||||
\ 'EnShowPackage',
|
||||
\ 'show Hierarchical view of a package', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','r'],
|
||||
\ 'EnUsages',
|
||||
\ 'find Usages of cursor symbol', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','Q'],
|
||||
\ 'EnInstall',
|
||||
\ 'bootstrap server when first-time-use', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','h'],
|
||||
\ 'EnDocBrowse',
|
||||
\ 'show Documentation of cursor symbol', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','e'],
|
||||
\ 'EnRename',
|
||||
\ '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'],
|
||||
\ 'EnDeclarationSplit v',
|
||||
\ 'find Definition of cursor symbol', 1)
|
||||
xnoremap <silent><buffer> <space>lt :EnType selection<CR>
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','t'],
|
||||
\ 'EnType',
|
||||
\ 'show Type of expression of cursor symbol', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','p'],
|
||||
\ 'EnShowPackage',
|
||||
\ 'show Hierarchical view of a package', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','u'],
|
||||
\ 'EnUsages',
|
||||
\ 'find Usages of cursor symbol', 1)
|
||||
|
||||
" debug {{{
|
||||
let g:_spacevim_mappings_space.l.d = {'name' : '+Debug'}
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','t'],
|
||||
\ 'EnDebugBacktrace',
|
||||
\ 'show debug stack trace of current frame', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','c'],
|
||||
\ 'EnDebugContinue',
|
||||
\ 'continue the execution', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','b'],
|
||||
\ 'EnDebugSetBreak',
|
||||
\ 'set a breakpoint for the current line', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','B'],
|
||||
\ 'EnDebugClearBreaks',
|
||||
\ 'clear all breakpoints', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','l'],
|
||||
\ 'EnDebugStart',
|
||||
\ 'launching debugger', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','i'],
|
||||
\ 'EnDebugStep',
|
||||
\ 'step into next statement', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','o'],
|
||||
\ 'EnDebugNext',
|
||||
\ 'step over next statement', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','O'],
|
||||
\ 'EnDebugNext',
|
||||
\ 'step out of current function', 1)
|
||||
"}}}
|
||||
" debug {{{
|
||||
let g:_spacevim_mappings_space.l.d = {'name' : '+Debug'}
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','t'],
|
||||
\ 'EnDebugBacktrace',
|
||||
\ 'show debug stack trace of current frame', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','c'],
|
||||
\ 'EnDebugContinue',
|
||||
\ 'continue the execution', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','b'],
|
||||
\ 'EnDebugSetBreak',
|
||||
\ 'set a breakpoint for the current line', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','B'],
|
||||
\ 'EnDebugClearBreaks',
|
||||
\ 'clear all breakpoints', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','l'],
|
||||
\ 'EnDebugStart',
|
||||
\ 'launching debugger', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','i'],
|
||||
\ 'EnDebugStep',
|
||||
\ 'step into next statement', 1)
|
||||
nnoremap <buffer><F7> :EnDebugStep<CR>
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','o'],
|
||||
\ 'EnDebugNext',
|
||||
\ 'step over next statement', 1)
|
||||
nnoremap <buffer><F8> :EnDebugNext<CR>
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','d','O'],
|
||||
\ 'EnDebugNext',
|
||||
\ 'step out of current function', 1)
|
||||
"}}}
|
||||
|
||||
" import {{{
|
||||
let g:_spacevim_mappings_space.l.i = {'name' : '+Import'}
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','c'],
|
||||
\ 'EnSuggestImport',
|
||||
\ 'Show candidates for importing of cursor symbol', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','q'],
|
||||
\ 'EnAddImport',
|
||||
\ 'Prompt for a qualified import', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','o'],
|
||||
\ 'EnOrganizeImports',
|
||||
\ 'Organize imports of current file', 1) " }}}
|
||||
" }}}
|
||||
" import vim-scala
|
||||
" import {{{
|
||||
let g:_spacevim_mappings_space.l.i = {'name' : '+Import'}
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','i'],
|
||||
\ 'EnSuggestImport',
|
||||
\ 'Show candidates for importing of cursor symbol', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','q'],
|
||||
\ 'EnAddImport',
|
||||
\ 'Prompt for a qualified import', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','o'],
|
||||
\ 'EnOrganizeImports',
|
||||
\ 'Organize imports of current file', 1) " }}}
|
||||
" }}}
|
||||
endif
|
||||
|
||||
" import `vim-scala`
|
||||
inoremap <silent><buffer> <C-;>s <Esc>:SortScalaImports<CR>
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','i','s'],
|
||||
\ 'SortScalaImports',
|
||||
\ 'sort imports', 1)
|
||||
\ 'SortScalaImports', '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
|
||||
let g:_spacevim_mappings_space.l.r = {'name' : '+Run'}
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','r', 'm'], 'call call('
|
||||
\ . string(function('s:execCMD')) . ', ["sbt run"])',
|
||||
\ 'Run main class', 1)
|
||||
nnoremap <buffer><F10> :call <sid>execCMD('sbt run')<CR>
|
||||
|
||||
" Sbt
|
||||
let g:_spacevim_mappings_space.l.b = {'name' : '+Sbt'}
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','b', 'e'], 'call call('
|
||||
\ . string(function('s:execCMD')) . ', ["sbt ensimeConfig"])',
|
||||
\ 'Run sbt to generate .ensime file', 1)
|
||||
if exists(':EnTypeCheck')
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','b', 'e'], 'call call('
|
||||
\ . string(function('s:execCMD')) . ', ["sbt ensimeConfig"])',
|
||||
\ 'Run sbt to generate .ensime file', 1)
|
||||
endif
|
||||
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','b', 'c'], 'call call('
|
||||
\ . string(function('s:execCMD')) . ', ["sbt ~compile"])',
|
||||
\ 'Run sbt continuous compile', 1)
|
||||
@ -280,7 +324,11 @@ endfunction
|
||||
|
||||
|
||||
function! s:go_to_def() abort
|
||||
EnDeclarationSplit v
|
||||
if SpaceVim#layers#lsp#check_filetype('scala') && executable('metals-vim')
|
||||
call SpaceVim#lsp#go_to_def()
|
||||
else
|
||||
EnDeclarationSplit v
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:execCMD(cmd) abort
|
||||
|
@ -120,6 +120,7 @@ let s:lsp_servers = {
|
||||
\ 'purescript' : ['purescript-language-server', '--stdio'],
|
||||
\ 'python' : ['pyls'],
|
||||
\ 'rust' : ['rustup', 'run', 'nightly', 'rls'],
|
||||
\ 'scala' : ['metals-vim'],
|
||||
\ 'sh' : ['bash-language-server', 'start'],
|
||||
\ 'typescript' : ['typescript-language-server', '--stdio'],
|
||||
\ 'ruby' : ['solargraph.BAT', 'stdio'],
|
||||
|
@ -1385,9 +1385,9 @@ MAPPINGS
|
||||
normal SPC l i q prompt for a qualified import
|
||||
normal SPC l i o organize 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-j>o organize imports of current file
|
||||
insert <c-j>s sort imports of current file
|
||||
insert <c-;>i prompt for a qualified import
|
||||
insert <c-;>o organize imports of current file
|
||||
insert <c-;>s sort imports of current file
|
||||
|
||||
Debug key bindings:
|
||||
|
||||
@ -1419,7 +1419,7 @@ MAPPINGS
|
||||
|
||||
Mode Key Function
|
||||
-------------------------------------------------------------
|
||||
normal SPC l r m run main class
|
||||
normal SPC l r run main class
|
||||
|
||||
REPL key bindings:
|
||||
|
||||
@ -1436,32 +1436,46 @@ MAPPINGS
|
||||
-------------------------------------------------------------
|
||||
normal SPC l Q bootstrap server when first-time-use
|
||||
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 g find Definition 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 r find Usages of cursor symbol
|
||||
normal SPC l u find Usages of cursor symbol
|
||||
|
||||
<
|
||||
CODE FORMATTING
|
||||
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.
|
||||
SpaceVim uses [`ensime-vim`](http://ensime.github.io/editors/vim/install/) to
|
||||
provide code completion, format, sort imports etc, if has python support. Also
|
||||
you can enable lsp layer to has a better experience.
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
websocket-client sexpdata`, `pip install pynvim` (neovim only).
|
||||
2. Integration ENSIME with your build tools, here we use sbt. > add
|
||||
The following is quick install steps, if you want to see complete details,
|
||||
please see: [`ensime-vim`](http://ensime.github.io/editors/vim/install/)
|
||||
|
||||
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" % "2.6.1")` in file '~/.sbt/plugins/plugins.sbt' (create
|
||||
if not exists). > 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`, or `./gradlew ensime` for Gradle. the
|
||||
first time will take several minutes.
|
||||
if not exists). 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`, 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 ENSIME server installation when opening a Scala file you
|
||||
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
|
||||
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*
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user