mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 01:25:38 -05:00
Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)
This commit is contained in:
@@ -3,8 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { writeFile } from 'vs/base/node/pfs';
|
||||
import { promises } from 'fs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { createHash } from 'crypto';
|
||||
import { IExtensionManagementService, ILocalExtension, IExtensionIdentifier } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
@@ -158,7 +157,7 @@ class LanguagePacksCache extends Disposable {
|
||||
private withLanguagePacks<T>(fn: (languagePacks: { [language: string]: ILanguagePack }) => T | null = () => null): Promise<T> {
|
||||
return this.languagePacksFileLimiter.queue(() => {
|
||||
let result: T | null = null;
|
||||
return promises.readFile(this.languagePacksFilePath, 'utf8')
|
||||
return Promises.readFile(this.languagePacksFilePath, 'utf8')
|
||||
.then(undefined, err => err.code === 'ENOENT' ? Promise.resolve('{}') : Promise.reject(err))
|
||||
.then<{ [language: string]: ILanguagePack }>(raw => { try { return JSON.parse(raw); } catch (e) { return {}; } })
|
||||
.then(languagePacks => { result = fn(languagePacks); return languagePacks; })
|
||||
@@ -172,7 +171,7 @@ class LanguagePacksCache extends Disposable {
|
||||
this.initializedCache = true;
|
||||
const raw = JSON.stringify(this.languagePacks);
|
||||
this.logService.debug('Writing language packs', raw);
|
||||
return writeFile(this.languagePacksFilePath, raw);
|
||||
return Promises.writeFile(this.languagePacksFilePath, raw);
|
||||
})
|
||||
.then(() => result, error => this.logService.error(error));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user