lsp

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Overview

Package lsp implements LSP for gopls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LastNonWsToken added in v0.7.0

func LastNonWsToken(n ast.Node, pos loc.Pos) []ast.Node

func NewAllDefinitionSymbolsFromCurrentModule added in v0.8.0

func NewAllDefinitionSymbolsFromCurrentModule(syntax *ntt.ParseInfo) []interface{}

func NewCommand added in v0.7.0

func NewCommand(pos loc.Position, title string, command string, args ...interface{}) (protocol.CodeLens, error)

NewCommand returns a CodeLens command.

func NewCompListItems added in v0.7.0

func NewCompListItems(suite *ntt.Suite, pos loc.Pos, nodes []ast.Node, ownModName string) []protocol.CompletionItem

Types

type Server

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

Server implements the protocol.Server interface.

func NewServer

func NewServer(stream jsonrpc2.Stream) *Server

func (*Server) CodeAction

func (*Server) CodeLens

func (s *Server) CodeLens(ctx context.Context, params *protocol.CodeLensParams) ([]protocol.CodeLens, error)

func (*Server) Completion

func (s *Server) Completion(ctx context.Context, params *protocol.CompletionParams) (*protocol.CompletionList, error)

func (*Server) Config added in v0.7.0

func (s *Server) Config(section string) interface{}

func (*Server) Definition

func (s *Server) Definition(ctx context.Context, params *protocol.DefinitionParams) (protocol.Definition, error)

func (*Server) Diagnose

func (s *Server) Diagnose(uris ...protocol.DocumentURI)

Diagnose runs various checks over a ttcn3 test suite.

From LSP spec:

Diagnostics are "owned" by the server so it is the server's
responsibility to clear them if necessary.

If a language has a project system (for example C#) diagnostics are not
cleared when a file closes.  When a project is opened all diagnostics
for all files are recomputed (or read from a cache).

When a file changes it is the server’s responsibility to re-compute
diagnostics and push them to the client. If the computed set is empty it
has to push the empty array to clear former diagnostics. Newly pushed
diagnostics always replace previously pushed diagnostics. There is no
merging that happens on the client side.

func (*Server) DidChange

func (s *Server) DidChange(ctx context.Context, params *protocol.DidChangeTextDocumentParams) error

func (*Server) DidChangeConfiguration

func (s *Server) DidChangeConfiguration(context.Context, *protocol.DidChangeConfigurationParams) error

func (*Server) DidChangeWatchedFiles

func (s *Server) DidChangeWatchedFiles(context.Context, *protocol.DidChangeWatchedFilesParams) error

func (*Server) DidChangeWorkspaceFolders

func (s *Server) DidChangeWorkspaceFolders(context.Context, *protocol.DidChangeWorkspaceFoldersParams) error

func (*Server) DidClose

func (s *Server) DidClose(ctx context.Context, params *protocol.DidCloseTextDocumentParams) error

func (*Server) DidOpen

func (s *Server) DidOpen(ctx context.Context, params *protocol.DidOpenTextDocumentParams) error

func (*Server) DidSave

func (s *Server) DidSave(ctx context.Context, params *protocol.DidSaveTextDocumentParams) error
func (s *Server) DocumentLink(ctx context.Context, params *protocol.DocumentLinkParams) ([]protocol.DocumentLink, error)

func (*Server) DocumentSymbol

func (s *Server) DocumentSymbol(ctx context.Context, params *protocol.DocumentSymbolParams) ([]interface{}, error)

func (*Server) ExecuteCommand

func (s *Server) ExecuteCommand(ctx context.Context, params *protocol.ExecuteCommandParams) (interface{}, error)

func (*Server) Exit

func (s *Server) Exit(ctx context.Context) error

func (*Server) Fatal

func (s *Server) Fatal(ctx context.Context, msg string)

func (*Server) FoldingRange

func (*Server) Hover

func (*Server) Info

func (s *Server) Info(ctx context.Context, msg string)

func (*Server) Initialize

func (s *Server) Initialize(ctx context.Context, params *protocol.ParamInitialize) (*protocol.InitializeResult, error)

func (*Server) Initialized

func (s *Server) Initialized(ctx context.Context, params *protocol.InitializedParams) error

func (*Server) Log

func (s *Server) Log(ctx context.Context, msg string)

func (*Server) LogTrace

func (*Server) NonstandardRequest

func (s *Server) NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error)

func (*Server) Output

func (s *Server) Output(level log.Level, msg string) error

func (*Server) PrepareRename

func (*Server) References

func (s *Server) References(ctx context.Context, params *protocol.ReferenceParams) ([]protocol.Location, error)

func (*Server) Rename

func (*Server) ResolveCodeLens

func (s *Server) ResolveCodeLens(context.Context, *protocol.CodeLens) (*protocol.CodeLens, error)
func (s *Server) ResolveDocumentLink(context.Context, *protocol.DocumentLink) (*protocol.DocumentLink, error)

func (*Server) SemanticTokensFullDelta

func (s *Server) SemanticTokensFullDelta(context.Context, *protocol.SemanticTokensDeltaParams) (interface{}, error)

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

func (*Server) SetTrace

func (s *Server) SetTrace(ctx context.Context, params *protocol.SetTraceParams) error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) WillSave

func (*Server) WorkDoneProgressCancel

func (s *Server) WorkDoneProgressCancel(context.Context, *protocol.WorkDoneProgressCancelParams) error

type Status

type Status struct {
	Executable string
	Version    string
	PID        int
	Suites     []*ntt.Suite
}

func NewStatus

func NewStatus(suites []*ntt.Suite) *Status

type Suites added in v0.7.0

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

Suites implements the mapping between ttcn3 source files and multiple test suites.

The language server must be able to correctly handle multiple test suites in parallel. For example, if a user edits a file, which is imports from two independent test suites the language server must not throw a redeclaration-error.

How do we solve this problem? Virtually all lsp features initiated from a open file. For every didOpen-event we check if the opened file is owned by at least one test suite. If there's not, we load a new suite by using the file's directory and various other inputs as heuristic.

func (*Suites) AddSuite added in v0.9.1

func (s *Suites) AddSuite(root string)

AddSuite add a TTCN-3 test suite to the list of known suites. the list of know suites.

func (*Suites) FirstSuite added in v0.9.2

func (s *Suites) FirstSuite(uri string) (*ntt.Suite, error)

FirstSuite returns the first test suite owning the file or an error if not owning suite was found.

func (*Suites) Owners added in v0.7.0

func (s *Suites) Owners(uri protocol.DocumentURI) []*ntt.Suite

Owners returns all Suites that require the opened file.

Directories

Path Synopsis
Invoke with //go:generate helper/helper -t Server -d protocol/tsserver.go -u lsp -o server_gen.go invoke in internal/lsp
Invoke with //go:generate helper/helper -t Server -d protocol/tsserver.go -u lsp -o server_gen.go invoke in internal/lsp
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
servertest
Package servertest provides utilities for running tests against a remote LSP server.
Package servertest provides utilities for running tests against a remote LSP server.
Package protocol contains the structs that map directly to the wire format of the "Language Server Protocol".
Package protocol contains the structs that map directly to the wire format of the "Language Server Protocol".

Jump to

Keyboard shortcuts

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