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

Fix signature order cop when we have an incomplete call #164

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

vinistock
Copy link
Member

While the developer is typing, we might have no syntax errors, but an incomplete signature still (e.g.: sig { params(a: Integer).voi }).

This causes the cop to break, which is surfaced by the Ruby LSP basically every single time someone is typing a signature.

While the developer is typing, we might have no syntax errors, but an
incomplete signature still (e.g.: `sig { params(a: Integer).voi }`). We
don't want to break in those cases
@vinistock vinistock added the bugfix Fix a bug label Jul 12, 2023
@vinistock vinistock requested a review from a team as a code owner July 12, 2023 13:52
@vinistock vinistock self-assigned this Jul 12, 2023
@andyw8
Copy link
Contributor

andyw8 commented Jul 12, 2023

I wonder if there's a generic way we could detect this kind of issue, since I believe we've seen similar in the past. You could build up the fixture character by character and run the cop against each version. It would be slow, but it could be a periodic check which runs once a week or so.

@vinistock
Copy link
Member Author

Yeah, it's worth investigating techniques to find these. The only issue with going character by character is that it might not cover all possible scenarios. For example

# This error
params().

# Is different than this
params()v

# Which is also different than
params.v

Depending on autocompletion and auto-closing brackets, there might be states that aren't captured by going char by char. At the same time, it produces a lot of redundant tests since

params().v
params().vo
params().voi

are all the same test case for this particular scenario. It might be worth connecting with the YARP team and asking how they are coming up with partially complete code examples.

@vinistock vinistock merged commit 7d639be into main Jul 12, 2023
@vinistock vinistock deleted the vs/fix_signature_order_with_incomplete_call branch July 12, 2023 15:12
@shopify-shipit shopify-shipit bot temporarily deployed to production August 3, 2023 19:59 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fix a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants