Skip to main content

TextDocumentContentProvider

interface

A text document content provider allows to add readonly documents to the editor, such as source from a dll or generated html from md. Content providers are workspace.registerTextDocumentContentProvider registered for a uri-scheme. When a uri with that scheme is to be workspace.openTextDocument loaded the content provider is asked.

interface TextDocumentContentProvider

Import

import { TextDocumentContentProvider } from '@modular/sdk/editor';

Members2

onDidChangeoptional
Event<Uri>

An event to signal a resource has changed.

provideTextDocumentContent()
(uri: Uri, token: CancellationToken) => ProviderResult<string>

Provide textual content for a given uri. The editor will use the returned string-content to create a readonly document. Resources allocated should be released when the corresponding document has been workspace.onDidCloseTextDocument closed. **Note**: The contents of the created document might not be identical to the provided text due to end-of-line-sequence normalization.