Skip to content
Open
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 LSP completion for `buf.gen.yaml`, `buf.yaml`, and `buf.policy.yaml` files.
- Fix LSP `textDocument/documentSymbol` marking every symbol as deprecated.

## [v1.69.0] - 2026-04-29

Expand Down
11 changes: 11 additions & 0 deletions private/buf/buflsp/document_symbol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ func TestDocumentSymbol(t *testing.T) {
{name: "symbols.v1.CreateDocumentResponse.document", kind: protocol.SymbolKindField, line: 39}, // Document document
{name: "symbols.v1.LegacyDocument", kind: protocol.SymbolKindClass, line: 42, deprecated: true}, // message LegacyDocument (deprecated)
{name: "symbols.v1.LegacyDocument.id", kind: protocol.SymbolKindField, line: 44}, // string id
{name: "symbols.v1.ExplicitlyNotDeprecated", kind: protocol.SymbolKindClass, line: 47}, // message ExplicitlyNotDeprecated (option deprecated = false)
{name: "symbols.v1.ExplicitlyNotDeprecated.id", kind: protocol.SymbolKindField, line: 49}, // string id
},
},
}
Expand Down Expand Up @@ -100,6 +102,15 @@ func TestDocumentSymbol(t *testing.T) {
assert.Equal(t, testURI, found.Location.URI, "symbol %s has wrong URI", expectedSymbol.name)
assert.Equal(t, expectedSymbol.line, found.Location.Range.Start.Line, "symbol %s has wrong line number", expectedSymbol.name)
assert.Equal(t, expectedSymbol.deprecated, found.Deprecated, "symbol %s has wrong deprecated status", expectedSymbol.name)
// Tags must only carry SymbolTagDeprecated for symbols that are
// actually deprecated. Clients prefer Tags over the legacy
// Deprecated field, so an unconditional tag would render every
// symbol with a strikethrough.
var expectedTags []protocol.SymbolTag
if expectedSymbol.deprecated {
expectedTags = []protocol.SymbolTag{protocol.SymbolTagDeprecated}
}
assert.Equal(t, expectedTags, found.Tags, "symbol %s has wrong tags", expectedSymbol.name)
}
})
}
Expand Down
11 changes: 5 additions & 6 deletions private/buf/buflsp/symbol.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,19 +377,18 @@ func (s *symbol) GetSymbolInformation() protocol.SymbolInformation {
default:
kind = protocol.SymbolKindVariable
}
var isDeprecated bool
if _, ok := s.ir.Deprecated().AsBool(); ok {
isDeprecated = true
isDeprecated, _ := s.ir.Deprecated().AsBool()
var tags []protocol.SymbolTag
if isDeprecated {
tags = []protocol.SymbolTag{protocol.SymbolTagDeprecated}
}
return protocol.SymbolInformation{
Name: string(name),
Kind: kind,
Location: location,
ContainerName: containerName,
Deprecated: isDeprecated,
Tags: []protocol.SymbolTag{
protocol.SymbolTagDeprecated,
},
Tags: tags,
}
}

Expand Down
5 changes: 5 additions & 0 deletions private/buf/buflsp/testdata/symbols/symbols.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ message LegacyDocument {
option deprecated = true;
string id = 1;
}

message ExplicitlyNotDeprecated {
option deprecated = false;
string id = 1;
}