@@ -1123,8 +1123,6 @@ def test_edits_outside_of_declarations_do_not_trigger_indexing
1123
1123
end
1124
1124
1125
1125
def test_rubocop_config_changes_trigger_workspace_diagnostic_refresh
1126
- uri = URI ::Generic . from_path ( path : File . join ( Dir . pwd , ".rubocop.yml" ) )
1127
-
1128
1126
@server . process_message ( {
1129
1127
id : 1 ,
1130
1128
method : "initialize" ,
@@ -1140,20 +1138,10 @@ def test_rubocop_config_changes_trigger_workspace_diagnostic_refresh
1140
1138
} )
1141
1139
1142
1140
@server . global_state . index . index_all ( uris : [ ] )
1143
- @server . process_message ( {
1144
- method : "workspace/didChangeWatchedFiles" ,
1145
- params : {
1146
- changes : [
1147
- {
1148
- uri : uri ,
1149
- type : RubyLsp ::Constant ::FileChangeType ::CHANGED ,
1150
- } ,
1151
- ] ,
1152
- } ,
1153
- } )
1154
1141
1155
- request = find_message ( RubyLsp ::Request )
1156
- assert_equal ( "workspace/diagnostic/refresh" , request . method )
1142
+ RubyLsp ::Requests ::Support ::RuboCopRunner ::CONFIG_FILES . each do |config_file |
1143
+ assert_rubocop_config_triggers_diagnostic_refresh_without_setup ( config_file )
1144
+ end
1157
1145
end
1158
1146
1159
1147
def test_compose_bundle_creates_file_to_skip_next_compose
@@ -1712,6 +1700,46 @@ def deactivate; end
1712
1700
end
1713
1701
end
1714
1702
1703
+ def assert_rubocop_config_triggers_diagnostic_refresh ( config_file )
1704
+ uri = URI ::Generic . from_path ( path : File . join ( Dir . pwd , config_file ) )
1705
+
1706
+ @server . process_message ( {
1707
+ id : 1 ,
1708
+ method : "initialize" ,
1709
+ params : {
1710
+ initializationOptions : { } ,
1711
+ capabilities : {
1712
+ general : {
1713
+ positionEncodings : [ "utf-8" ] ,
1714
+ } ,
1715
+ workspace : { diagnostics : { refreshSupport : true } } ,
1716
+ } ,
1717
+ } ,
1718
+ } )
1719
+
1720
+ @server . global_state . index . index_all ( uris : [ ] )
1721
+ assert_rubocop_config_triggers_diagnostic_refresh_without_setup ( config_file )
1722
+ end
1723
+
1724
+ def assert_rubocop_config_triggers_diagnostic_refresh_without_setup ( config_file )
1725
+ uri = URI ::Generic . from_path ( path : File . join ( Dir . pwd , config_file ) )
1726
+
1727
+ @server . process_message ( {
1728
+ method : "workspace/didChangeWatchedFiles" ,
1729
+ params : {
1730
+ changes : [
1731
+ {
1732
+ uri : uri ,
1733
+ type : RubyLsp ::Constant ::FileChangeType ::CHANGED ,
1734
+ } ,
1735
+ ] ,
1736
+ } ,
1737
+ } )
1738
+
1739
+ request = find_message ( RubyLsp ::Request )
1740
+ assert_equal ( "workspace/diagnostic/refresh" , request . method )
1741
+ end
1742
+
1715
1743
#: (Class desired_class, ?String? desired_method, ?id: Integer?) -> untyped
1716
1744
def find_message ( desired_class , desired_method = nil , id : nil )
1717
1745
message = @server . pop_response
0 commit comments