Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)

This commit is contained in:
Cory Rivera
2021-08-25 16:28:29 -07:00
committed by GitHub
parent ab1112bfb3
commit cb7b7da0a4
1752 changed files with 59525 additions and 33878 deletions

View File

@@ -59,6 +59,7 @@ export class ExtensionLinter {
private readmeQ = new Set<TextDocument>();
private timer: NodeJS.Timer | undefined;
private markdownIt: MarkdownItType.MarkdownIt | undefined;
private parse5: typeof import('parse5') | undefined;
constructor() {
this.disposables.push(
@@ -202,8 +203,10 @@ export class ExtensionLinter {
let svgStart: Diagnostic;
for (const tnp of tokensAndPositions) {
if (tnp.token.type === 'text' && tnp.token.content) {
const parse5 = await import('parse5');
const parser = new parse5.SAXParser({ locationInfo: true });
if (!this.parse5) {
this.parse5 = await import('parse5');
}
const parser = new this.parse5.SAXParser({ locationInfo: true });
parser.on('startTag', (name, attrs, _selfClosing, location) => {
if (name === 'img') {
const src = attrs.find(a => a.name === 'src');