langserver

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: Apache-2.0, BSD-3-Clause Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTCPServer added in v0.5.0

func RunTCPServer(ctx context.Context, addr string, config *Config) error

RunTCPServer generates a server listening on the provided TCP Address, creating a new language Server instance using plain HTTP for every connection.

Types

type Config

type Config struct {
	RPCTrace      string    `yaml:"rpc_trace"`
	LogFormat     LogFormat `yaml:"log_format"`
	PrometheusURL string    `yaml:"prometheus_url"`
	RESTAPIPort   uint64    `yaml:"rest_api_port"`
}

Config contains the configuration for a server.

func ReadConfig added in v0.5.0

func ReadConfig(configFile string) (*Config, error)

ReadConfig gets the GlobalConfig from a configFile (that is a path to the file).

func (*Config) UnmarshalYAML added in v0.5.0

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML overrides a function used internally by the yaml.v3 lib.

func (*Config) Validate added in v0.5.0

func (c *Config) Validate() error

Validate returns an error if the config is not valid.

type HeadlessServer added in v0.5.0

type HeadlessServer interface {
	protocol.Server
	GetDiagnostics(uri protocol.DocumentURI) (*protocol.PublishDiagnosticsParams, error)
}

HeadlessServer is a modified Server interface that is used by the REST API.

func CreateHeadlessServer added in v0.5.0

func CreateHeadlessServer(ctx context.Context, prometheusClient promClient.Client, logger log.Logger) (HeadlessServer, error)

CreateHeadlessServer creates a locked down server instance for the REST API.

"locked down" in this case means, that the instance cannot send or receive any JSONRPC communication. Logging messages that the instance tries to send over JSONRPC are redirected to stderr.

type LogFormat added in v0.5.0

type LogFormat string

LogFormat is the type used for describing the format of logs.

const (
	// JSONFormat is used for JSON logs.
	JSONFormat LogFormat = "json"
	// TextFormat is used of structured text logs.
	TextFormat LogFormat = "text"
)

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server wraps language server instance that can connect to exactly one client.

func ServerFromStream

func ServerFromStream(ctx context.Context, stream jsonrpc2.Stream, config *Config) (context.Context, Server)

ServerFromStream generates a Server from a jsonrpc2.Stream.

func StdioServer

func StdioServer(ctx context.Context, config *Config) (context.Context, Server)

StdioServer generates a Server instance talking to stdio.

func (Server) Run

func (s Server) Run() error

Run starts the language server instance.

Directories

Path Synopsis
Package cache is the component of the PromQL language server that is responsible for the caching the content and parse results of documents opened in the language client.
Package cache is the component of the PromQL language server that is responsible for the caching the content and parse results of documents opened in the language client.
documentation

Jump to

Keyboard shortcuts

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