Avoid errors for empty DSL matches in add-on mode#2675
Conversation
When the LSP requests generation for an existing constant with no processable DSL, return quietly instead of raising Tapioca::Error. Co-authored-by: Cursor <cursoragent@cursor.com>
| end) | ||
| break if Process.clock_gettime(Process::CLOCK_MONOTONIC) >= deadline | ||
|
|
||
| sleep(0.1) |
There was a problem hiding this comment.
This is guaranteed to be flakey if the GitHub action runner is overcommited. Is there some other wait we could do?
There was a problem hiding this comment.
Ah, you're right. I'll replace the timed poll with a wait on the dsl request's work-done-progress "end" event. So since the error log is always sent before "end", then blocking until "end" makes the check deterministic. I'll enable window.workDoneProgress on the test client
There was a problem hiding this comment.
Now waiting on the dsl work-done-progress "end" event instead of a timed poll. Errors are always logged before "end", so the check is deterministic.
|
Good improvement though! |
Co-authored-by: Cursor <cursoragent@cursor.com>
| notification.params&.message.to_s | ||
| end | ||
|
|
||
| message.include?("Tapioca::Error") || message.include?("failed with StandardError") |
There was a problem hiding this comment.
I think this is a bit restrictive for the future. What about a more general:
message.include?("Tapioca::Error") || message.match?(/\ARequest .* failed\b/)
There was a problem hiding this comment.
Yeah, you're right. I just updated to match the broader Request … failed shape so we don’t miss non-StandardError failures
Avoid coupling the helper to StandardError so other Request-failed shapes from ruby-lsp-rails are still caught. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Tapioca::Errorin the editorFixes #2348
Test plan
Fooclass with no processable DSL