Fix LSP documentSymbol marking every symbol as deprecated#4531
Fix LSP documentSymbol marking every symbol as deprecated#4531garrettr wants to merge 2 commits intobufbuild:mainfrom
Conversation
DocumentSymbol responses unconditionally set Tags to [SymbolTagDeprecated], so every symbol in every .proto file rendered with a strikethrough in editors that honor symbol tags (VS Code's Outline panel, breadcrumbs, sticky scroll, and Go to Symbol). Per the LSP spec, clients prefer Tags over the legacy Deprecated boolean, so the unconditional tag won even when Deprecated was false. Only include SymbolTagDeprecated in Tags when the symbol is actually deprecated. Also fix the deprecation check itself: it previously discarded the value returned by AsBool() and only checked the ok return, treating an explicit `option deprecated = false;` as deprecated. Use the boolean value directly instead. Fixes bufbuild#4530
|
|
|
This fix looks good, thank you for catching and submitting this! (EDIT: a PR has been opened to upgrade the Go version #4532) |
Extend TestDocumentSymbol to assert on the Tags field of every returned symbol, not just the legacy Deprecated boolean. Tags must only carry SymbolTagDeprecated for symbols that are actually deprecated; the existing test passed against the buggy unconditional-tag code because it never inspected Tags. Also add an ExplicitlyNotDeprecated message with `option deprecated = false;` to the test fixture so both the unset and explicitly-false cases are pinned down.
|
Thanks for the review! Added a regression test in The existing test already had a deprecated Verified the new assertions fail against the pre-fix |
|
I'm still waiting for my employer to approve the CLA. I will sign it (or close the PR without signing) when I hear back from them. |
What
textDocument/documentSymbolresponses unconditionally setTagsto[SymbolTagDeprecated]for every symbol. Per the LSP spec, clients prefertagsover the legacydeprecatedboolean, so the unconditional tag won and every symbol in every.protofile rendered with a strikethrough in editors that honor symbol tags — in VS Code that's the Outline panel, breadcrumbs, sticky scroll, and Go to Symbol (Cmd+Shift+O).This change only includes
SymbolTagDeprecatedinTagswhen the symbol is actually deprecated.It also fixes the deprecation check itself: it previously discarded the value returned by
AsBool()and only checked theokreturn, so an explicitoption deprecated = false;would also be reported as deprecated. Use the returned boolean value directly.Why
Introduced in #4311, first released in v1.65.0. Reproduction and full details in #4530.
Fixes #4530