Skip to content

Conversation

@emcfarlane
Copy link
Contributor

This adds basic autocompletion tests to the LSP.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJan 5, 2026, 11:32 PM

Copy link
Member

@stefanvanburen stefanvanburen left a comment

Choose a reason for hiding this comment

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

I'm happy to iterate on these (and realize I didn't necessarily exhaust all of these in my own tests), but I think it'd also be good to have tests covering syntax, packages and imports, options, and any of the specialized cases we have based on the parentDef. (We can follow-up on missing ones, though, especially if we're working through fixing some of this.)

Comment on lines +101 to +103
for _, expected := range tt.expectedContains {
assert.Contains(t, labels, expected, "expected completion list to contain %q", expected)
}
Copy link
Member

Choose a reason for hiding this comment

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

I realize I may have done a similar thing in my tests, but would it make sense to do an assert.ElementsMatch (ignoring ordering) so we know if the full set of completions changes? or is that too noisy (i.e., too many completion suggestions)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think theres too many.

Comment on lines +41 to +42
expectedNotContains []string
expectNoCompletions bool
Copy link
Member

Choose a reason for hiding this comment

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

nit: we don't use either of these — not sure if expectedNotContains is useful if we switch to using assert.ElementsMatch below, but can probably remove it, and it might be nice to have a couple of negative tests for places where we don't have completion suggestions (using expectNoCompletions).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are missing a bunch here, was going to follow up with some fixes needed. Theres an issue with state which isn't captured in this test. I think we need to have an update, followed by a completion to show this issue.

Copy link
Member

@doriable doriable left a comment

Choose a reason for hiding this comment

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

This looks reasonable to me, I assume we're going to add a few more cases after #4257 merges for options, etc.?

EDIT: I should've clarified, I can take care of adding those tests, this is good to merge!

@emcfarlane emcfarlane merged commit f927608 into main Jan 6, 2026
10 checks passed
@emcfarlane emcfarlane deleted the ed/addLSPAutocompleteTest branch January 6, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants