diff --git a/lib/ruby_lsp/ruby_lsp_rails/addon.rb b/lib/ruby_lsp/ruby_lsp_rails/addon.rb index e10e9e91..2db8a9a5 100644 --- a/lib/ruby_lsp/ruby_lsp_rails/addon.rb +++ b/lib/ruby_lsp/ruby_lsp_rails/addon.rb @@ -223,12 +223,7 @@ def register_additional_file_watchers(global_state:, outgoing_queue:) id: "workspace/didChangeWatchedFilesRails", method: "workspace/didChangeWatchedFiles", register_options: Interface::DidChangeWatchedFilesRegistrationOptions.new( - watchers: [ - Interface::FileSystemWatcher.new( - glob_pattern: "**/*structure.sql", - kind: Constant::WatchKind::CREATE | Constant::WatchKind::CHANGE | Constant::WatchKind::DELETE, - ), - ], + watchers: [structure_sql_file_watcher, fixture_file_watcher], ), ), ], @@ -236,6 +231,22 @@ def register_additional_file_watchers(global_state:, outgoing_queue:) ) end + sig { returns(Interface::FileSystemWatcher) } + def structure_sql_file_watcher + Interface::FileSystemWatcher.new( + glob_pattern: "**/*structure.sql", + kind: Constant::WatchKind::CREATE | Constant::WatchKind::CHANGE | Constant::WatchKind::DELETE, + ) + end + + sig { returns(Interface::FileSystemWatcher) } + def fixture_file_watcher + Interface::FileSystemWatcher.new( + glob_pattern: "/fixtures/**/*.{yml,yaml,yml.erb,yaml.erb}", + kind: Constant::WatchKind::CREATE | Constant::WatchKind::CHANGE | Constant::WatchKind::DELETE, + ) + end + sig { void } def offer_to_run_pending_migrations return unless @outgoing_queue