public class CodeDocumentA text asset, open for editing: its buffer, its highlighting, and what is wrong with it.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The text lives on the document and the caret lives on the control. A file can be open in two panes and has one set of bytes; where a caret is, is a property of a pane. CodeEditor takes a CodeBuffer and this is what owns one.
Analysis is the document's and it is not a build. Reanalyse runs the front end far enough to know where the squiggles go, and deliberately no further: nothing here emits SPIR-V or writes an artefact. "Live recompile" in doc 11's sense is this plus the shader compiler service, which runs out of process and is not what a keystroke should wait for.
⚠ Analysis is run when it is asked for, not on every change. The buffer raises Changed per keystroke and parsing a shader per keystroke is a parse per keystroke; the view debounces by running it on a pause the host decides. A document that analysed itself on change would make that impossible to opt out of.
Fields and properties (6)
public string AssetPathWhere the file is, absolute.
public CodeBuffer BufferThe text.
public IReadOnlyList<CodeDiagnostic> DiagnosticsWhat is wrong with it, as of the last Reanalyse.
public virtual ICodeTokenizer TokenizerWhat turns a line into colours.
public string TextThe text as it stands.
public bool HasErrorsWhether anything it found is an error.
Events (1)
public Action<CodeDocument>? AnalysedRaised after Reanalyse has run.
Methods (4)
public CodeDocument(EditorProject project, AssetId asset, string path)Opens a text asset.
public IReadOnlyList<CodeDiagnostic> Reanalyse()Runs the analysis and replaces Diagnostics.
protected virtual IReadOnlyList<CodeDiagnostic> Analyse(string text)What is wrong with a text, for whatever language this document is.
protected override void SaveCore()Writes the document back to wherever it came from.
Used by (10)
- CodeAnalysisTestsVixen.Editor.AssetEditors.Tests
- CodeDocumentTestsVixen.Editor.AssetEditors.Tests
- CodeEditorViewVixen.Editor.AssetEditors
- MarkupDocumentVixen.Editor.AssetEditors
- MarkupEditorFactoryVixen.Editor.AssetEditors
- PreviewCodeEditorViewVixen.Editor.AssetEditors
- ShaderDocumentVixen.Editor.AssetEditors
- ShaderEditorFactoryVixen.Editor.AssetEditors
- StyleSheetDocumentVixen.Editor.AssetEditors
- TextEditCommandVixen.Editor.AssetEditors