mirror of
https://github.com/Microsoft/vscode
synced 2024-08-25 03:56:03 +00:00
parent
53ca7186cc
commit
ff922dc231
|
@ -26,6 +26,8 @@ class VSCodeWorkspaceMarkdownDocumentProvider extends Disposable implements Work
|
|||
|
||||
private _watcher: vscode.FileSystemWatcher | undefined;
|
||||
|
||||
private readonly utf8Decoder = new TextDecoder('utf-8');
|
||||
|
||||
async getAllMarkdownDocuments() {
|
||||
const resources = await vscode.workspace.findFiles('**/*.md', '**/node_modules/**');
|
||||
const docs = await Promise.all(resources.map(doc => this.getMarkdownDocument(doc)));
|
||||
|
@ -88,7 +90,7 @@ class VSCodeWorkspaceMarkdownDocumentProvider extends Disposable implements Work
|
|||
const bytes = await vscode.workspace.fs.readFile(resource);
|
||||
|
||||
// We assume that markdown is in UTF-8
|
||||
const text = Buffer.from(bytes).toString('utf-8');
|
||||
const text = this.utf8Decoder.decode(bytes);
|
||||
|
||||
const lines: SkinnyTextLine[] = [];
|
||||
const parts = text.split(/(\r?\n)/);
|
||||
|
|
Loading…
Reference in a new issue