Skip to content

Commit

Permalink
watch for changes to .standard_todo.yml as well as .standard.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
searls committed Jul 2, 2024
1 parent ab18144 commit edd199b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/ruby_lsp/standard/addon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def register_additional_file_watchers(global_state, message_queue)
register_options: Interface::DidChangeWatchedFilesRegistrationOptions.new(
watchers: [
Interface::FileSystemWatcher.new(
glob_pattern: "**/.standard.yml",
glob_pattern: "**/.standard{,_todo}.yml",
kind: Constant::WatchKind::CREATE | Constant::WatchKind::CHANGE | Constant::WatchKind::DELETE
)
]
Expand Down
9 changes: 8 additions & 1 deletion lib/standard/lsp/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,15 @@ def for(name)
@logger.puts "Ignoring workspace/didChangeConfiguration"
end

CONFIGURATION_FILE_PATTERNS = [
".standard.yml",
".standard_todo.yml"
].freeze

handle "workspace/didChangeWatchedFiles" do |request|
if request[:params][:changes].any? { |change| change[:uri].end_with?(".standard.yml") }
if request[:params][:changes].any? { |change|
CONFIGURATION_FILE_PATTERNS.any? { |path| change[:uri].end_with?(path) }
}
@logger.puts "Configuration file changed; restart required"
@kills_server.call
end
Expand Down

0 comments on commit edd199b

Please sign in to comment.