mirror of https://github.com/golang/go.git
gopls: add scheme to CodeDescription.href
### gopls - Add `https` scheme to `CodeDescription.href` According to the [LSP specification](https://microsoft.github.io/language-server-protocol/specification#diagnostic), `CodeDescription.href` must be [URI type](https://microsoft.github.io/language-server-protocol/specification#uri). As described in the [RFC](https://tools.ietf.org/html/rfc3986#section-3), the scheme is required for URI: > The scheme and path components are required, though the path may be empty (no characters). Current `gopls` does not add the scheme to `CodeDescription.href`, and this results in some LSP clients ([at least this client](https://github.com/autozimu/LanguageClient-neovim)) which are strictly validating the URI format to be failed to populate diagnostics. Change-Id: I73f01c2e97ed1adb62fbed451a7c9b0c9794b66a GitHub-Last-Rev: 6985bfe60e182ee788082d8fcb9515275d9612fa GitHub-Pull-Request: golang/tools#277 Reviewed-on: https://go-review.googlesource.com/c/tools/+/294569 Reviewed-by: Rebecca Stambler <rstambler@golang.org> Trust: Rebecca Stambler <rstambler@golang.org> Trust: Robert Findley <rfindley@google.com> Run-TryBot: Rebecca Stambler <rstambler@golang.org> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
2363391a5b
commit
0e232fa9c3
|
|
@ -14,6 +14,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
errors "golang.org/x/xerrors"
|
||||
|
||||
"golang.org/x/tools/go/analysis"
|
||||
"golang.org/x/tools/go/packages"
|
||||
"golang.org/x/tools/internal/analysisinternal"
|
||||
|
|
@ -23,7 +25,6 @@ import (
|
|||
"golang.org/x/tools/internal/lsp/source"
|
||||
"golang.org/x/tools/internal/span"
|
||||
"golang.org/x/tools/internal/typesinternal"
|
||||
errors "golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
func sourceDiagnostics(ctx context.Context, snapshot *snapshot, pkg *pkg, severity protocol.DiagnosticSeverity, e interface{}) ([]*source.Diagnostic, error) {
|
||||
|
|
@ -167,7 +168,7 @@ func sourceDiagnostics(ctx context.Context, snapshot *snapshot, pkg *pkg, severi
|
|||
|
||||
func typesCodeHref(snapshot *snapshot, code typesinternal.ErrorCode) string {
|
||||
target := snapshot.View().Options().LinkTarget
|
||||
return fmt.Sprintf("%s/golang.org/x/tools/internal/typesinternal#%s", target, code.String())
|
||||
return fmt.Sprintf("https://%s/golang.org/x/tools/internal/typesinternal#%s", target, code.String())
|
||||
}
|
||||
|
||||
func suggestedAnalysisFixes(snapshot *snapshot, pkg *pkg, diag *analysis.Diagnostic) ([]source.SuggestedFix, error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue