1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
Before:
let b:project = {
\ 'initialized': 0,
\ 'init_request_id': 3,
\ 'message_queue': [],
\}
let b:conn = {
\ 'projects': {
\ '/foo/bar': b:project,
\ },
\}
After:
unlet! b:project
unlet! b:conn
Execute(publishDiagnostics messages with files inside project directories should initialize projects):
" This is for some other file, ignore this one.
call ale#lsp#HandleOtherInitializeResponses(b:conn, {
\ 'method': 'textDocument/publishDiagnostics',
\ 'params': {'uri': 'file:///xyz/bar/baz.txt'},
\})
AssertEqual
\ {
\ 'initialized': 0,
\ 'init_request_id': 3,
\ 'message_queue': [],
\ },
\ b:project
call ale#lsp#HandleOtherInitializeResponses(b:conn, {
\ 'method': 'textDocument/publishDiagnostics',
\ 'params': {'uri': 'file:///foo/bar/baz.txt'},
\})
AssertEqual
\ {
\ 'initialized': 1,
\ 'init_request_id': 3,
\ 'message_queue': [],
\ },
\ b:project
Execute(Messages with no method and capabilities should initialize projects):
call ale#lsp#HandleOtherInitializeResponses(b:conn, {
\ 'result': {'capabilities': {}},
\})
AssertEqual
\ {
\ 'initialized': 1,
\ 'init_request_id': 3,
\ 'message_queue': [],
\ },
\ b:project
Execute(Other messages should not initialize projects):
call ale#lsp#HandleOtherInitializeResponses(b:conn, {'method': 'lolwat'})
AssertEqual 0, b:project.initialized
call ale#lsp#HandleOtherInitializeResponses(b:conn, {'result': {'x': {}}})
AssertEqual 0, b:project.initialized
|