Skip to content

Index a file's own options in the LSP - #4807

Open
douzebis wants to merge 1 commit into
bufbuild:mainfrom
douzebis:lsp-file-options
Open

douzebis wants to merge 1 commit into
bufbuild:mainfrom
douzebis:lsp-file-options

Conversation

@douzebis

Copy link
Copy Markdown

Fixes #4806.

Go-to-definition and references found nothing for a custom file option
such as option (my.file_option) = "x";, while they work for a
message's or a field's options.

indexSymbols indexes each symbol's options, but the file itself is not
a symbol, so its options were never reached. This indexes
f.ir.Options() there, the same way, with messageToSymbols.

  • TestDefinitionFileOption: go-to-definition on a file option and, as
    a control, on a field option; it fails without the change (no location
    for the file option) and passes with it.
  • go test ./private/buf/buflsp/ passes.
  • Checked by hand: references on a file option's declaration now find
    its uses.

A CHANGELOG entry is included under Unreleased.

Go-to-definition and references found nothing for a custom file option,
such as option (my.file_option) = "x";, while they work for a message's
or a field's options. indexSymbols indexes each symbol's options, but
the file itself is not a symbol, so its options were never reached.
Index f.ir.Options() there, the same way.
@CLAassistant

CLAassistant commented Nov 23, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
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.

LSP: go-to-definition and references don't work for custom file options

2 participants