Documentation
¶
Index ¶
- type AddressImportResolver
- type CodeLensProvider
- type Command
- type CommandHandler
- type CompletionItemData
- type DiagnosticProvider
- type Document
- type InitializationOptionsHandler
- type ObjectStream
- type Option
- func WithAddressImportResolver(resolver AddressImportResolver) Option
- func WithCodeLensProvider(provider CodeLensProvider) Option
- func WithCommand(command Command) Option
- func WithDiagnosticProvider(provider DiagnosticProvider) Option
- func WithInitializationOptionsHandler(handler InitializationOptionsHandler) Option
- func WithStringImportResolver(resolver StringImportResolver) Option
- type Server
- func (s *Server) CodeLens(_ protocol.Conn, params *protocol.CodeLensParams) (codeLenses []*protocol.CodeLens, err error)
- func (s *Server) Completion(conn protocol.Conn, params *protocol.CompletionParams) (items []*protocol.CompletionItem, err error)
- func (s *Server) Definition(_ protocol.Conn, params *protocol.TextDocumentPositionParams) (*protocol.Location, error)
- func (s *Server) DidChangeTextDocument(conn protocol.Conn, params *protocol.DidChangeTextDocumentParams) error
- func (s *Server) DidOpenTextDocument(conn protocol.Conn, params *protocol.DidOpenTextDocumentParams) error
- func (s *Server) ExecuteCommand(conn protocol.Conn, params *protocol.ExecuteCommandParams) (interface{}, error)
- func (*Server) Exit(_ protocol.Conn) error
- func (s *Server) GetDocument(uri protocol.DocumentUri) (doc Document, ok bool)
- func (s *Server) Hover(_ protocol.Conn, params *protocol.TextDocumentPositionParams) (*protocol.Hover, error)
- func (s *Server) Initialize(conn protocol.Conn, params *protocol.InitializeParams) (*protocol.InitializeResult, error)
- func (s *Server) ResolveCompletionItem(_ protocol.Conn, item *protocol.CompletionItem) (result *protocol.CompletionItem, err error)
- func (s *Server) SetOptions(options ...Option) error
- func (*Server) Shutdown(conn protocol.Conn) error
- func (s *Server) SignatureHelp(_ protocol.Conn, _ *protocol.TextDocumentPositionParams) (*protocol.SignatureHelp, error)
- func (s *Server) Start(stream jsonrpc2.ObjectStream) <-chan struct{}
- func (s *Server) Stop() error
- type StdinStdoutReadWriterCloser
- type StringImportResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressImportResolver ¶ added in v0.7.0
type AddressImportResolver func(location ast.AddressLocation) (string, error)
AddressImportResolver is a function that is used to resolve address imports
type CodeLensProvider ¶ added in v0.7.0
type CodeLensProvider func(uri protocol.DocumentUri, checker *sema.Checker) ([]*protocol.CodeLens, error)
CodeLensProvider is a function that is used to provide code lenses for the given checker
type Command ¶ added in v0.7.0
type Command struct { Name string Handler CommandHandler }
type CommandHandler ¶
CommandHandler represents the form of functions that handle commands submitted from the client using workspace/executeCommand.
type CompletionItemData ¶ added in v0.7.0
type CompletionItemData struct {
URI protocol.DocumentUri `json:"uri"`
}
type DiagnosticProvider ¶ added in v0.7.0
type DiagnosticProvider func(uri protocol.DocumentUri, checker *sema.Checker) ([]protocol.Diagnostic, error)
DiagnosticProvider is a function that is used to provide diagnostics for the given checker
type Document ¶ added in v0.7.0
type Document struct {
Text string
}
Document represents an open document on the client. It contains all cached information about each document that is used to support CodeLens, transaction submission, and script execution.
func (Document) HasAnyPrecedingStringsAtPosition ¶ added in v0.8.0
type InitializationOptionsHandler ¶ added in v0.7.0
type InitializationOptionsHandler func(initializationOptions interface{}) error
InitializationOptionsHandler is a function that is used to handle initialization options sent by the client
type ObjectStream ¶ added in v0.7.0
type ObjectStream struct {
// contains filtered or unexported fields
}
func NewObjectStream ¶ added in v0.7.0
func NewObjectStream( writeObject func(obj interface{}) error, readObject func(v interface{}) error, close func() error, ) ObjectStream
func (ObjectStream) Close ¶ added in v0.7.0
func (o ObjectStream) Close() error
func (ObjectStream) ReadObject ¶ added in v0.7.0
func (o ObjectStream) ReadObject(v interface{}) (err error)
func (ObjectStream) WriteObject ¶ added in v0.7.0
func (o ObjectStream) WriteObject(obj interface{}) error
type Option ¶ added in v0.7.0
func WithAddressImportResolver ¶ added in v0.7.0
func WithAddressImportResolver(resolver AddressImportResolver) Option
WithAddressImportResolver returns a server option that sets the given function as the function that is used to resolve address imports
func WithCodeLensProvider ¶ added in v0.7.0
func WithCodeLensProvider(provider CodeLensProvider) Option
WithCodeLensProvider returns a server option that adds the given function as a function that is used to generate code lenses
func WithCommand ¶ added in v0.7.0
WithCommand returns a server options that adds the given command to the set of commands provided by the server to the client.
If a command with the given name already exists, the option fails.
func WithDiagnosticProvider ¶ added in v0.7.0
func WithDiagnosticProvider(provider DiagnosticProvider) Option
WithDiagnosticProvider returns a server option that adds the given function as a function that is used to generate diagnostics
func WithInitializationOptionsHandler ¶ added in v0.7.0
func WithInitializationOptionsHandler(handler InitializationOptionsHandler) Option
WithInitializationOptionsHandler returns a server option that adds the given function as a function that is used to handle initialization options sent by the client
func WithStringImportResolver ¶ added in v0.7.0
func WithStringImportResolver(resolver StringImportResolver) Option
WithStringImportResolver returns a server option that sets the given function as the function that is used to resolve string imports
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) CodeLens ¶
func (s *Server) CodeLens( _ protocol.Conn, params *protocol.CodeLensParams, ) ( codeLenses []*protocol.CodeLens, err error, )
CodeLens is called every time the document contents change and returns a list of actions to be injected into the source as inline buttons.
func (*Server) Completion ¶ added in v0.7.0
func (s *Server) Completion( conn protocol.Conn, params *protocol.CompletionParams, ) ( items []*protocol.CompletionItem, err error, )
Completion is called to compute completion items at a given cursor position.
func (*Server) Definition ¶
func (s *Server) Definition( _ protocol.Conn, params *protocol.TextDocumentPositionParams, ) (*protocol.Location, error)
Definition finds the definition of the type at the given location.
func (*Server) DidChangeTextDocument ¶
func (s *Server) DidChangeTextDocument( conn protocol.Conn, params *protocol.DidChangeTextDocumentParams, ) error
DidChangeTextDocument is called whenever the current document changes. We parse and check the text and publish diagnostics about the document.
func (*Server) DidOpenTextDocument ¶
func (s *Server) DidOpenTextDocument(conn protocol.Conn, params *protocol.DidOpenTextDocumentParams) error
DidOpenTextDocument is called whenever a new file is opened. We parse and check the text and publish diagnostics about the document.
func (*Server) ExecuteCommand ¶
func (s *Server) ExecuteCommand(conn protocol.Conn, params *protocol.ExecuteCommandParams) (interface{}, error)
ExecuteCommand is called to execute a custom, server-defined command.
We register all the commands we support in registerCommands and populate their corresponding handler at server initialization.
func (*Server) GetDocument ¶ added in v0.7.0
func (s *Server) GetDocument(uri protocol.DocumentUri) (doc Document, ok bool)
func (*Server) Hover ¶
func (s *Server) Hover( _ protocol.Conn, params *protocol.TextDocumentPositionParams, ) (*protocol.Hover, error)
Hover returns contextual type information about the variable at the given location.
func (*Server) Initialize ¶
func (s *Server) Initialize( conn protocol.Conn, params *protocol.InitializeParams, ) ( *protocol.InitializeResult, error, )
func (*Server) ResolveCompletionItem ¶ added in v0.7.0
func (s *Server) ResolveCompletionItem( _ protocol.Conn, item *protocol.CompletionItem, ) ( result *protocol.CompletionItem, err error, )
Completion is called to compute completion items at a given cursor position.
func (*Server) SetOptions ¶ added in v0.7.0
func (*Server) Shutdown ¶
Shutdown tells the server to stop accepting any new requests. This can only be followed by a call to Exit, which exits the process.
func (*Server) SignatureHelp ¶
func (s *Server) SignatureHelp( _ protocol.Conn, _ *protocol.TextDocumentPositionParams, ) (*protocol.SignatureHelp, error)
TODO
func (*Server) Start ¶
func (s *Server) Start(stream jsonrpc2.ObjectStream) <-chan struct{}
type StdinStdoutReadWriterCloser ¶ added in v0.7.0
type StdinStdoutReadWriterCloser struct{}
StdinStdoutReadWriterCloser implements an io.ReadWriter and io.Closer around STDIN and STDOUT.
func (StdinStdoutReadWriterCloser) Close ¶ added in v0.7.0
func (StdinStdoutReadWriterCloser) Close() error
Close closes STDIN and STDOUT.
type StringImportResolver ¶ added in v0.7.0
type StringImportResolver func(mainPath string, location ast.StringLocation) (string, error)
StringImportResolver is a function that is used to resolve string imports