@@ -32,6 +32,7 @@ def activate(global_state, message_queue)
32
32
$stderr. puts ( "Activating Ruby LSP Rails addon v#{ VERSION } " )
33
33
# Start booting the real client in a background thread. Until this completes, the client will be a NullClient
34
34
Thread . new { @client = RunnerClient . create_client }
35
+ register_additional_file_watchers ( global_state : global_state , message_queue : message_queue )
35
36
end
36
37
37
38
sig { override . void }
@@ -96,6 +97,32 @@ def workspace_did_change_watched_files(changes)
96
97
end
97
98
end
98
99
100
+ sig { params ( global_state : GlobalState , message_queue : Thread ::Queue ) . void }
101
+ def register_additional_file_watchers ( global_state :, message_queue :)
102
+ return unless global_state . supports_watching_files
103
+
104
+ message_queue << Request . new (
105
+ id : "ruby-lsp-rails-file-watcher" ,
106
+ method : "client/registerCapability" ,
107
+ params : Interface ::RegistrationParams . new (
108
+ registrations : [
109
+ Interface ::Registration . new (
110
+ id : "workspace/didChangeWatchedFilesRails" ,
111
+ method : "workspace/didChangeWatchedFiles" ,
112
+ register_options : Interface ::DidChangeWatchedFilesRegistrationOptions . new (
113
+ watchers : [
114
+ Interface ::FileSystemWatcher . new (
115
+ glob_pattern : "**/*structure.sql" ,
116
+ kind : Constant ::WatchKind ::CREATE | Constant ::WatchKind ::CHANGE | Constant ::WatchKind ::DELETE ,
117
+ ) ,
118
+ ] ,
119
+ ) ,
120
+ ) ,
121
+ ] ,
122
+ ) ,
123
+ )
124
+ end
125
+
99
126
sig { override . returns ( String ) }
100
127
def name
101
128
"Ruby LSP Rails"
0 commit comments