Skip to content

Commit 17812c5

Browse files
committed
Watch for YAML file changes
1 parent 27a3728 commit 17812c5

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

lib/ruby_lsp/ruby_lsp_rails/addon.rb

+21-6
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ def workspace_did_change_watched_files(changes)
144144

145145
offer_to_run_pending_migrations
146146
end
147+
148+
if changes.any? { |c| c[:uri].end_with?(".yml") || c[:uri].end_with?(".yaml") }
149+
# TODO
150+
end
147151
end
148152

149153
sig { override.returns(String) }
@@ -223,19 +227,30 @@ def register_additional_file_watchers(global_state:, outgoing_queue:)
223227
id: "workspace/didChangeWatchedFilesRails",
224228
method: "workspace/didChangeWatchedFiles",
225229
register_options: Interface::DidChangeWatchedFilesRegistrationOptions.new(
226-
watchers: [
227-
Interface::FileSystemWatcher.new(
228-
glob_pattern: "**/*structure.sql",
229-
kind: Constant::WatchKind::CREATE | Constant::WatchKind::CHANGE | Constant::WatchKind::DELETE,
230-
),
231-
],
230+
watchers: [structure_sql_file_watcher, yaml_file_watcher],
232231
),
233232
),
234233
],
235234
),
236235
)
237236
end
238237

238+
sig { returns(Interface::FileSystemWatcher) }
239+
def structure_sql_file_watcher
240+
Interface::FileSystemWatcher.new(
241+
glob_pattern: "**/*structure.sql",
242+
kind: Constant::WatchKind::CREATE | Constant::WatchKind::CHANGE | Constant::WatchKind::DELETE,
243+
)
244+
end
245+
246+
sig { returns(Interface::FileSystemWatcher) }
247+
def yaml_file_watcher
248+
Interface::FileSystemWatcher.new(
249+
glob_pattern: "**/*.yml", # TODO: also YAML
250+
kind: Constant::WatchKind::CREATE | Constant::WatchKind::CHANGE | Constant::WatchKind::DELETE,
251+
)
252+
end
253+
239254
sig { void }
240255
def offer_to_run_pending_migrations
241256
return unless @outgoing_queue

0 commit comments

Comments
 (0)