I broke up with neovim....vim is my best friend now
This commit is contained in:
134
dot_vim/plugged/vim-lsp/test/lsp/ui/vim/code_lens.vimspec
Normal file
134
dot_vim/plugged/vim-lsp/test/lsp/ui/vim/code_lens.vimspec
Normal file
@@ -0,0 +1,134 @@
|
||||
Describe lsp#uivim#code_lens
|
||||
Describe lsp#ui#vim#code_lens#_get_subtitle
|
||||
It should generate subtitle from response of rust-analyzer
|
||||
" Example response of Code Lens extracted from #1118
|
||||
let item = {
|
||||
\ 'codelens': {
|
||||
\ 'command': {
|
||||
\ 'arguments': [
|
||||
\ {
|
||||
\ 'args': {
|
||||
\ 'cargoArgs': ['test', '--package', 'tmp', '--lib'],
|
||||
\ 'cargoExtraArgs': [],
|
||||
\ 'executableArgs': ['tests::it_works', '--exact', '--nocapture'],
|
||||
\ 'overrideCargo': v:null,
|
||||
\ 'workspaceRoot': '/tmp'
|
||||
\ },
|
||||
\ 'kind': 'cargo',
|
||||
\ 'label': 'test tests::it_works',
|
||||
\ 'location': {
|
||||
\ 'targetRange': {'end': {'character': 5, 'line': 14}, 'start': {'character': 4, 'line': 11}},
|
||||
\ 'targetSelectionRange': {'end': {'character': 15, 'line': 12}, 'start': {'character': 7, 'line': 12}},
|
||||
\ 'targetUri': 'file:////tmp/src/lib.rs'
|
||||
\ }
|
||||
\ }
|
||||
\ ],
|
||||
\ 'command': 'rust-analyzer.runSingle',
|
||||
\ 'title': '▶︎ Run Test'
|
||||
\ },
|
||||
\ 'range': {'end': {'character': 5, 'line': 14}, 'start': {'character': 4, 'line': 11}}
|
||||
\ },
|
||||
\ 'server': 'rust-analyzer'
|
||||
\ }
|
||||
|
||||
let subtitle = lsp#ui#vim#code_lens#_get_subtitle(item)
|
||||
Assert Equals(subtitle, ': test tests::it_works')
|
||||
End
|
||||
|
||||
It should generate subtitle from multiple labels of command arguments
|
||||
let item = {
|
||||
\ 'codelens': {
|
||||
\ 'command': {
|
||||
\ 'arguments': [
|
||||
\ {
|
||||
\ 'args': {},
|
||||
\ 'kind': 'kind1',
|
||||
\ 'label': 'do command1',
|
||||
\ 'location': {}
|
||||
\ },
|
||||
\ {
|
||||
\ 'args': {},
|
||||
\ 'kind': 'kind2',
|
||||
\ 'label': 'do command2',
|
||||
\ 'location': {}
|
||||
\ }
|
||||
\ ],
|
||||
\ 'command': 'server.someCommand',
|
||||
\ 'title': 'lens title'
|
||||
\ },
|
||||
\ 'range': {'end': {'character': 5, 'line': 14}, 'start': {'character': 4, 'line': 11}}
|
||||
\ },
|
||||
\ 'server': 'rust-analyzer'
|
||||
\ }
|
||||
|
||||
let subtitle = lsp#ui#vim#code_lens#_get_subtitle(item)
|
||||
Assert Equals(subtitle, ': do command1 > do command2')
|
||||
End
|
||||
|
||||
It should return empty string when 'arguments' field is not found
|
||||
let item = {
|
||||
\ 'codelens': {
|
||||
\ 'command': {
|
||||
\ 'command': 'server.someCommand',
|
||||
\ 'title': 'lens title'
|
||||
\ },
|
||||
\ 'range': {'end': {'character': 5, 'line': 14}, 'start': {'character': 4, 'line': 11}}
|
||||
\ },
|
||||
\ 'server': 'rust-analyzer'
|
||||
\ }
|
||||
|
||||
let subtitle = lsp#ui#vim#code_lens#_get_subtitle(item)
|
||||
Assert Equals(subtitle, '')
|
||||
End
|
||||
|
||||
It should return empty string when 'arguments' field is not an object
|
||||
let item = {
|
||||
\ 'codelens': {
|
||||
\ 'command': {
|
||||
\ 'arguments': [
|
||||
\ 'command1',
|
||||
\ 'command2',
|
||||
\ 'command3'
|
||||
\ ],
|
||||
\ 'command': 'server.someCommand',
|
||||
\ 'title': 'lens title'
|
||||
\ },
|
||||
\ 'range': {'end': {'character': 5, 'line': 14}, 'start': {'character': 4, 'line': 11}}
|
||||
\ },
|
||||
\ 'server': 'rust-analyzer'
|
||||
\ }
|
||||
|
||||
let subtitle = lsp#ui#vim#code_lens#_get_subtitle(item)
|
||||
Assert Equals(subtitle, '')
|
||||
End
|
||||
|
||||
It should return empty string when at least one of elements in 'arguments' field does not have 'label' field
|
||||
let item = {
|
||||
\ 'codelens': {
|
||||
\ 'command': {
|
||||
\ 'arguments': [
|
||||
\ {
|
||||
\ 'args': {},
|
||||
\ 'kind': 'kind1',
|
||||
\ 'label': 'do command1',
|
||||
\ 'location': {}
|
||||
\ },
|
||||
\ {
|
||||
\ 'args': {},
|
||||
\ 'kind': 'kind2',
|
||||
\ 'location': {}
|
||||
\ }
|
||||
\ ],
|
||||
\ 'command': 'server.someCommand',
|
||||
\ 'title': 'lens title'
|
||||
\ },
|
||||
\ 'range': {'end': {'character': 5, 'line': 14}, 'start': {'character': 4, 'line': 11}}
|
||||
\ },
|
||||
\ 'server': 'rust-analyzer'
|
||||
\ }
|
||||
|
||||
let subtitle = lsp#ui#vim#code_lens#_get_subtitle(item)
|
||||
Assert Equals(subtitle, '')
|
||||
End
|
||||
End
|
||||
End
|
||||
37
dot_vim/plugged/vim-lsp/test/lsp/ui/vim/completion.vimspec
Normal file
37
dot_vim/plugged/vim-lsp/test/lsp/ui/vim/completion.vimspec
Normal file
@@ -0,0 +1,37 @@
|
||||
Describe lsp#uivim#completion
|
||||
|
||||
Before each
|
||||
%delete _
|
||||
setlocal filetype=html
|
||||
setlocal omnifunc=lsp#omni#complete
|
||||
End
|
||||
|
||||
It should expand simple snippet with multibyte chars
|
||||
Skip This test needs asynchronous process and snippetSupport=true
|
||||
|
||||
call setline(1, ['<div class="あいうえお">'])
|
||||
execute "normal! 'gg$ha id\<C-x>\<C-o>\<C-n>\<Tab>'"
|
||||
|
||||
" wait for feedkeys.
|
||||
|
||||
Assert Equals(getline(1), '<div class="あいうえお" id="">')
|
||||
Assert Equals(getpos('.')[1 : 2], [1, 30])
|
||||
End
|
||||
|
||||
It should expand when textEdit.start.character is less than completion start col
|
||||
Skip This test needs asynchronous process and snippetSupport=true
|
||||
|
||||
call setline(1, [
|
||||
\ '<html>',
|
||||
\ ' <div>',
|
||||
\ ' </>',
|
||||
\ '</html>'])
|
||||
execute "normal! ':gg2j$ha\<C-x>\<C-o>\<C-n>\<Tab>'"
|
||||
|
||||
" wait for feedkeys.
|
||||
|
||||
Assert Equals(getline(3), ' </div>')
|
||||
Assert Equals(getpos('.')[1 : 2], [1, 8])
|
||||
End
|
||||
|
||||
End
|
||||
Reference in New Issue
Block a user