the document URI to try to load. Must be consistent with LSP URIs. (e.g. normalized URIs)
the created document
FileException in case the file doesn't exist or other file system errors. In this case no new document should have been inserted yet.
import served.lsp.uri; import std.file; import std.path; auto dir = buildPath(tempDir(), "textdocumentmanager"); mkdir(dir); scope (exit) rmdirRecurse(dir); auto app_d = buildPath(dir, "app.d"); auto src = "import std.stdio; void main() { writeln(`hello world`); }"; write(app_d, src); TextDocumentManager documents; bool created; auto doc = &documents.getOrFromFilesystem(uriFromFile(app_d), created); assert(created); auto other = &documents.getOrFromFilesystem(uriFromFile(app_d)); assert(doc is other); assert(doc.rawText == src); assert(doc.rawText !is src);
Returns the managed document for the given URI or if it doesn't exist it tries to read the file from the filesystem and open it from that.
Note that a LSP close method will unload this early.