Documentation ¶
Index ¶
- func JsonGetPath(v interface{}, path string) (interface{}, error)
- func RangeToOffsetLen(rd iorw.Reader, rang *Range) (int, int, error)
- func RegistrationExamples() string
- func RegistrationString(reg *Registration) string
- func Utf16Column(rd iorw.Reader, lineStartOffset, utf8Col int) (int, error)
- func Utf8Column(rd iorw.Reader, lineStartOffset, utf16Col int) (int, error)
- type Client
- func (cli *Client) Call(ctx context.Context, method string, args, reply interface{}) error
- func (cli *Client) ExitNotification() error
- func (cli *Client) Initialize(ctx context.Context, filename string) error
- func (cli *Client) ShutdownRequest() error
- func (cli *Client) TextDocumentCompletion(ctx context.Context, filename string, pos Position) (*CompletionList, error)
- func (cli *Client) TextDocumentDefinition(ctx context.Context, filename string, pos Position) (*Location, error)
- func (cli *Client) TextDocumentDidChange(ctx context.Context, filename, text string, version int) error
- func (cli *Client) TextDocumentDidClose(ctx context.Context, filename string) error
- func (cli *Client) TextDocumentDidOpen(ctx context.Context, filename, text string, version int) error
- func (cli *Client) TextDocumentDidOpenVersion(ctx context.Context, filename string, b []byte) error
- func (cli *Client) TextDocumentDidSave(ctx context.Context, filename string, text []byte) error
- func (cli *Client) UpdateWorkspaceFolder(ctx context.Context, dir string) error
- func (cli *Client) WorkspaceDidChangeWorkspaceFolders(ctx context.Context, added, removed []*WorkspaceFolder) error
- type ClientCapabilities
- type CompletionContext
- type CompletionItem
- type CompletionList
- type CompletionParams
- type DidChangeTextDocumentParams
- type DidChangeWorkspaceFoldersParams
- type DidCloseTextDocumentParams
- type DidOpenTextDocumentParams
- type DidSaveTextDocumentParams
- type InitializeParams
- type InitializedParams
- type JsonCodec
- type LangInstance
- type LangManager
- type Location
- type Manager
- func (man *Manager) Close() error
- func (man *Manager) LangManager(filename string) (*LangManager, error)
- func (man *Manager) Register(reg *Registration) error
- func (man *Manager) TextDocumentCompletion(ctx context.Context, filename string, rd iorw.Reader, offset int) (*CompletionList, error)
- func (man *Manager) TextDocumentCompletionDetailStrings(ctx context.Context, filename string, rd iorw.Reader, offset int) ([]string, error)
- func (man *Manager) TextDocumentDefinition(ctx context.Context, filename string, rd iorw.Reader, offset int) (string, *Range, error)
- type NotificationMessage
- type Position
- type PublishDiagnostics
- type Range
- type Registration
- type RequestMessage
- type Response
- type ResponseError
- type ResponseMessage
- type ServerWrap
- type TextDocumentClientCapabilities
- type TextDocumentContentChangeEvent
- type TextDocumentIdentifier
- type TextDocumentItem
- type TextDocumentPositionParams
- type VersionedTextDocumentIdentifier
- type WorkspaceClientCapabilities
- type WorkspaceFolder
- type WorkspaceFoldersChangeEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JsonGetPath ¶
func RegistrationExamples ¶
func RegistrationExamples() string
func RegistrationString ¶
func RegistrationString(reg *Registration) string
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientIO ¶
func NewClientIO(rwc io.ReadWriteCloser, li *LangInstance) *Client
func NewClientTCP ¶
func (*Client) ExitNotification ¶
func (*Client) Initialize ¶
Filename is the file that triggered the server to be started.
func (*Client) ShutdownRequest ¶
func (*Client) TextDocumentCompletion ¶
func (*Client) TextDocumentDefinition ¶
func (*Client) TextDocumentDidChange ¶
func (*Client) TextDocumentDidClose ¶
func (*Client) TextDocumentDidOpen ¶
func (*Client) TextDocumentDidOpenVersion ¶
func (*Client) TextDocumentDidSave ¶
func (*Client) UpdateWorkspaceFolder ¶
func (*Client) WorkspaceDidChangeWorkspaceFolders ¶
func (cli *Client) WorkspaceDidChangeWorkspaceFolders(ctx context.Context, added, removed []*WorkspaceFolder) error
type ClientCapabilities ¶
type ClientCapabilities struct { TextDocument *TextDocumentClientCapabilities `json:"textDocument,omitempty"` Workspace *WorkspaceClientCapabilities `json:"workspace,omitempty"` }
type CompletionContext ¶
type CompletionItem ¶
type CompletionList ¶
type CompletionList struct { IsIncomplete bool `json:"isIncomplete"` Items []*CompletionItem `json:"items"` }
type CompletionParams ¶
type CompletionParams struct { TextDocumentPositionParams Context CompletionContext `json:"context"` }
type DidChangeTextDocumentParams ¶
type DidChangeTextDocumentParams struct { TextDocument VersionedTextDocumentIdentifier `json:"textDocument,omitempty"` ContentChanges []*TextDocumentContentChangeEvent `json:"contentChanges,omitempty"` }
type DidChangeWorkspaceFoldersParams ¶
type DidChangeWorkspaceFoldersParams struct {
Event *WorkspaceFoldersChangeEvent `json:"event,omitempty"`
}
type DidCloseTextDocumentParams ¶
type DidCloseTextDocumentParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
type DidOpenTextDocumentParams ¶
type DidOpenTextDocumentParams struct {
TextDocument TextDocumentItem `json:"textDocument"`
}
type DidSaveTextDocumentParams ¶
type DidSaveTextDocumentParams struct { TextDocument TextDocumentIdentifier `json:"textDocument"` Text string `json:"text,omitempty"` }
type InitializeParams ¶
type InitializeParams struct { RootUri *string `json:"rootUri"` Capabilities *ClientCapabilities `json:"capabilities,omitempty"` WorkspaceFolders []*WorkspaceFolder `json:"workspaceFolders,omitempty"` }
type InitializedParams ¶
type InitializedParams struct {
None bool `json:"none"`
}
type JsonCodec ¶
type JsonCodec struct { OnNotificationMessage func(*NotificationMessage) OnIOReadError func(error) OnUnexpectedServerReply func(*Response) // contains filtered or unexported fields }
Implements rpc.ClientCodec
func NewJsonCodec ¶
func NewJsonCodec(rwc io.ReadWriteCloser) *JsonCodec
Needs a call to ReadLoop() to start reading.
func (*JsonCodec) ReadResponseBody ¶
func (*JsonCodec) ReadResponseHeader ¶
Sets response.Seq to have ReadResponseBody be called with the correct reply variable. i
type LangInstance ¶
type LangInstance struct {
// contains filtered or unexported fields
}
func NewLangInstance ¶
func NewLangInstance(lang *LangManager) *LangInstance
type LangManager ¶
type LangManager struct { Reg *Registration // accessed from editor // contains filtered or unexported fields }
func NewLangManager ¶
func NewLangManager(man *Manager, reg *Registration) *LangManager
func (*LangManager) Close ¶
func (lang *LangManager) Close() error
func (*LangManager) ErrorAsync ¶
func (lang *LangManager) ErrorAsync(err error)
func (*LangManager) WrapError ¶
func (lang *LangManager) WrapError(err error) error
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Notes: - Manager manages LangManagers - LangManager has a Registration and handles a LangInstance - Client handles client connection to the lsp server - ServerWrap, if used, runs the lsp server process
func NewManager ¶
func (*Manager) LangManager ¶
func (man *Manager) LangManager(filename string) (*LangManager, error)
func (*Manager) Register ¶
func (man *Manager) Register(reg *Registration) error
func (*Manager) TextDocumentCompletion ¶
func (*Manager) TextDocumentCompletionDetailStrings ¶
type NotificationMessage ¶
type NotificationMessage struct { Method string `json:"method,omitempty"` Params interface{} `json:"params,omitempty"` }
type Position ¶
type PublishDiagnostics ¶
type PublishDiagnostics struct {
RelatedInformation bool `json:"relatedInformation"`
}
type Registration ¶
type Registration struct { Language string Exts []string Cmd string Network string // {stdio, tcp(runs text/template on cmd)} Optional []string // optional extra fields }
func NewRegistration ¶
func NewRegistration(s string) (*Registration, error)
func (*Registration) HasOptional ¶
func (reg *Registration) HasOptional(s string) bool
type RequestMessage ¶
type Response ¶
type Response struct { ResponseMessage NotificationMessage }
type ResponseError ¶
type ResponseError struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` }
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
type ResponseMessage ¶
type ResponseMessage struct { Id int `json:"id,omitempty"` // id can be zero on first msg Error *ResponseError `json:"error,omitempty"` Result json.RawMessage `json:"result,omitempty"` }
type ServerWrap ¶
func NewServerWrapIO ¶
func NewServerWrapIO(ctx context.Context, cmd string, stderr io.Writer, li *LangInstance) (*ServerWrap, io.ReadWriteCloser, error)
func NewServerWrapTCP ¶
func NewServerWrapTCP(ctx context.Context, cmdTmpl string, li *LangInstance) (*ServerWrap, string, error)
type TextDocumentClientCapabilities ¶
type TextDocumentClientCapabilities struct {
PublishDiagnostics *PublishDiagnostics `json:"publishDiagnostics,omitempty"`
}
type TextDocumentIdentifier ¶
type TextDocumentIdentifier struct {
Uri string `json:"uri"`
}
type TextDocumentItem ¶
type TextDocumentPositionParams ¶
type TextDocumentPositionParams struct { TextDocument TextDocumentIdentifier `json:"textDocument"` Position Position `json:"position"` }
type VersionedTextDocumentIdentifier ¶
type VersionedTextDocumentIdentifier struct { TextDocumentIdentifier Version int `json:"version"` }
type WorkspaceClientCapabilities ¶
type WorkspaceClientCapabilities struct {
WorkspaceFolders bool `json:"workspaceFolders"`
}
type WorkspaceFolder ¶
type WorkspaceFoldersChangeEvent ¶
type WorkspaceFoldersChangeEvent struct { Added []*WorkspaceFolder `json:"added"` Removed []*WorkspaceFolder `json:"removed"` }
Click to show internal directories.
Click to hide internal directories.