@@ -151,6 +151,24 @@ def test_formatting
151151 assert_equal ( "class Bar\n end\n " , responses . dig ( 1 , :result , 0 , :newText ) )
152152 end
153153
154+ def test_formatting_ignore
155+ responses = run_server ( [
156+ Initialize . new ( 1 ) ,
157+ TextDocumentDidOpen . new ( "file:///path/to/file.rb" , "class Foo; end" ) ,
158+ TextDocumentFormatting . new ( 2 , "file:///path/to/file.rb" ) ,
159+ Shutdown . new ( 3 )
160+ ] , ignore_files : [ "path/**/*.rb" ] )
161+
162+ shape = LanguageServer ::Request [ [
163+ { id : 1 , result : { capabilities : Hash } } ,
164+ { id : 2 , result : :any } ,
165+ { id : 3 , result : { } }
166+ ] ]
167+
168+ assert_operator ( shape , :=== , responses )
169+ assert_nil ( responses . dig ( 1 , :result ) )
170+ end
171+
154172 def test_formatting_failure
155173 responses = run_server ( [
156174 Initialize . new ( 1 ) ,
@@ -322,14 +340,15 @@ def read(content)
322340 end
323341 end
324342
325- def run_server ( messages , print_width : DEFAULT_PRINT_WIDTH )
343+ def run_server ( messages , print_width : DEFAULT_PRINT_WIDTH , ignore_files : [ ] )
326344 input = StringIO . new ( messages . map { |message | write ( message ) } . join )
327345 output = StringIO . new
328346
329347 LanguageServer . new (
330348 input : input ,
331349 output : output ,
332- print_width : print_width
350+ print_width : print_width ,
351+ ignore_files : ignore_files
333352 ) . run
334353
335354 read ( output . tap ( &:rewind ) )
0 commit comments