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
9 changes: 8 additions & 1 deletion internal/ls/lsconv/converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,16 @@ func diagnosticToLSP(ctx context.Context, converters *Converters, diagnostic *as

var tags []lsproto.DiagnosticTag
if len(opts.tagValueSet) > 0 && (diagnostic.ReportsUnnecessary() || diagnostic.ReportsDeprecated()) {
tags = make([]lsproto.DiagnosticTag, 0, 2)
tags = make([]lsproto.DiagnosticTag, 0, 3)
if diagnostic.ReportsUnnecessary() && slices.Contains(opts.tagValueSet, lsproto.DiagnosticTagUnnecessary) {
tags = append(tags, lsproto.DiagnosticTagUnnecessary)
// Visual Studio's LSP client only renders Unnecessary diagnostics as
// faded-out text when they also carry the VS-internal HiddenInEditor
// tag; otherwise they appear as a regular squiggle. Emit it so VS
// matches the LSP-spec intent of the Unnecessary tag.
if opts.visualStudio {
tags = append(tags, lsproto.DiagnosticTagVsHiddenInEditor)
}
Comment on lines +303 to +312
}
if diagnostic.ReportsDeprecated() && slices.Contains(opts.tagValueSet, lsproto.DiagnosticTagDeprecated) {
tags = append(tags, lsproto.DiagnosticTagDeprecated)
Expand Down
16 changes: 16 additions & 0 deletions internal/lsp/lsproto/_generate/generate.mts
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,22 @@ function patchAndPreprocessModel() {
(reg as any).isRegistrationOnly = !allRequestMethods.has(reg.registrationMethod);
}

// Add Visual Studio-specific DiagnosticTag values.
// These are VS-internal extensions not part of the LSP spec. They use sentinel
// values near int32.MaxValue to avoid collisions with future standard additions.
// Servers should only emit them when the client advertises
// _vs_supportsVisualStudioExtensions.
const diagnosticTagEnum = model.enumerations.find(e => e.name === "DiagnosticTag");
if (diagnosticTagEnum) {
diagnosticTagEnum.values.push(
{
name: "VSHiddenInEditor",
value: 2147483641, // int32.MaxValue - 6
documentation: "Visual Studio-specific tag: the diagnostic is not rendered with a squiggle in the editor. When combined with Unnecessary, Visual Studio renders the code as faded-out text rather than a squiggle.",
},
);
}

// Merge LSPErrorCodes into ErrorCodes and remove LSPErrorCodes
const errorCodesEnum = model.enumerations.find(e => e.name === "ErrorCodes");
const lspErrorCodesEnum = model.enumerations.find(e => e.name === "LSPErrorCodes");
Expand Down
19 changes: 14 additions & 5 deletions internal/lsp/lsproto/lsp_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading