1
0
Fork 0
mirror of https://github.com/laravel-ls/protocol.git synced 2026-06-16 20:10:02 +02:00

Compare commits

..

No commits in common. "main" and "v0.1.1" have entirely different histories.
main ... v0.1.1

2 changed files with 1 additions and 43 deletions

View file

@ -6,8 +6,7 @@ import (
) )
const ( const (
MethodTextDocumentDiagnostic = "textDocument/diagnostic" MethodTextDocumentDiagnostic = "textDocument/diagnostic"
MethodTextDocumentPublishDiagnostics = "textDocument/publishDiagnostics"
) )
// DocumentDiagnosticParams - Parameters of the document diagnostic request. // DocumentDiagnosticParams - Parameters of the document diagnostic request.
@ -30,24 +29,6 @@ type DocumentDiagnosticParams struct {
PreviousResultID string `json:"previousResultId,omitempty"` PreviousResultID string `json:"previousResultId,omitempty"`
} }
// PublishDiagnosticsParams - The parameters of a publish diagnostics notification.
//
// @since 3.0.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#publishDiagnosticsParams
type PublishDiagnosticsParams struct {
// The URI for which diagnostic information is reported.
URI DocumentURI `json:"uri"`
// Optional the version number of the document the diagnostics are published for.
//
// @since 3.15.0
Version int `json:"version,omitempty"`
// An array of diagnostic information items.
Diagnostics []Diagnostic `json:"diagnostics"`
}
// DocumentDiagnosticReport is either a full or an unchanged diagnostic report. // DocumentDiagnosticReport is either a full or an unchanged diagnostic report.
// //
// @since 3.17.0 // @since 3.17.0

View file

@ -24,26 +24,3 @@ func Test_DocumentDiagnostic_StructsUnmarshalValidJSON(t *testing.T) {
t.Fatalf("unexpected DocumentDiagnosticReport: %+v", report) t.Fatalf("unexpected DocumentDiagnosticReport: %+v", report)
} }
} }
func Test_PublishDiagnosticsParams_UnmarshalValidJSON(t *testing.T) {
var params protocol.PublishDiagnosticsParams
if err := json.Unmarshal([]byte(`{
"uri":"file:///tmp/main.go",
"version":2,
"diagnostics":[{"range":{"start":{"line":1,"character":1},"end":{"line":1,"character":3}},"message":"example diagnostic"}]
}`), &params); err != nil {
t.Fatalf("unmarshal PublishDiagnosticsParams failed: %v", err)
}
if params.URI != "file:///tmp/main.go" {
t.Fatalf("unexpected URI: %q", params.URI)
}
if params.Version != 2 {
t.Fatalf("unexpected Version: %d", params.Version)
}
if len(params.Diagnostics) != 1 || params.Diagnostics[0].Message != "example diagnostic" {
t.Fatalf("unexpected Diagnostics: %+v", params.Diagnostics)
}
}