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

textDocument/complete: Use isIncomplete for >100 items #132

Merged
merged 1 commit into from
Jun 3, 2020

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Jun 2, 2020

Closes #12

Ideally we should probably be limiting the number of items we pull out from whatever data storage, but the data is currently just schema and the schema is currently stored in memory, so it's cheap to just pull out everything and then cut it while constructing the completion list 🤷

We can revisit later.

@radeksimko radeksimko marked this pull request as draft June 2, 2020 18:10
@radeksimko radeksimko marked this pull request as ready for review June 2, 2020 19:13
candidates: make([]CompletionCandidate, 0),
}

prefix := prefixAtPos(file, pos)
for name, t := range bTypes {
if len(list.candidates) >= p.maxCandidates {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the list was exactly max candidates, I think this is a minor bug?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's correct, it's just probably slightly more difficult to read/understand, because it's checking the length with the addition from the previous iteration.
If the length is equal to max then this conditional doesn't even get executed, because we reached the end of the slice. I will add one more test to cover this scenario.

@radeksimko radeksimko merged commit 8805ba2 into master Jun 3, 2020
@radeksimko radeksimko deleted the f-is-incomplete branch June 3, 2020 20:32
@ghost
Copy link

ghost commented Jul 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jul 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

textDocument/complete: Use "isIncomplete" property
2 participants