mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Use find instead of filter
This commit is contained in:
+3
-3
@@ -95,9 +95,9 @@ class VSCodeWorkspaceMarkdownDocumentProvider extends Disposable implements Work
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async getMarkdownDocument(resource: vscode.Uri): Promise<SkinnyTextDocument | undefined> {
|
private async getMarkdownDocument(resource: vscode.Uri): Promise<SkinnyTextDocument | undefined> {
|
||||||
const matchingDocuments = vscode.workspace.textDocuments.filter((doc) => doc.uri.toString() === resource.toString());
|
const matchingDocument = vscode.workspace.textDocuments.find((doc) => doc.uri.toString() === resource.toString());
|
||||||
if (matchingDocuments.length !== 0) {
|
if (matchingDocument) {
|
||||||
return matchingDocuments[0];
|
return matchingDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bytes = await vscode.workspace.fs.readFile(resource);
|
const bytes = await vscode.workspace.fs.readFile(resource);
|
||||||
|
|||||||
Reference in New Issue
Block a user