Skip to content

Conversation

@emcfarlane
Copy link
Contributor

This improves the autocomplete to handle nested definitions. Support for keywords within definition declarations is now supported. Basic support for predeclared types. Follow up will improve type support to autocomplete type sequences and modify existing type declarations.

This improves the autocomplete to handle nested definitions.
@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2025

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedOct 24, 2025, 10:23 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.

tried this out locally and didn't see anything amiss; a couple of small suggestions

),
keywordToCompletionItem(
predeclaredTypeKeywords(),
protocol.CompletionItemKindTypeParameter,
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think I'd also make this an ItemKindKeyword, since these predeclared type keywords are builtin to protobuf. (I think TypeParameter is maybe for generics?)

Suggested change
protocol.CompletionItemKindTypeParameter,
protocol.CompletionItemKindKeyword,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switched to class to be consistent with gopls (is uses it for inbuilt types like int and defined ones). We could use struct for message types?

Copy link
Member

Choose a reason for hiding this comment

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

class is fine with me. I think message types should match whatever gopls uses for structs, probably struct?

}
if !yield(protocol.CompletionItem{
Label: suggest,
Kind: kind,
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think it would be nice to add a Detail or Documentation field to these CompletionItems if we have it, that would match info shown in hover? (I'm not sure which field is correct and/or better.) Feel free to file this as a follow-up.

Once we get into custom types as well, I think we'll want to populate the Deprecated field if we know it.

Image Image

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.

2 participants