Documentation ¶
Index ¶
- func NodesToContent(doc Document, nodes []*sitter.Node) string
- func ReadDocument(u uri.URI) (contents []byte, err error)
- func ResolveURI(u uri.URI) (string, error)
- type Document
- type DocumentMap
- type LoadStatement
- type LoadSymbol
- type Manager
- func (m *Manager) Initialize(params *protocol.InitializeParams)
- func (m *Manager) Keys() []uri.URI
- func (m *Manager) Read(ctx context.Context, u uri.URI) (doc Document, err error)
- func (m *Manager) Remove(u uri.URI)
- func (m *Manager) Resolve(u uri.URI) (uri.URI, error)
- func (m *Manager) Write(ctx context.Context, u uri.URI, input []byte) (diags []protocol.Diagnostic, err error)
- type ManagerOpt
- type NewDocumentFunc
- type ReadDocumentFunc
- type ResolveURIFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NodesToContent ¶
Returns the source content for the (assumed neighboring) nodes. If slice is nil or empty, return the entire document.
func ReadDocument ¶
Read the document from the given URI and return its contents. This default implementation of a ReadDocumentFunc only handles file: URIs and returns an error otherwise.
Types ¶
type Document ¶
type DocumentMap ¶
type LoadStatement ¶
type LoadStatement struct { File string Symbols []LoadSymbol Range protocol.Range Diagnostics []protocol.Diagnostic // contains filtered or unexported fields }
type LoadSymbol ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides simplified file read/write operations for the LSP server.
func NewDocumentManager ¶
func NewDocumentManager(opts ...ManagerOpt) *Manager
func (*Manager) Initialize ¶
func (m *Manager) Initialize(params *protocol.InitializeParams)
func (*Manager) Read ¶
Read returns the contents of the file for the given URI.
If no file exists at the path or the URI is of an invalid type, an error is returned.
type ManagerOpt ¶
type ManagerOpt func(manager *Manager)
func WithNewDocumentFunc ¶
func WithNewDocumentFunc(newDocFunc NewDocumentFunc) ManagerOpt
func WithReadDocumentFunc ¶
func WithReadDocumentFunc(readDocFunc ReadDocumentFunc) ManagerOpt
func WithResolveURIFunc ¶
func WithResolveURIFunc(fn ResolveURIFunc) ManagerOpt
type NewDocumentFunc ¶
Click to show internal directories.
Click to hide internal directories.