server

package
v0.0.0-...-713e2d3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocationLink struct {
	// Span of the origin of this link.
	// Used as the underlined span for mouse interaction.
	// Optional - defaults to the word range at the mouse position.
	OriginSelectionRange *lsp.Range `json:"originSelectionRange,omitempty"`

	// The target resource identifier of this link.
	TargetURI lsp.DocumentURI `json:"targetUri"`

	// The full target range including surrounding content like comments
	TargetRange lsp.Range `json:"targetRange"`

	// The precise range that should be selected when following the link
	// Must be contained within TargetRange
	TargetSelectionRange lsp.Range `json:"targetSelectionRange"`
}

LocationLink is an implementation of the LocationLink LSP type https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#locationLink

https://github.com/sourcegraph/go-lsp does not support the LocationLink Type so we have implemented it here for lua-language-server

type LuaLS

type LuaLS struct {
	Path string
	// contains filtered or unexported fields
}

func NewLuaLs

func NewLuaLs(server lspServer, luaLSPath string) (*LuaLS, error)

func (*LuaLS) ForwardRequest

func (l *LuaLS) ForwardRequest(method string, params interface{}) (interface{}, error)

ForwardRequest forwards a request from proxy to the lua-language-server

func (*LuaLS) HandleResponse

func (l *LuaLS) HandleResponse(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2.Request) (interface{}, error)

HandleResponse handles responses from the lua-language-server and forwards them to the proxy

func (*LuaLS) Start

func (l *LuaLS) Start() error

type Options

type Options struct {
	// Custom path to lua-language-server
	LuaLsPath string
	// Custom path to where intermediate LSP shadow files are stored
	ShadowRoot string
}

func (*Options) OverrideDocOpts

func (o *Options) OverrideDocOpts(opts *iLsp.DocumentServiceOptions) error

func (*Options) Validate

func (o *Options) Validate() error

type RWC

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

func NewRWC

func NewRWC(r io.ReadCloser, w io.WriteCloser) *RWC

NewRWC creates a new RWC with custom reader and writer

func NewStdRWC

func NewStdRWC() *RWC

NewStdRWC creates a new RWC using standard input/output

func (*RWC) Close

func (rw *RWC) Close() error

func (*RWC) Read

func (rw *RWC) Read(p []byte) (int, error)

func (*RWC) Write

func (rw *RWC) Write(p []byte) (int, error)

type Server

type Server struct {

	// lua lsp interface
	LuaLS *LuaLS
	// contains filtered or unexported fields
}

func NewServer

func NewServer(opts Options) (*Server, error)

func (*Server) Handle

func (s *Server) Handle(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2.Request) (result interface{}, err error)

func (*Server) SendDiagnostics

func (s *Server) SendDiagnostics(ctx context.Context, params lsp.PublishDiagnosticsParams) error

func (*Server) Start

func (s *Server) Start() error

Jump to

Keyboard shortcuts

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