Skip to content

Commit

Permalink
Ignore didChangeWatchedFiles notification for open files
Browse files Browse the repository at this point in the history
  • Loading branch information
soutaro committed Oct 24, 2024
1 parent 9d432eb commit 55fd179
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/steep/server/master.rb
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,17 @@ def process_message_from_client(message)
end

when "workspace/didChangeWatchedFiles"
updated_watched_files = [] #: Array[Pathname]

message[:params][:changes].each do |change|
uri = change[:uri]
type = change[:type]

path = PathHelper.to_pathname(uri) or next
path = PathHelper.to_pathname!(uri)

unless controller.priority_paths.include?(path)
updated_watched_files << path

controller.push_changes(path)

case type
Expand All @@ -720,10 +724,16 @@ def process_message_from_client(message)
end

content or raise

broadcast_notification(CustomMethods::FileReset.notification({ uri: uri, content: content }))
end
end

if updated_watched_files.empty?
Steep.logger.info { "Exit from workspace/didChangeWatchedFiles notification because all of the changed files are already open" }
return
end

if typecheck_automatically
start_type_checking_queue.execute do
job_queue.push(
Expand Down

0 comments on commit 55fd179

Please sign in to comment.