Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]

- Add `textDocument/rename` and `textDocument/prepareRename` support for `buf lsp serve`.
- Fix panic in LSP for empty option paths.

## [v1.61.0] - 2025-11-25

Expand Down
7 changes: 6 additions & 1 deletion private/buf/buflsp/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,12 +688,17 @@ func (f *file) messageToSymbolsHelper(msg ir.MessageValue, index int, parents []
//
// In the example, in the second definition, (option) and .message for field_b has a
// separate span from (option) and .message for field_a, but when we walk the mesasge
// tree, we get the span for (option) and .mesage for the first field. So we check the
// tree, we get the span for (option) and .message for the first field. So we check the
// symbols we've collected so far in parents and make sure we have captured a symbol for
// each path component.
for element := range seq.Values(field.Elements()) {
key := field.KeyASTs().At(element.ValueNodeIndex())
components := slices.Collect(key.AsPath().Components)
// If there are no path components for an element, then we skip it, since there are
// no symbols to track.
if len(components) == 0 {
continue
}
var span source.Span
// This covers the first case in the example above where the path is relative,
// e.g. field_a is a relative path within { } for (option).message.
Expand Down