mirror of
https://github.com/prabirshrestha/vim-lsp.git
synced 2025-12-14 20:35:59 +01:00
37 lines
893 B
Plaintext
37 lines
893 B
Plaintext
Describe integration#rust#document_formatting
|
|
Before
|
|
%bwipeout!
|
|
if lsp#test#hasproject('rust')
|
|
call lsp#test#openproject('rust', {})
|
|
endif
|
|
End
|
|
|
|
After all
|
|
%bwipeout!
|
|
call lsp#test#closeproject('rust')
|
|
End
|
|
|
|
It should correctly format document when using LspDocumentFormatSync
|
|
if !lsp#test#hasproject('rust')
|
|
Skip rust project not supported
|
|
endif
|
|
|
|
setl shiftwidth=4
|
|
|
|
normal! m'
|
|
execute printf('keepalt keepjumps edit %s', lsp#test#projectdir('rust') . '/src/documentformat.rs')
|
|
let l:original = getline(1, "$")
|
|
|
|
call execute('LspDocumentFormatSync')
|
|
|
|
let got = getline(1, "$")
|
|
let want = [
|
|
\ 'fn format() {',
|
|
\ ' unimplemented!();',
|
|
\ '}'
|
|
\ ]
|
|
Assert Equals(got, want)
|
|
End
|
|
|
|
End
|