Clean up and fix markdown url pasting (#198706)

Fixes #192568
This commit is contained in:
Matt Bierner
2023-11-20 14:37:00 -08:00
committed by GitHub
parent 032109e5a7
commit ff9fc384d3
7 changed files with 181 additions and 173 deletions

View File

@@ -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);
}
}