Document.this

Creates a new document at the given document URI, with the given version and language and creates a copy of the text to use.

  1. this(DocumentUri uri)
  2. this(TextDocumentItem doc)
    struct Document

Examples

// e.g. received from LSP client
TextDocumentItem item = {
	uri: "file:///home/projects/app.c",
	languageId: "cpp",
	version_: 0,
	text: "#include <stdio>",
};
auto doc = Document(item);
assert(doc.length == "#include <stdio>".length);

Meta