@@ -52,8 +52,7 @@ defmodule NextLSTest do
52
52
params: % { }
53
53
} )
54
54
55
- assert_notification "window/logMessage" ,
56
- % { "message" => "[NextLS] Runtime ready..." }
55
+ assert_notification "window/logMessage" , % { "message" => "[NextLS] Runtime ready..." }
57
56
58
57
assert :ok ==
59
58
request ( client , % {
@@ -63,7 +62,7 @@ defmodule NextLSTest do
63
62
params: nil
64
63
} )
65
64
66
- assert_result ( 2 , nil )
65
+ assert_result 2 , nil
67
66
end
68
67
69
68
test "returns method not found for unimplemented requests" , % {
@@ -90,39 +89,30 @@ defmodule NextLSTest do
90
89
}
91
90
} )
92
91
93
- assert_notification (
94
- "window/logMessage" ,
95
- % {
96
- "message" => "[NextLS] Method Not Found: textDocument/documentSymbol" ,
97
- "type" => 2
98
- }
99
- )
92
+ assert_notification "window/logMessage" , % {
93
+ "message" => "[NextLS] Method Not Found: textDocument/documentSymbol" ,
94
+ "type" => 2
95
+ }
100
96
101
- assert_error (
102
- ^ id ,
103
- % {
104
- "code" => - 32_601 ,
105
- "message" => "Method Not Found: textDocument/documentSymbol"
106
- }
107
- )
97
+ assert_error ^ id , % {
98
+ "code" => - 32_601 ,
99
+ "message" => "Method Not Found: textDocument/documentSymbol"
100
+ }
108
101
end
109
102
110
103
test "can initialize the server" do
111
- assert_result (
112
- 1 ,
113
- % {
114
- "capabilities" => % {
115
- "textDocumentSync" => % {
116
- "openClose" => true ,
117
- "save" => % {
118
- "includeText" => true
119
- } ,
120
- "change" => 1
121
- }
122
- } ,
123
- "serverInfo" => % { "name" => "NextLS" }
124
- }
125
- )
104
+ assert_result 1 , % {
105
+ "capabilities" => % {
106
+ "textDocumentSync" => % {
107
+ "openClose" => true ,
108
+ "save" => % {
109
+ "includeText" => true
110
+ } ,
111
+ "change" => 1
112
+ }
113
+ } ,
114
+ "serverInfo" => % { "name" => "NextLS" }
115
+ }
126
116
end
127
117
128
118
test "publishes diagnostics once the client has initialized" , % { client: client , cwd: cwd } do
@@ -133,37 +123,28 @@ defmodule NextLSTest do
133
123
params: % { }
134
124
} )
135
125
136
- assert_notification (
137
- "window/logMessage" ,
138
- % {
139
- "message" => "[NextLS] LSP Initialized!" ,
140
- "type" => 4
141
- }
142
- )
126
+ assert_notification "window/logMessage" , % {
127
+ "message" => "[NextLS] LSP Initialized!" ,
128
+ "type" => 4
129
+ }
143
130
144
- assert_notification ( "$/progress" , % { "value" => % { "kind" => "begin" , "title" => "Initializing NextLS runtime..." } } )
131
+ assert_notification "$/progress" , % { "value" => % { "kind" => "begin" , "title" => "Initializing NextLS runtime..." } }
145
132
146
- assert_notification (
147
- "$/progress" ,
148
- % {
149
- "value" => % {
150
- "kind" => "end" ,
151
- "message" => "NextLS runtime has initialized!"
152
- }
133
+ assert_notification "$/progress" , % {
134
+ "value" => % {
135
+ "kind" => "end" ,
136
+ "message" => "NextLS runtime has initialized!"
153
137
}
154
- )
138
+ }
155
139
156
- assert_notification ( "$/progress" , % { "value" => % { "kind" => "begin" , "title" => "Compiling..." } } )
140
+ assert_notification "$/progress" , % { "value" => % { "kind" => "begin" , "title" => "Compiling..." } }
157
141
158
- assert_notification (
159
- "$/progress" ,
160
- % {
161
- "value" => % {
162
- "kind" => "end" ,
163
- "message" => "Compiled!"
164
- }
142
+ assert_notification "$/progress" , % {
143
+ "value" => % {
144
+ "kind" => "end" ,
145
+ "message" => "Compiled!"
165
146
}
166
- )
147
+ }
167
148
168
149
for file <- [ "bar.ex" ] do
169
150
uri =
@@ -173,24 +154,21 @@ defmodule NextLSTest do
173
154
path: Path . join ( [ cwd , "lib" , file ] )
174
155
} )
175
156
176
- assert_notification (
177
- "textDocument/publishDiagnostics" ,
178
- % {
179
- "uri" => ^ uri ,
180
- "diagnostics" => [
181
- % {
182
- "source" => "Elixir" ,
183
- "severity" => 2 ,
184
- "message" =>
185
- "variable \" arg1\" is unused (if the variable is not meant to be used, prefix it with an underscore)" ,
186
- "range" => % {
187
- "start" => % { "line" => 1 , "character" => 0 } ,
188
- "end" => % { "line" => 1 , "character" => 999 }
189
- }
157
+ assert_notification "textDocument/publishDiagnostics" , % {
158
+ "uri" => ^ uri ,
159
+ "diagnostics" => [
160
+ % {
161
+ "source" => "Elixir" ,
162
+ "severity" => 2 ,
163
+ "message" =>
164
+ "variable \" arg1\" is unused (if the variable is not meant to be used, prefix it with an underscore)" ,
165
+ "range" => % {
166
+ "start" => % { "line" => 1 , "character" => 0 } ,
167
+ "end" => % { "line" => 1 , "character" => 999 }
190
168
}
191
- ]
192
- }
193
- )
169
+ }
170
+ ]
171
+ }
194
172
end
195
173
end
196
174
@@ -240,8 +218,7 @@ defmodule NextLSTest do
240
218
241
219
assert_result 2 , nil
242
220
243
- assert_notification "window/logMessage" ,
244
- % { "message" => "[NextLS] Runtime ready..." }
221
+ assert_notification "window/logMessage" , % { "message" => "[NextLS] Runtime ready..." }
245
222
246
223
request client , % {
247
224
method: "textDocument/formatting" ,
@@ -266,14 +243,11 @@ defmodule NextLSTest do
266
243
end
267
244
"""
268
245
269
- assert_result (
270
- 3 ,
271
- [
272
- % {
273
- "newText" => ^ new_text ,
274
- "range" => % { "start" => % { "character" => 0 , "line" => 0 } , "end" => % { "character" => 0 , "line" => 8 } }
275
- }
276
- ]
277
- )
246
+ assert_result 3 , [
247
+ % {
248
+ "newText" => ^ new_text ,
249
+ "range" => % { "start" => % { "character" => 0 , "line" => 0 } , "end" => % { "character" => 0 , "line" => 8 } }
250
+ }
251
+ ]
278
252
end
279
253
end
0 commit comments