mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 16:51:55 +00:00
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
28 lines
567 B
Go
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
|
|
}
|