Documentation ¶
Index ¶
- func JsonGetPath(v interface{}, path string) (interface{}, error)
- func PatchFileTextEdits(filename string, edits []*TextEdit) error
- func PatchTextEdits(src []byte, edits []*TextEdit) ([]byte, error)
- func PatchWorkspaceEditChanges(wecs []*WorkspaceEditChange) error
- func RangeToOffsetLen(rd iorw.ReaderAt, rang *Range) (int, int, error)
- func RegistrationExamples() string
- func RegistrationString(reg *Registration) string
- func Utf16Column(rd iorw.ReaderAt, lineStartOffset, utf8Col int) (int, error)
- func Utf8Column(rd iorw.ReaderAt, 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) 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) TextDocumentRename(ctx context.Context, filename string, pos Position, newName string) (*WorkspaceEdit, error)
- func (cli *Client) UpdateWorkspaceFolder(ctx context.Context, dir string) error
- func (cli *Client) Wait() error
- func (cli *Client) WorkspaceDidChangeWorkspaceFolders(ctx context.Context, added, removed []*WorkspaceFolder) error
- type CompletionContext
- type CompletionItem
- type CompletionList
- type CompletionParams
- type DidChangeTextDocumentParams
- type DidChangeWorkspaceFoldersParams
- type DidCloseTextDocumentParams
- type DidOpenTextDocumentParams
- type DidSaveTextDocumentParams
- type DocumentUri
- type JsonCodec
- type LangInstance
- type LangManager
- type Location
- type Manager
- func (man *Manager) Close() error
- func (man *Manager) Error(err error)
- func (man *Manager) LangManager(filename string) (*LangManager, error)
- func (man *Manager) Message(s string)
- func (man *Manager) Register(reg *Registration) error
- func (man *Manager) TextDocumentCompletion(ctx context.Context, filename string, rd iorw.ReaderAt, offset int) (*CompletionList, error)
- func (man *Manager) TextDocumentCompletionDetailStrings(ctx context.Context, filename string, rd iorw.ReaderAt, offset int) ([]string, error)
- func (man *Manager) TextDocumentDefinition(ctx context.Context, filename string, rd iorw.ReaderAt, offset int) (string, *Range, error)
- func (man *Manager) TextDocumentRename(ctx context.Context, filename string, rd iorw.ReaderAt, offset int, ...) (*WorkspaceEdit, error)
- type NotificationMessage
- type Position
- type Range
- type Registration
- type RenameParams
- type RequestMessage
- type Response
- type ResponseError
- type ResponseMessage
- type ServerWrap
- type TextDocumentContentChangeEvent
- type TextDocumentEdit
- type TextDocumentIdentifier
- type TextDocumentItem
- type TextDocumentPositionParams
- type TextEdit
- type VersionedTextDocumentIdentifier
- type WorkspaceEdit
- type WorkspaceEditChange
- type WorkspaceFolder
- type WorkspaceFoldersChangeEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JsonGetPath ¶
func PatchFileTextEdits ¶
func PatchWorkspaceEditChanges ¶
func PatchWorkspaceEditChanges(wecs []*WorkspaceEditChange) error
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(ctx context.Context, rwc io.ReadWriteCloser, li *LangInstance) *Client
func NewClientTCP ¶
func (*Client) ExitNotification ¶
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) TextDocumentRename ¶
func (*Client) UpdateWorkspaceFolder ¶
func (*Client) WorkspaceDidChangeWorkspaceFolders ¶
func (cli *Client) WorkspaceDidChangeWorkspaceFolders(ctx context.Context, added, removed []*WorkspaceFolder) error
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 DocumentUri ¶
type DocumentUri string
type JsonCodec ¶
type JsonCodec struct { OnNotificationMessage func(*NotificationMessage) 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(ctx context.Context, lang *LangManager) (*LangInstance, error)
func (*LangInstance) Wait ¶
func (li *LangInstance) Wait() error
type LangManager ¶
type LangManager struct { Reg *Registration // accessed from editor InstanceReqFilename string // the calling filename (used in startup) // contains filtered or unexported fields }
func NewLangManager ¶
func NewLangManager(man *Manager, reg *Registration) *LangManager
func (*LangManager) Close ¶
func (lang *LangManager) Close() (error, bool)
returns true if the instance was running
func (*LangManager) PrintWrapError ¶
func (lang *LangManager) PrintWrapError(err error)
func (*LangManager) WrapError ¶
func (lang *LangManager) WrapError(err error) error
func (*LangManager) WrapMsg ¶
func (lang *LangManager) WrapMsg(s string) string
type Location ¶
type Location struct { Uri DocumentUri `json:"uri,omitempty"` Range *Range `json:"range,omitempty"` }
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 ¶
func (*Manager) TextDocumentDefinition ¶
type NotificationMessage ¶
type NotificationMessage struct { Method string `json:"method,omitempty"` Params interface{} `json:"params,omitempty"` }
type Position ¶
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 RenameParams ¶
type RenameParams struct { TextDocumentPositionParams NewName string `json:"newName"` }
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 StartServerWrapIO ¶
func StartServerWrapIO(ctx context.Context, cmd string, stderr io.Writer, li *LangInstance) (*ServerWrap, io.ReadWriteCloser, error)
func StartServerWrapTCP ¶
func (*ServerWrap) Wait ¶
func (sw *ServerWrap) Wait() error
type TextDocumentEdit ¶
type TextDocumentEdit struct { TextDocument VersionedTextDocumentIdentifier `json:"textDocument"` Edits []*TextEdit `json:"edits"` }
type TextDocumentIdentifier ¶
type TextDocumentIdentifier struct {
Uri DocumentUri `json:"uri"`
}
type TextDocumentItem ¶
type TextDocumentItem struct { Uri DocumentUri `json:"uri"` LanguageId string `json:"languageId,omitempty"` Version int `json:"version"` Text string `json:"text"` }
type TextDocumentPositionParams ¶
type TextDocumentPositionParams struct { TextDocument TextDocumentIdentifier `json:"textDocument"` Position Position `json:"position"` }
type VersionedTextDocumentIdentifier ¶
type VersionedTextDocumentIdentifier struct { TextDocumentIdentifier Version *int `json:"version"` }
type WorkspaceEdit ¶
type WorkspaceEdit struct { Changes map[DocumentUri][]*TextEdit `json:"changes,omitempty"` DocumentChanges []*TextDocumentEdit `json:"documentChanges,omitempty"` }
type WorkspaceEditChange ¶
func WorkspaceEditChanges ¶
func WorkspaceEditChanges(we *WorkspaceEdit) ([]*WorkspaceEditChange, error)
type WorkspaceFolder ¶
type WorkspaceFolder struct { Uri DocumentUri `json:"uri"` Name string `json:"name"` }
type WorkspaceFoldersChangeEvent ¶
type WorkspaceFoldersChangeEvent struct { Added []*WorkspaceFolder `json:"added"` Removed []*WorkspaceFolder `json:"removed"` }
Click to show internal directories.
Click to hide internal directories.