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 decorated_parameters for when method has no parameters #2229

Merged
merged 2 commits into from
Jul 2, 2024

Conversation

andyw8
Copy link
Contributor

@andyw8 andyw8 commented Jun 27, 2024

Motivation

When indexing a method with no arguments, it was failing with:

NoMethodError: private method `format' called for an instance of RubyIndexer::Entry::Signature

(because signatures.first was returning nil, and format is defined on nil as a private method)

Implementation

Hand the case of a method with no arguments.

Automated Tests

Updated

Manual Tests

Add a file with a method with no parameters. Save it and ensure there are no errors in the console.

@andyw8 andyw8 marked this pull request as ready for review June 27, 2024 16:12
@andyw8 andyw8 requested a review from a team as a code owner June 27, 2024 16:12
@andyw8 andyw8 requested review from st0012 and vinistock June 27, 2024 16:12
@andyw8 andyw8 force-pushed the andyw8/fix-decorated-params branch from 94a103e to e032003 Compare June 27, 2024 16:15
Co-authored-by: Vinicius Stock <vinistock@users.noreply.github.com>
@vinistock vinistock added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels Jul 2, 2024
@andyw8
Copy link
Contributor Author

andyw8 commented Jul 2, 2024

Actually, this may be a little more involved.

On this branch, if you open a new file and type class, there's no longer and error but you'll see this:

Screenshot 2024-07-02 at 11 30 00 AM

Since class is very often the first thing someone will type in a file, it's not a great experience.

@vinistock
Copy link
Member

I understand the concern, but I will say that those are separate in my opinion. The behaviour is correct: you can invoke class on the top level because it is an instance of Object. What we're missing is completion for keywords, so that you'd get a second element for it.

If you prefer to wait shipping that's fine, but I'm not opposed to moving ahead and handling keywords later.

@andyw8 andyw8 merged commit 5d835f7 into main Jul 2, 2024
35 checks passed
@andyw8 andyw8 deleted the andyw8/fix-decorated-params branch July 2, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants