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

Reuse the latest result to keep SignatureHelp opened while typing #835

Merged
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions lib/steep/server/interaction_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,17 @@ def process_signature_help(job)
)
end

LSP::Interface::SignatureHelp.new(
@last_signature_help_line = job.line
@last_signature_help_result = LSP::Interface::SignatureHelp.new(
signatures: signatures,
active_signature: index
)
end
end
end
rescue Parser::SyntaxError
# Ignore syntax error
# Reuse the latest result to keep SignatureHelp opened while typing
@last_signature_help_result if @last_signature_help_line == job.line
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions sig/steep/server/interaction_worker.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ module Steep

module LSP = LanguageServer::Protocol

@last_signature_help_line: Integer

@last_signature_help_result: LanguageServer::Protocol::Interface::SignatureHelp

attr_reader service: Services::TypeCheckService

def initialize: (project: Project, reader: Reader, writer: Writer, ?queue: Queue) -> void
Expand Down