Skip to content

Commit 5c64bed

Browse files
Add deprecated tag to diagnostics (#660)
This maps nicely to the LSP DiagnosticTag.Deprecated enum value. Ref: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticTag
1 parent 7a5e354 commit 5c64bed

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

experimental/ir/lower_deprecated.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package ir
1616

1717
import (
1818
"github.com/bufbuild/protocompile/experimental/report"
19+
"github.com/bufbuild/protocompile/experimental/report/tags"
1920
"github.com/bufbuild/protocompile/experimental/seq"
2021
"github.com/bufbuild/protocompile/experimental/source"
2122
)
@@ -128,5 +129,6 @@ func (e errDeprecated) Diagnose(d *report.Diagnostic) {
128129
report.Message("`%s` is deprecated", e.name),
129130
report.Snippet(e.ref),
130131
report.Snippetf(e.cause, "deprecated here"),
132+
report.Tag(tags.Deprecated),
131133
)
132134
}

experimental/report/tags/tags.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,7 @@ const (
2525
// in the current scope. This may indicate a missing import or a reference
2626
// to a non-existent symbol.
2727
UnknownSymbol = "protobuf:unknown_symbol"
28+
29+
// Deprecated is the tag for a diagnostic where a symbol is deprecated.
30+
Deprecated = "protobuf:deprecated"
2831
)

0 commit comments

Comments
 (0)