diff --git a/lib/ruby_lsp/standard/addon.rb b/lib/ruby_lsp/standard/addon.rb index a4976417..9c96c5f0 100644 --- a/lib/ruby_lsp/standard/addon.rb +++ b/lib/ruby_lsp/standard/addon.rb @@ -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 ) ] diff --git a/lib/standard/lsp/routes.rb b/lib/standard/lsp/routes.rb index 1850fc6d..f3348133 100644 --- a/lib/standard/lsp/routes.rb +++ b/lib/standard/lsp/routes.rb @@ -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