Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore didChangeWatchedFiles notification for open files #1290

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading