sourcegraph/internal/opencodegraph/protocol.go
Quinn Slack c9439d9456
OpenCodeGraph prototype (#58675)
This adds support for the OpenCodeGraph prototype. Feature-flagged off by default behind the `opencodegraph` feature flag. See https://www.loom.com/share/5549d92a7c244863ac86ce56692ca030 for more information.

Also, for our CodeMirror, remove `background:transparent` so that line bg applies to block widgets
2023-12-06 21:39:33 -08:00

28 lines
567 B
Go

package opencodegraph
import (
"encoding/json"
"github.com/sourcegraph/sourcegraph/schema"
)
func DecodeRequestMessage(d *json.Decoder) (method string, cap *schema.CapabilitiesParams, ann *schema.AnnotationsParams, err error) {
var req struct {
schema.RequestMessage
Params json.RawMessage `json:"params"`
}
if err := d.Decode(&req); err != nil {
return "", nil, nil, err
}
method = req.Method
switch method {
case "capabilities":
err = json.Unmarshal(req.Params, &cap)
case "annotations":
err = json.Unmarshal(req.Params, &ann)
}
return
}