Documentation
¶
Index ¶
- func AbsFilenameToUrl(filename string) (string, error)
- func CompletionListToString(clist *CompletionList) []string
- func GoplsRegistration(tcp bool, trace bool, stderr bool) string
- func JsonGetPath(v any, path string) (any, error)
- func LocationsToString(locations []*Location, baseDir string) (string, error)
- func ManagerCallHierarchyCallsToString(mcalls []*ManagerCallHierarchyCalls, typ CallHierarchyCallType, baseDir string) (string, error)
- func PatchTextEdits(src []byte, edits []*TextEdit) ([]byte, error)
- func RangeToOffsetLen(rd iorw.ReaderAt, rang *Range) (int, int, error)
- func RegistrationExamples() []string
- func UrlToAbsFilename(url string) (string, error)
- func Utf8Column(rd iorw.ReaderAt, lineStartOffset, utf16Col int) (int, error)
- func Utf16Column(rd iorw.ReaderAt, lineStartOffset, utf8Col int) (int, error)
- type CallHierarchyCall
- type CallHierarchyCallType
- type CallHierarchyCallsParams
- type CallHierarchyItem
- type CallHierarchyPrepareParams
- type Client
- func (cli *Client) Call(ctx context.Context, method string, args, reply any) error
- func (cli *Client) CallHierarchyCalls(ctx context.Context, typ CallHierarchyCallType, item *CallHierarchyItem) ([]*CallHierarchyCall, 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) TextDocumentImplementation(ctx context.Context, filename string, pos Position) (*Location, error)
- func (cli *Client) TextDocumentPrepareCallHierarchy(ctx context.Context, filename string, pos Position) ([]*CallHierarchyItem, error)
- func (cli *Client) TextDocumentReferences(ctx context.Context, filename string, pos Position) ([]*Location, error)
- func (cli *Client) TextDocumentRename(ctx context.Context, filename string, pos Position, newName string) (*WorkspaceEdit, error)
- func (cli *Client) Wait() error
- type CompletionContext
- type CompletionItem
- type CompletionItemKind
- type CompletionItemTag
- 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 LogMessageParams
- type Manager
- func (man *Manager) CallHierarchyCalls(ctx context.Context, filename string, rd iorw.ReaderAt, offset int, ...) ([]*ManagerCallHierarchyCalls, error)
- func (man *Manager) Error(err error)
- func (man *Manager) LangManager(filename string) (*LangManager, error)
- func (man *Manager) Message(s string)
- func (man *Manager) NInstances() int
- func (man *Manager) Register(reg *Registration) error
- func (man *Manager) Stop()
- func (man *Manager) SyncText(ctx context.Context, filename string, rd iorw.ReaderAt) 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) TextDocumentImplementation(ctx context.Context, filename string, rd iorw.ReaderAt, offset int) (string, *Range, error)
- func (man *Manager) TextDocumentReferences(ctx context.Context, filename string, rd iorw.ReaderAt, offset int) ([]*Location, error)
- func (man *Manager) TextDocumentRename(ctx context.Context, filename string, rd iorw.ReaderAt, offset int, ...) (*WorkspaceEdit, error)
- func (man *Manager) TextDocumentRenameAndPatch(ctx context.Context, filename string, rd iorw.ReaderAt, offset int, ...) ([]*WorkspaceEditChange, error)
- type ManagerCallHierarchyCalls
- type MarkupContent
- type MarkupKind
- type Message
- type MessageType
- type NotificationMessage
- type Position
- type Range
- type ReferenceContext
- type ReferenceParams
- type Registration
- type RenameParams
- type RequestMessage
- type Response
- type ResponseError
- type ResponseMessage
- type ServerWrap
- type SymbolKind
- type SymbolTag
- 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 AbsFilenameToUrl ¶ added in v1.3.4
func CompletionListToString ¶ added in v1.3.4
func CompletionListToString(clist *CompletionList) []string
func GoplsRegistration ¶ added in v1.3.3
func LocationsToString ¶ added in v1.3.4
func ManagerCallHierarchyCallsToString ¶ added in v1.3.3
func ManagerCallHierarchyCallsToString(mcalls []*ManagerCallHierarchyCalls, typ CallHierarchyCallType, baseDir string) (string, error)
func PatchTextEdits ¶ added in v1.1.0
func RegistrationExamples ¶
func RegistrationExamples() []string
func UrlToAbsFilename ¶ added in v1.3.4
func Utf8Column ¶
Input and result is zero based.
Types ¶
type CallHierarchyCall ¶ added in v1.3.3
type CallHierarchyCall struct {
From *CallHierarchyItem `json:"from,omitempty"` // incoming
To *CallHierarchyItem `json:"to,omitempty"` // outgoing
FromRanges []*Range `json:"fromRanges"`
}
func (*CallHierarchyCall) Item ¶ added in v1.3.3
func (chc *CallHierarchyCall) Item() *CallHierarchyItem
type CallHierarchyCallType ¶ added in v1.3.3
type CallHierarchyCallType int
Not part of the protocol, used to unify/simplify
const ( IncomingChct CallHierarchyCallType = iota OutgoingChct )
type CallHierarchyCallsParams ¶ added in v1.3.3
type CallHierarchyCallsParams struct {
Item *CallHierarchyItem `json:"item"`
}
type CallHierarchyItem ¶ added in v1.3.3
type CallHierarchyItem struct {
Name string `json:"name"`
Kind SymbolKind `json:"kind"`
Tags []*SymbolTag `json:"tags,omitempty"` // optional
Detail string `json:"detail"` // optional
Uri DocumentUri `json:"uri"`
Range *Range `json:"range"`
SelectionRange *Range `json:"selectionRange"`
Data any `json:"data,omitempty"` // optional (related to prepare calls)
}
type CallHierarchyPrepareParams ¶ added in v1.3.3
type CallHierarchyPrepareParams struct {
TextDocumentPositionParams
}
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) CallHierarchyCalls ¶ added in v1.3.3
func (cli *Client) CallHierarchyCalls(ctx context.Context, typ CallHierarchyCallType, item *CallHierarchyItem) ([]*CallHierarchyCall, error)
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) TextDocumentImplementation ¶ added in v1.3.3
func (*Client) TextDocumentPrepareCallHierarchy ¶ added in v1.3.3
func (*Client) TextDocumentReferences ¶ added in v1.3.4
func (*Client) TextDocumentRename ¶ added in v1.1.0
type CompletionContext ¶
type CompletionItem ¶
type CompletionItem struct {
Label string `json:"label"`
Kind CompletionItemKind `json:"kind,omitempty"`
Detail string `json:"detail,omitempty"`
Documentation _completionItemDocumentation `json:"documentation,omitempty"`
Deprecated bool `json:"deprecated,omitempty"` // deprecated in favor of "tags"
Tags []CompletionItemTag `json:"tags,omitempty"`
}
type CompletionItemKind ¶ added in v1.3.7
type CompletionItemKind int
type CompletionItemTag ¶ added in v1.3.7
type CompletionItemTag int
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 ¶ added in v1.1.0
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.
type LangInstance ¶
type LangInstance struct {
// contains filtered or unexported fields
}
func NewLangInstance ¶
func NewLangInstance(ctx context.Context, lang *LangManager) (*LangInstance, error)
func (*LangInstance) Wait ¶ added in v1.1.0
func (li *LangInstance) Wait() error
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) PrintWrapError ¶ added in v1.1.0
func (lang *LangManager) PrintWrapError(err error)
func (*LangManager) WrapError ¶
func (lang *LangManager) WrapError(err error) error
func (*LangManager) WrapMsg ¶ added in v1.1.0
func (lang *LangManager) WrapMsg(s string) string
type Location ¶
type Location struct {
Uri DocumentUri `json:"uri,omitempty"`
Range *Range `json:"range,omitempty"`
}
type LogMessageParams ¶ added in v1.3.7
type LogMessageParams struct {
Type MessageType `json:"type,omitempty"`
Message string `json:"message,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) CallHierarchyCalls ¶ added in v1.3.3
func (man *Manager) CallHierarchyCalls(ctx context.Context, filename string, rd iorw.ReaderAt, offset int, typ CallHierarchyCallType) ([]*ManagerCallHierarchyCalls, error)
func (*Manager) LangManager ¶
func (man *Manager) LangManager(filename string) (*LangManager, error)
func (*Manager) NInstances ¶ added in v1.3.11
func (*Manager) Register ¶
func (man *Manager) Register(reg *Registration) error
func (*Manager) TextDocumentCompletion ¶
func (*Manager) TextDocumentCompletionDetailStrings ¶
func (*Manager) TextDocumentDefinition ¶
func (*Manager) TextDocumentImplementation ¶ added in v1.3.3
func (*Manager) TextDocumentReferences ¶ added in v1.3.4
func (*Manager) TextDocumentRename ¶ added in v1.1.0
func (*Manager) TextDocumentRenameAndPatch ¶ added in v1.3.4
type ManagerCallHierarchyCalls ¶ added in v1.3.3
type ManagerCallHierarchyCalls struct {
// contains filtered or unexported fields
}
type MarkupContent ¶ added in v1.3.7
type MarkupContent struct {
Kind MarkupKind `json:"kind"`
Value string `json:"value"`
}
type MarkupKind ¶ added in v1.3.7
type MarkupKind string // ex: plaintext, markup
type Message ¶ added in v1.3.3
type Message struct {
JsonRpc string `json:"jsonrpc"`
}
func MakeMessage ¶ added in v1.3.3
func MakeMessage() Message
type MessageType ¶ added in v1.3.7
type MessageType int
type NotificationMessage ¶
type NotificationMessage struct {
Message
Method string `json:"method,omitempty"`
//Params any `json:"params,omitempty"`
Params _notificationMessageParams `json:"params,omitempty"`
}
Used as request and response (sent/received).
type Position ¶
type ReferenceContext ¶ added in v1.3.4
type ReferenceContext struct {
IncludeDeclaration bool `json:"includeDeclaration"`
}
type ReferenceParams ¶ added in v1.3.4
type ReferenceParams struct {
TextDocumentPositionParams
Context ReferenceContext `json:"context"`
}
type Registration ¶
type Registration struct {
Language string
Exts []string
Network string // {stdio,tcpclient,tcp}
Cmd string // template values: {.Addr,.Host,.Port}
Optional []string // {stderr,nogotoimpl}
}
func NewRegistration ¶
func NewRegistration(s string) (*Registration, error)
func (*Registration) HasOptional ¶
func (reg *Registration) HasOptional(s string) bool
func (*Registration) String ¶ added in v1.3.1
func (reg *Registration) String() string
type RenameParams ¶ added in v1.1.0
type RenameParams struct {
TextDocumentPositionParams
NewName string `json:"newName"`
}
type RequestMessage ¶
type Response ¶
type Response struct {
*ResponseMessage
*NotificationMessage
}
func (*Response) IsNotification ¶ added in v1.3.3
type ResponseError ¶
type ResponseError struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data"`
}
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
type ResponseMessage ¶
type ResponseMessage struct {
Message
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 (*ServerWrap) Wait ¶ added in v1.1.0
func (sw *ServerWrap) Wait() error
type SymbolKind ¶ added in v1.3.3
type SymbolKind int
type TextDocumentEdit ¶ added in v1.1.0
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 ¶ added in v1.1.0
type WorkspaceEdit struct {
Changes map[DocumentUri][]*TextEdit `json:"changes,omitempty"`
DocumentChanges []*TextDocumentEdit `json:"documentChanges,omitempty"`
}
func (*WorkspaceEdit) GetChanges ¶ added in v1.3.4
func (we *WorkspaceEdit) GetChanges() ([]*WorkspaceEditChange, error)
type WorkspaceEditChange ¶ added in v1.1.0
Not part of the protocol, used to unify/simplify
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.