Skip to content

Commit

Permalink
Watch for YAML file changes for fixtures (#557)
Browse files Browse the repository at this point in the history
Watch for YAML file changes in test fixtures
  • Loading branch information
andyw8 authored Jan 21, 2025
1 parent 65bf424 commit b779129
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions lib/ruby_lsp/ruby_lsp_rails/addon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,30 @@ 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],
),
),
],
),
)
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
Expand Down

0 comments on commit b779129

Please sign in to comment.