dendrite.daemon/core/handlers/completion/complete_link_handler.go
2026-04-12 23:25:36 +02:00

36 lines
778 B
Go

package completion
import (
"context"
"encoding/json"
"log/slog"
)
type completeLinkCommand struct {
Query string `json:"query"`
}
type completionItem struct {
Slug string `json:"slug"`
}
type CompleteLinkHandler struct{}
func NewCompleteLinkHandler() *CompleteLinkHandler {
return &CompleteLinkHandler{}
}
func (h *CompleteLinkHandler) Handle(ctx context.Context, raw json.RawMessage) (any, error) {
var cmd completeLinkCommand
if err := json.Unmarshal(raw, &cmd); err != nil {
return nil, err
}
slog.Debug("handling complete link command", "query", cmd.Query)
// this is just a stub and the client is expecting the title/display too
return []completionItem{
{Slug: "standard-streams"},
{Slug: "unit-of-work"},
{Slug: "treesitter-basics"},
}, nil
}