From 3f6de07740e7f4c9b1179d8470c0c73cbbc1b315 Mon Sep 17 00:00:00 2001 From: Peter Weinbergr Date: Mon, 2 Nov 2020 13:52:29 -0500 Subject: [PATCH] internal/lsp: make Diagnostics.CodeDescription a pointer This avoid an embedded URI defaulting to "" (https://github.com/golang/go/issues/42314) Fixes:Fixes golang/go#42314 Change-Id: I614171d4ec80d139f5511b953d30f8385c2c7d5e Reviewed-on: https://go-review.googlesource.com/c/tools/+/267106 Run-TryBot: Peter Weinberger gopls-CI: kokoro Trust: Peter Weinberger TryBot-Result: Go Bot Reviewed-by: Rebecca Stambler --- internal/lsp/protocol/tsprotocol.go | 2 +- internal/lsp/protocol/typescript/code.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/lsp/protocol/tsprotocol.go b/internal/lsp/protocol/tsprotocol.go index 06ee908367..09c1934175 100644 --- a/internal/lsp/protocol/tsprotocol.go +++ b/internal/lsp/protocol/tsprotocol.go @@ -1137,7 +1137,7 @@ type Diagnostic struct { * * @since 3.16.0 - proposed state */ - CodeDescription CodeDescription `json:"codeDescription,omitempty"` + CodeDescription *CodeDescription `json:"codeDescription,omitempty"` /** * A human-readable string describing the source of this * diagnostic, e.g. 'typescript' or 'super lint'. It usually diff --git a/internal/lsp/protocol/typescript/code.ts b/internal/lsp/protocol/typescript/code.ts index 54c06786ef..5eb081a20c 100644 --- a/internal/lsp/protocol/typescript/code.ts +++ b/internal/lsp/protocol/typescript/code.ts @@ -509,7 +509,8 @@ function toGo(d: Data, nm: string) { // these fields need a * var starred: [string, string][] = [ ['TextDocumentContentChangeEvent', 'range'], ['CodeAction', 'command'], - ['DidSaveTextDocumentParams', 'text'], ['CompletionItem', 'command'] + ['DidSaveTextDocumentParams', 'text'], ['CompletionItem', 'command'], + ['Diagnostic', 'codeDescription'] ]; // generate Go code for an interface