{"modulePath":"github.com/docker/docker-language-server","version":"v0.20.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package document\n\n## Functions\n\n```go\nfunc DirectoryForPrefix(documentPath DocumentPath, prefix, defaultValue string, prefixRequired bool) string\n```\nDirectoryForPrefix returns the parent directory to be used given the document's path and the prefix string that has been inserted into the document thus far.\n\nprefixRequired is true if prefix can just be a name without any slashes or backslashes.\n\n```go\nfunc OpenDockerfile(ctx context.Context, manager *Manager, documentURI, path string) ([]byte, []*parser.Node)\n```\n\n```go\nfunc ReadDocument(u uri.URI) (contents []byte, err error)\n```\nRead 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.\n\n## Types\n\n```go\ntype BakeHCLDocument interface {\n\tDocument\n\tDecoder() *decoder.PathDecoder\n\tFile() *hcl.File\n\tDockerfileForTarget(block *hclsyntax.Block) (dockerfileURI string, dockerfileAbsolutePath string, err error)\n\tParentTargets(target string) ([]string, bool)\n}\n```\n\n```go\nfunc NewBakeHCLDocument(u uri.URI, version int32, input []byte) BakeHCLDocument\n```\n\n```go\ntype BakePrintOutput struct {\n\tGroup  map[string]bake.Group  `json:\"group,omitempty\"`\n\tTarget map[string]bake.Target `json:\"target\"`\n}\n```\n\n```go\ntype ComposeDocument interface {\n\tDocument\n\tFile() *ast.File\n\tParsingError() error\n\tIncludedFiles() (map[string]*ast.File, bool)\n}\n```\n\n```go\nfunc NewComposeDocument(mgr *Manager, u uri.URI, version int32, input []byte) ComposeDocument\n```\n\n```go\ntype DockerfileDefinition int\n```\n\n```go\nconst (\n\tUndefined DockerfileDefinition = iota\n\tUnresolvable\n\tResolvable\n)\n```\n\n```go\ntype DockerfileDocument interface {\n\tDocument\n\tInstruction(p protocol.Position) *parser.Node\n\tNodes() []*parser.Node\n}\n```\n\n```go\nfunc NewDockerfileDocument(u uri.URI, version int32, input []byte) DockerfileDocument\n```\n\n```go\ntype Document interface {\n\tURI() uri.URI\n\tDocumentPath() (DocumentPath, error)\n\tCopy() Document\n\tInput() []byte\n\tVersion() int32\n\tUpdate(version int32, input []byte) bool\n\tClose()\n\tLanguageIdentifier() protocol.LanguageIdentifier\n}\n```\n\n```go\nfunc NewDocument(mgr *Manager, u uri.URI, identifier protocol.LanguageIdentifier, version int32, input []byte) Document\n```\n\n```go\ntype DocumentMap map[uri.URI]Document\n```\n\n```go\ntype DocumentPath struct {\n\tFolder            string\n\tFileName          string\n\tWSLDollarSignHost bool\n}\n```\n\n```go\ntype Manager struct {\n\t// contains filtered or unexported fields\n}\n```\nManager provides simplified file read/write operations for the LSP server.\n\n```go\nfunc NewDocumentManager(opts ...ManagerOpt) *Manager\n```\n\n```go\nfunc (m *Manager) Get(ctx context.Context, u uri.URI) Document\n```\n\n```go\nfunc (m *Manager) Keys() []uri.URI\n```\n\n```go\nfunc (m *Manager) LockDocument(uri uri.URI) bool\n```\nLockDocument locks the specified document in preparation of publishing diagnostics. False may be returned if the document is not recognized as being opened in the client.\n\n```go\nfunc (m *Manager) Overwrite(ctx context.Context, u uri.URI, version int32, input []byte) (bool, error)\n```\n\n```go\nfunc (m *Manager) Queue(ctx context.Context, u uri.URI, fn func())\n```\nQueue enqueues the given function as something that should be run in the near future. The URI will be used as a key so if another function had previously enqueued for this function and it had not yet been run that the previously enqueued function will be discarded and replaced with the provided function.\n\n```go\nfunc (m *Manager) Read(ctx context.Context, u uri.URI) (doc Document, err error)\n```\nRead returns the contents of the file for the given URI.\n\nIf no file exists at the path or the URI is of an invalid type, an error is returned.\n\n```go\nfunc (m *Manager) Remove(u uri.URI)\n```\n\n```go\nfunc (m *Manager) UnlockDocument(uri uri.URI)\n```\n\n```go\nfunc (m *Manager) Version(ctx context.Context, u uri.URI) (int32, error)\n```\n\n```go\nfunc (m *Manager) Write(ctx context.Context, u uri.URI, identifier protocol.LanguageIdentifier, version int32, input []byte) (bool, error)\n```\nWrite creates or replaces the contents of the file for the given URI. True will be returned if the document's syntax tree has changed.\n\n```go\ntype ManagerOpt func(manager *Manager)\n```\n\n```go\nfunc WithReadDocumentFunc(readDocFunc ReadDocumentFunc) ManagerOpt\n```\n\n```go\ntype NewDocumentFunc func(mgr *Manager, u uri.URI, identifier protocol.LanguageIdentifier, version int32, input []byte) Document\n```\n\n```go\ntype ReadDocumentFunc func(uri.URI) ([]byte, error)\n```\n\n","path":"github.com/docker/docker-language-server/internal/pkg/document","name":"document","synopsis":"","isRedistributable":true}
