common

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

README

ls-builder - Common Types

package main

import (
    "github.com/newstack-cloud/ls-builder/common"
)

This package provides common types used by protocol packages for LSP request contexts, sending requests and notifications along with a common interface for a LSP message handler.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallFunc

type CallFunc func(method string, params any, result any) error

CallFunc is a signature for a function that sends JSON-RPC requests. The result parameter should be a pointer to the value that the result should be unmarshaled into. This should only be used directly in the case where lsp.Dispatcher doesn't implement the method you need to call.

type Handler

type Handler interface {
	Handle(ctx *LSPContext) (r any, validMethod bool, validParams bool, err error)
}

Handler provides an interface for handling LSP requests.

type HandlerFunc

type HandlerFunc func(ctx *LSPContext) (r any, validMethod bool, validParams bool, err error)

HandlerFunc provides a convenient way to define a handler with a plain function.

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(ctx *LSPContext) (r any, validMethod bool, validParams bool, err error)

type LSPContext

type LSPContext struct {
	Method  string
	Params  json.RawMessage
	Notify  NotifyFunc
	Call    CallFunc
	Context context.Context
}

LSPContext contains the context for an LSP request from a client.

type NotifyFunc

type NotifyFunc func(method string, params any) error

NotifyFunc is a signature for a function that sends JSON-RPC notifications. This should only be used directly in the case where lsp.Dispatcher doesn't implement the method you need to call.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL