mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
files2 - adopt new methods
This commit is contained in:
@@ -133,7 +133,7 @@ export class UserConfiguration extends Disposable {
|
||||
|
||||
async reload(): Promise<ConfigurationModel> {
|
||||
try {
|
||||
const content = await this.configurationFileService.resolveContent(this.configurationResource);
|
||||
const content = await this.configurationFileService.readFile(this.configurationResource);
|
||||
this.parser.parseContent(content);
|
||||
return this.parser.configurationModel;
|
||||
} catch (e) {
|
||||
@@ -379,7 +379,7 @@ class FileServiceBasedWorkspaceConfiguration extends Disposable implements IWork
|
||||
}
|
||||
let contents = '';
|
||||
try {
|
||||
contents = await this.configurationFileService.resolveContent(this._workspaceIdentifier.configPath);
|
||||
contents = await this.configurationFileService.readFile(this._workspaceIdentifier.configPath);
|
||||
} catch (error) {
|
||||
const exists = await this.configurationFileService.exists(this._workspaceIdentifier.configPath);
|
||||
if (exists) {
|
||||
@@ -547,7 +547,7 @@ class FileServiceBasedFolderConfiguration extends Disposable implements IFolderC
|
||||
async loadConfiguration(): Promise<ConfigurationModel> {
|
||||
const configurationContents = await Promise.all(this.configurationResources.map(async resource => {
|
||||
try {
|
||||
return await this.configurationFileService.resolveContent(resource);
|
||||
return await this.configurationFileService.readFile(resource);
|
||||
} catch (error) {
|
||||
const exists = await this.configurationFileService.exists(resource);
|
||||
if (exists) {
|
||||
|
||||
@@ -49,7 +49,7 @@ export interface IConfigurationFileService {
|
||||
whenProviderRegistered(scheme: string): Promise<void>;
|
||||
watch(resource: URI): IDisposable;
|
||||
exists(resource: URI): Promise<boolean>;
|
||||
resolveContent(resource: URI): Promise<string>;
|
||||
readFile(resource: URI): Promise<string>;
|
||||
}
|
||||
|
||||
export class ConfigurationFileService implements IConfigurationFileService {
|
||||
@@ -82,8 +82,8 @@ export class ConfigurationFileService implements IConfigurationFileService {
|
||||
return this.fileService.exists(resource);
|
||||
}
|
||||
|
||||
resolveContent(resource: URI): Promise<string> {
|
||||
return this.fileService.resolveContent(resource, { encoding: 'utf8' }).then(content => content.value);
|
||||
readFile(resource: URI): Promise<string> {
|
||||
return this.fileService.readFile(resource).then(content => content.value.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,9 +51,9 @@ export class ConfigurationFileService extends Disposable implements IConfigurati
|
||||
return this._fileServiceBasedConfigurationFileService ? this._fileServiceBasedConfigurationFileService.exists(resource) : pfs.exists(resource.fsPath);
|
||||
}
|
||||
|
||||
async resolveContent(resource: URI): Promise<string> {
|
||||
async readFile(resource: URI): Promise<string> {
|
||||
if (this._fileServiceBasedConfigurationFileService) {
|
||||
return this._fileServiceBasedConfigurationFileService.resolveContent(resource);
|
||||
return this._fileServiceBasedConfigurationFileService.readFile(resource);
|
||||
} else {
|
||||
const contents = await pfs.readFile(resource.fsPath);
|
||||
return contents.toString();
|
||||
|
||||
Reference in New Issue
Block a user