mirror of
https://github.com/dense-analysis/ale
synced 2024-12-30 01:52:13 +00:00
133 lines
3.3 KiB
Plaintext
133 lines
3.3 KiB
Plaintext
Before:
|
|
let b:conn = {
|
|
\ 'is_tsserver': 0,
|
|
\ 'data': '',
|
|
\ 'root': '/foo/bar',
|
|
\ 'open_documents': {},
|
|
\ 'initialized': 0,
|
|
\ 'init_request_id': 0,
|
|
\ 'init_options': {},
|
|
\ 'callback_list': [],
|
|
\ 'message_queue': [],
|
|
\ 'capabilities_queue': [],
|
|
\ 'capabilities': {
|
|
\ 'hover': 0,
|
|
\ 'references': 0,
|
|
\ 'completion': 0,
|
|
\ 'completion_trigger_characters': [],
|
|
\ 'definition': 0,
|
|
\ },
|
|
\}
|
|
|
|
After:
|
|
unlet! b:conn
|
|
|
|
Execute(Messages with no method and capabilities should initialize projects):
|
|
call ale#lsp#HandleInitResponse(b:conn, {
|
|
\ 'result': {'capabilities': {}},
|
|
\})
|
|
|
|
AssertEqual 1, b:conn.initialized
|
|
|
|
Execute(Other messages should not initialize projects):
|
|
call ale#lsp#HandleInitResponse(b:conn, {'method': 'lolwat'})
|
|
|
|
AssertEqual 0, b:conn.initialized
|
|
|
|
call ale#lsp#HandleInitResponse(b:conn, {'result': {'x': {}}})
|
|
|
|
AssertEqual 0, b:conn.initialized
|
|
|
|
Execute(Capabilities should bet set up correctly):
|
|
call ale#lsp#HandleInitResponse(b:conn, {
|
|
\ 'jsonrpc': '2.0',
|
|
\ 'id': 1,
|
|
\ 'result': {
|
|
\ 'capabilities': {
|
|
\ 'renameProvider': v:true,
|
|
\ 'executeCommandProvider': {
|
|
\ 'commands': [],
|
|
\ },
|
|
\ 'hoverProvider': v:true,
|
|
\ 'documentSymbolProvider': v:true,
|
|
\ 'documentRangeFormattingProvider': v:true,
|
|
\ 'codeLensProvider': {
|
|
\ 'resolveProvider': v:false
|
|
\ },
|
|
\ 'referencesProvider': v:true,
|
|
\ 'textDocumentSync': 2,
|
|
\ 'documentFormattingProvider': v:true,
|
|
\ 'codeActionProvider': v:true,
|
|
\ 'signatureHelpProvider': {
|
|
\ 'triggerCharacters': ['(', ','],
|
|
\ },
|
|
\ 'completionProvider': {
|
|
\ 'triggerCharacters': ['.'],
|
|
\ 'resolveProvider': v:false
|
|
\ },
|
|
\ 'definitionProvider': v:true,
|
|
\ 'experimental': {},
|
|
\ 'documentHighlightProvider': v:true
|
|
\ },
|
|
\ },
|
|
\})
|
|
|
|
AssertEqual 1, b:conn.initialized
|
|
AssertEqual
|
|
\ {
|
|
\ 'completion_trigger_characters': ['.'],
|
|
\ 'completion': 1,
|
|
\ 'references': 1,
|
|
\ 'hover': 1,
|
|
\ 'definition': 1,
|
|
\ },
|
|
\ b:conn.capabilities
|
|
|
|
Execute(Disabled capabilities should be recognised correctly):
|
|
call ale#lsp#HandleInitResponse(b:conn, {
|
|
\ 'jsonrpc': '2.0',
|
|
\ 'id': 1,
|
|
\ 'result': {
|
|
\ 'capabilities': {
|
|
\ 'renameProvider': v:true,
|
|
\ 'executeCommandProvider': {
|
|
\ 'commands': [],
|
|
\ },
|
|
\ 'hoverProvider': v:false,
|
|
\ 'documentSymbolProvider': v:true,
|
|
\ 'documentRangeFormattingProvider': v:true,
|
|
\ 'codeLensProvider': {
|
|
\ 'resolveProvider': v:false
|
|
\ },
|
|
\ 'referencesProvider': v:false,
|
|
\ 'textDocumentSync': 2,
|
|
\ 'documentFormattingProvider': v:true,
|
|
\ 'codeActionProvider': v:true,
|
|
\ 'signatureHelpProvider': {
|
|
\ 'triggerCharacters': ['(', ','],
|
|
\ },
|
|
\ 'definitionProvider': v:false,
|
|
\ 'experimental': {},
|
|
\ 'documentHighlightProvider': v:true
|
|
\ },
|
|
\ },
|
|
\})
|
|
|
|
AssertEqual 1, b:conn.initialized
|
|
AssertEqual
|
|
\ {
|
|
\ 'completion_trigger_characters': [],
|
|
\ 'completion': 0,
|
|
\ 'references': 0,
|
|
\ 'hover': 0,
|
|
\ 'definition': 0,
|
|
\ },
|
|
\ b:conn.capabilities
|
|
|
|
Execute(Results that are not dictionaries should be handled correctly):
|
|
call ale#lsp#HandleInitResponse(b:conn, {
|
|
\ 'jsonrpc': '2.0',
|
|
\ 'id': 1,
|
|
\ 'result': v:null,
|
|
\})
|