@@ -11,9 +11,9 @@ def to_hash
11
11
end
12
12
end
13
13
14
- class Shutdown
14
+ class Shutdown < Struct . new ( :id )
15
15
def to_hash
16
- { method : "shutdown" }
16
+ { method : "shutdown" , id : id }
17
17
end
18
18
end
19
19
@@ -107,13 +107,14 @@ def test_formatting
107
107
TextDocumentDidChange . new ( "file:///path/to/file.rb" , "class Bar; end" ) ,
108
108
TextDocumentFormatting . new ( 2 , "file:///path/to/file.rb" ) ,
109
109
TextDocumentDidClose . new ( "file:///path/to/file.rb" ) ,
110
- Shutdown . new
110
+ Shutdown . new ( 3 )
111
111
]
112
112
113
113
case run_server ( messages )
114
114
in [
115
115
{ id : 1 , result : { capabilities : Hash } } ,
116
- { id : 2 , result : [ { newText : new_text } ] }
116
+ { id : 2 , result : [ { newText : new_text } ] } ,
117
+ { id : 3 , result : { } }
117
118
]
118
119
assert_equal ( "class Bar\n end\n " , new_text )
119
120
end
@@ -129,13 +130,14 @@ def test_inlay_hints
129
130
end
130
131
RUBY
131
132
TextDocumentInlayHints . new ( 2 , "file:///path/to/file.rb" ) ,
132
- Shutdown . new
133
+ Shutdown . new ( 3 )
133
134
]
134
135
135
136
case run_server ( messages )
136
137
in [
137
138
{ id : 1 , result : { capabilities : Hash } } ,
138
- { id : 2 , result : { before :, after : } }
139
+ { id : 2 , result : { before :, after : } } ,
140
+ { id : 3 , result : { } }
139
141
]
140
142
assert_equal ( 1 , before . length )
141
143
assert_equal ( 2 , after . length )
@@ -147,11 +149,15 @@ def test_visualizing
147
149
Initialize . new ( 1 ) ,
148
150
TextDocumentDidOpen . new ( "file:///path/to/file.rb" , "1 + 2" ) ,
149
151
SyntaxTreeVisualizing . new ( 2 , "file:///path/to/file.rb" ) ,
150
- Shutdown . new
152
+ Shutdown . new ( 3 )
151
153
]
152
154
153
155
case run_server ( messages )
154
- in [ { id : 1 , result : { capabilities : Hash } } , { id : 2 , result : } ]
156
+ in [
157
+ { id : 1 , result : { capabilities : Hash } } ,
158
+ { id : 2 , result : } ,
159
+ { id : 3 , result : { } }
160
+ ]
155
161
assert_equal (
156
162
"(program (statements ((binary (int \" 1\" ) + (int \" 2\" )))))\n " ,
157
163
result
@@ -167,13 +173,14 @@ def test_reading_file
167
173
messages = [
168
174
Initialize . new ( 1 ) ,
169
175
TextDocumentFormatting . new ( 2 , "file://#{ file . path } " ) ,
170
- Shutdown . new
176
+ Shutdown . new ( 3 )
171
177
]
172
178
173
179
case run_server ( messages )
174
180
in [
175
181
{ id : 1 , result : { capabilities : Hash } } ,
176
- { id : 2 , result : [ { newText : new_text } ] }
182
+ { id : 2 , result : [ { newText : new_text } ] } ,
183
+ { id : 3 , result : { } }
177
184
]
178
185
assert_equal ( "class Foo\n end\n " , new_text )
179
186
end
@@ -186,6 +193,15 @@ def test_bogus_request
186
193
end
187
194
end
188
195
196
+ def test_clean_shutdown
197
+ messages = [ Initialize . new ( 1 ) , Shutdown . new ( 2 ) ]
198
+
199
+ case run_server ( messages )
200
+ in [ { id : 1 , result : { capabilities : Hash } } , { id : 2 , result : { } } ]
201
+ assert_equal ( true , true )
202
+ end
203
+ end
204
+
189
205
private
190
206
191
207
def write ( content )
0 commit comments