common

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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