Files
vim-lsp-mirror/test/lsp/utils/range.vimspec
hrsh7th 70234feca4 Improve code action (#663)
* Improve code action

* Add LspCodeActionSync

* Fix miss argument

* Fix for the review

* Add utils and tests

* Remove unused function
2020-01-09 08:35:39 -08:00

62 lines
1.5 KiB
Plaintext

Describe lsp#utils#range
Before each
% delete _
End
Describe lsp#utils#range#_get_recent_visual_range
It should return single line visual selection
call setline(1, ['あいうえお'])
normal! gg0llvly
Assert Equals(lsp#utils#range#_get_recent_visual_range(), {
\ 'start': {
\ 'line': 0,
\ 'character': 2
\ },
\ 'end': {
\ 'line': 0,
\ 'character': 4
\ }
\ })
End
It should return multi line visual selection
call setline(1, ['あいうえお', 'かきくけこ'])
normal! gg0llvjly
Assert Equals(lsp#utils#range#_get_recent_visual_range(), {
\ 'start': {
\ 'line': 0,
\ 'character': 2
\ },
\ 'end': {
\ 'line': 1,
\ 'character': 4
\ }
\ })
End
End
Describe lsp#utils#range#_get_current_line_range
It should return current line range
call setline(1, ['あいうえお', 'かきくけこ', 'さしすせそ'])
call cursor(2, 1)
Assert Equals(lsp#utils#range#_get_current_line_range(), {
\ 'start': {
\ 'line': 1,
\ 'character': 0
\ },
\ 'end': {
\ 'line': 1,
\ 'character': 5
\ }
\ })
End
End
End