mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 08:38:56 +01:00
@@ -3,18 +3,28 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import * as vscode from 'vscode';
|
||||
import { ITextDocument } from '../types/textDocument';
|
||||
|
||||
export class InMemoryDocument implements ITextDocument {
|
||||
|
||||
constructor(
|
||||
public readonly uri: vscode.Uri,
|
||||
private readonly _contents: string,
|
||||
public readonly version = 0,
|
||||
) { }
|
||||
private readonly _doc: TextDocument;
|
||||
|
||||
getText(): string {
|
||||
return this._contents;
|
||||
public readonly uri: vscode.Uri;
|
||||
public readonly version: number;
|
||||
|
||||
constructor(
|
||||
uri: vscode.Uri,
|
||||
contents: string,
|
||||
version: number = 0,
|
||||
) {
|
||||
this.uri = uri;
|
||||
this.version = version;
|
||||
this._doc = TextDocument.create(this.uri.toString(), 'markdown', 0, contents);
|
||||
}
|
||||
|
||||
getText(range?: vscode.Range): string {
|
||||
return this._doc.getText(range);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user