2017-06-07 16:05:28 +00:00
|
|
|
Before:
|
|
|
|
silent! cd /testplugin/test/lsp
|
|
|
|
let b:dir = getcwd()
|
|
|
|
|
|
|
|
After:
|
|
|
|
silent execute 'cd ' . fnameescape(b:dir)
|
|
|
|
unlet! b:dir
|
|
|
|
|
2017-05-08 21:18:28 +00:00
|
|
|
Execute(ale#lsp#message#Initialize() should return correct messages):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 0,
|
|
|
|
\ 'initialize',
|
|
|
|
\ {
|
|
|
|
\ 'processId': getpid(),
|
|
|
|
\ 'rootUri': '/foo/bar',
|
|
|
|
\ 'capabilities': {},
|
|
|
|
\ }
|
|
|
|
\ ],
|
|
|
|
\ ale#lsp#message#Initialize('/foo/bar')
|
|
|
|
|
|
|
|
Execute(ale#lsp#message#Initialized() should return correct messages):
|
|
|
|
AssertEqual [1, 'initialized'], ale#lsp#message#Initialized()
|
|
|
|
|
|
|
|
Execute(ale#lsp#message#Shutdown() should return correct messages):
|
|
|
|
AssertEqual [0, 'shutdown'], ale#lsp#message#Shutdown()
|
|
|
|
|
|
|
|
Execute(ale#lsp#message#Exit() should return correct messages):
|
|
|
|
AssertEqual [1, 'exit'], ale#lsp#message#Exit(),
|
|
|
|
|
|
|
|
Execute(ale#lsp#message#DidOpen() should return correct messages):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 1,
|
|
|
|
\ 'textDocument/didOpen',
|
|
|
|
\ {
|
|
|
|
\ 'textDocument': {
|
|
|
|
\ 'uri': '/foo/bar',
|
|
|
|
\ 'languageId': 'typescript',
|
|
|
|
\ 'version': 123,
|
|
|
|
\ 'text': 'foobar',
|
|
|
|
\ },
|
|
|
|
\ }
|
|
|
|
\ ],
|
|
|
|
\ ale#lsp#message#DidOpen('/foo/bar', 'typescript', 123, 'foobar')
|
|
|
|
|
|
|
|
Execute(ale#lsp#message#DidChange() should return correct messages):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 1,
|
|
|
|
\ 'textDocument/didChange',
|
|
|
|
\ {
|
|
|
|
\ 'textDocument': {
|
|
|
|
\ 'uri': '/foo/bar',
|
|
|
|
\ 'version': 123,
|
|
|
|
\ },
|
|
|
|
\ 'contentChanges': [{'text': 'foobar'}],
|
|
|
|
\ }
|
|
|
|
\ ],
|
|
|
|
\ ale#lsp#message#DidChange('/foo/bar', 123, 'foobar')
|
|
|
|
|
|
|
|
Execute(ale#lsp#message#DidSave() should return correct messages):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 1,
|
|
|
|
\ 'textDocument/didSave',
|
|
|
|
\ {
|
|
|
|
\ 'textDocument': {
|
|
|
|
\ 'uri': '/foo/bar',
|
|
|
|
\ },
|
|
|
|
\ }
|
|
|
|
\ ],
|
|
|
|
\ ale#lsp#message#DidSave('/foo/bar')
|
|
|
|
|
|
|
|
Execute(ale#lsp#message#DidClose() should return correct messages):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 1,
|
|
|
|
\ 'textDocument/didClose',
|
|
|
|
\ {
|
|
|
|
\ 'textDocument': {
|
|
|
|
\ 'uri': '/foo/bar',
|
|
|
|
\ },
|
|
|
|
\ }
|
|
|
|
\ ],
|
|
|
|
\ ale#lsp#message#DidClose('/foo/bar')
|
2017-06-07 16:05:28 +00:00
|
|
|
|
|
|
|
Execute(ale#lsp#tsserver_message#Open() should return correct messages):
|
|
|
|
silent! noautocmd file foo.ts
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 1,
|
|
|
|
\ 'ts@open',
|
|
|
|
\ {
|
|
|
|
\ 'file': b:dir . '/foo.ts',
|
|
|
|
\ }
|
|
|
|
\ ],
|
|
|
|
\ ale#lsp#tsserver_message#Open(bufnr(''))
|
|
|
|
|
|
|
|
Execute(ale#lsp#tsserver_message#Close() should return correct messages):
|
|
|
|
silent! noautocmd file foo.ts
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 1,
|
|
|
|
\ 'ts@close',
|
|
|
|
\ {
|
|
|
|
\ 'file': b:dir . '/foo.ts',
|
|
|
|
\ }
|
|
|
|
\ ],
|
|
|
|
\ ale#lsp#tsserver_message#Close(bufnr(''))
|
|
|
|
|
|
|
|
Given typescript(A TypeScript file with 3 lines):
|
|
|
|
foo()
|
|
|
|
bar()
|
|
|
|
baz()
|
|
|
|
|
|
|
|
Execute(ale#lsp#tsserver_message#Change() should return correct messages):
|
|
|
|
silent! noautocmd file foo.ts
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 1,
|
|
|
|
\ 'ts@change',
|
|
|
|
\ {
|
|
|
|
\ 'file': b:dir . '/foo.ts',
|
|
|
|
\ 'line': 1,
|
|
|
|
\ 'offset': 1,
|
2017-06-08 16:28:38 +00:00
|
|
|
\ 'endLine': 1073741824,
|
|
|
|
\ 'endOffset': 1,
|
2017-06-07 16:05:28 +00:00
|
|
|
\ 'insertString': "foo()\nbar()\nbaz()",
|
|
|
|
\ }
|
|
|
|
\ ],
|
|
|
|
\ ale#lsp#tsserver_message#Change(bufnr(''))
|
|
|
|
|
|
|
|
Execute(ale#lsp#tsserver_message#Geterr() should return correct messages):
|
|
|
|
silent! noautocmd file foo.ts
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
2017-06-13 16:53:47 +00:00
|
|
|
\ 1,
|
2017-06-07 16:05:28 +00:00
|
|
|
\ 'ts@geterr',
|
|
|
|
\ {
|
|
|
|
\ 'files': [b:dir . '/foo.ts'],
|
|
|
|
\ }
|
|
|
|
\ ],
|
|
|
|
\ ale#lsp#tsserver_message#Geterr(bufnr(''))
|
2017-07-01 00:22:03 +00:00
|
|
|
|
|
|
|
Execute(ale#lsp#tsserver_message#Completions() should return correct messages):
|
|
|
|
silent! noautocmd file foo.ts
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 0,
|
|
|
|
\ 'ts@completions',
|
|
|
|
\ {
|
|
|
|
\ 'file': b:dir . '/foo.ts',
|
|
|
|
\ 'line': 347,
|
|
|
|
\ 'offset': 12,
|
|
|
|
\ }
|
|
|
|
\ ],
|
|
|
|
\ ale#lsp#tsserver_message#Completions(bufnr(''), 347, 12)
|
|
|
|
|
|
|
|
Execute(ale#lsp#tsserver_message#CompletionEntryDetails() should return correct messages):
|
|
|
|
silent! noautocmd file foo.ts
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 0,
|
|
|
|
\ 'ts@completionEntryDetails',
|
|
|
|
\ {
|
|
|
|
\ 'file': b:dir . '/foo.ts',
|
|
|
|
\ 'line': 347,
|
|
|
|
\ 'offset': 12,
|
|
|
|
\ 'entryNames': ['foo', 'bar'],
|
|
|
|
\ }
|
|
|
|
\ ],
|
|
|
|
\ ale#lsp#tsserver_message#CompletionEntryDetails(bufnr(''), 347, 12, ['foo', 'bar'])
|