mirror of
https://github.com/Microsoft/vscode
synced 2024-07-05 01:08:57 +00:00
Use Buffer.toString
in node-only context (#175592)
This commit is contained in:
parent
477b8a2af6
commit
5148e0bde9
|
@ -12,7 +12,6 @@ import * as MarkdownItType from 'markdown-it';
|
|||
|
||||
import { languages, workspace, Disposable, TextDocument, Uri, Diagnostic, Range, DiagnosticSeverity, Position, env, l10n } from 'vscode';
|
||||
import { INormalizedVersion, normalizeVersion, parseVersion } from './extensionEngineValidation';
|
||||
import { TextDecoder } from 'util';
|
||||
|
||||
const product = JSON.parse(fs.readFileSync(path.join(env.appRoot, 'product.json'), { encoding: 'utf-8' }));
|
||||
const allowedBadgeProviders: string[] = (product.extensionAllowedBadgeProviders || []).map((s: string) => s.toLowerCase());
|
||||
|
@ -70,7 +69,6 @@ export class ExtensionLinter {
|
|||
private timer: NodeJS.Timer | undefined;
|
||||
private markdownIt: MarkdownItType.MarkdownIt | undefined;
|
||||
private parse5: typeof import('parse5') | undefined;
|
||||
private textDecoder = new TextDecoder();
|
||||
|
||||
constructor() {
|
||||
this.disposables.push(
|
||||
|
@ -349,7 +347,7 @@ export class ExtensionLinter {
|
|||
const file = folder.with({ path: path.posix.join(folder.path, 'package.json') });
|
||||
try {
|
||||
const fileContents = await workspace.fs.readFile(file); // #174888
|
||||
return parseTree(this.textDecoder.decode(fileContents));
|
||||
return parseTree(Buffer.from(fileContents).toString('utf-8'));
|
||||
} catch (err) {
|
||||
return undefined;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user