Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Dec 27, 2022
1 parent ae96069 commit a97d52a
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 36 deletions.
Expand Up @@ -13,7 +13,7 @@ import { IUserDataProfile } from 'vs/platform/userDataProfile/common/userDataPro
import { IUserDataProfileStorageService } from 'vs/platform/userDataProfile/common/userDataProfileStorageService';
import { API_OPEN_EDITOR_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands';
import { ITreeItemCheckboxState, TreeItemCollapsibleState } from 'vs/workbench/common/views';
import { IProfileResource, IProfileResourceTreeItem, ProfileResourceType } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { IProfileResource, IProfileResourceChildTreeItem, IProfileResourceTreeItem, ProfileResourceType } from 'vs/workbench/services/userDataProfile/common/userDataProfile';

interface IGlobalState {
storage: IStringDictionary<string>;
Expand Down Expand Up @@ -74,19 +74,26 @@ export class GlobalStateResource implements IProfileResource {
export abstract class GlobalStateResourceTreeItem implements IProfileResourceTreeItem {

readonly type = ProfileResourceType.GlobalState;
readonly handle = 'globalState';
readonly handle = ProfileResourceType.GlobalState;
readonly label = { label: localize('globalState', "UI State") };
readonly collapsibleState = TreeItemCollapsibleState.None;
readonly collapsibleState = TreeItemCollapsibleState.Expanded;
checkbox: ITreeItemCheckboxState = { isChecked: true };
readonly command = {
id: API_OPEN_EDITOR_COMMAND_ID,
title: '',
arguments: [this.resource, undefined, undefined]
};

constructor(private readonly resource: URI) { }

async getChildren(): Promise<undefined> { return undefined; }
async getChildren(): Promise<IProfileResourceChildTreeItem[]> {
return [{
handle: this.resource.toString(),
resourceUri: this.resource,
collapsibleState: TreeItemCollapsibleState.None,
parent: this,
command: {
id: API_OPEN_EDITOR_COMMAND_ID,
title: '',
arguments: [this.resource, undefined, undefined]
}
}];
}

abstract getContent(): Promise<string>;
}
Expand Down
Expand Up @@ -6,7 +6,7 @@
import { VSBuffer } from 'vs/base/common/buffer';
import { FileOperationError, FileOperationResult, IFileService } from 'vs/platform/files/common/files';
import { ILogService } from 'vs/platform/log/common/log';
import { IProfileResource, IProfileResourceTreeItem, ProfileResourceType } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { IProfileResource, IProfileResourceChildTreeItem, IProfileResourceTreeItem, ProfileResourceType } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { platform, Platform } from 'vs/base/common/platform';
import { ITreeItemCheckboxState, TreeItemCollapsibleState } from 'vs/workbench/common/views';
import { IUserDataProfile } from 'vs/platform/userDataProfile/common/userDataProfile';
Expand Down Expand Up @@ -65,22 +65,29 @@ export class KeybindingsResource implements IProfileResource {
export class KeybindingsResourceTreeItem implements IProfileResourceTreeItem {

readonly type = ProfileResourceType.Keybindings;
readonly handle = this.profile.keybindingsResource.toString();
readonly handle = ProfileResourceType.Keybindings;
readonly label = { label: localize('keybindings', "Keyboard Shortcuts") };
readonly collapsibleState = TreeItemCollapsibleState.None;
readonly collapsibleState = TreeItemCollapsibleState.Expanded;
checkbox: ITreeItemCheckboxState = { isChecked: true };
readonly command = {
id: API_OPEN_EDITOR_COMMAND_ID,
title: '',
arguments: [this.profile.keybindingsResource, undefined, undefined]
};

constructor(
private readonly profile: IUserDataProfile,
@IInstantiationService private readonly instantiationService: IInstantiationService
) { }

async getChildren(): Promise<undefined> { return undefined; }
async getChildren(): Promise<IProfileResourceChildTreeItem[]> {
return [{
handle: this.profile.keybindingsResource.toString(),
resourceUri: this.profile.keybindingsResource,
collapsibleState: TreeItemCollapsibleState.None,
parent: this,
command: {
id: API_OPEN_EDITOR_COMMAND_ID,
title: '',
arguments: [this.profile.keybindingsResource, undefined, undefined]
}
}];
}

async hasContent(): Promise<boolean> {
const keybindingsContent = await this.instantiationService.createInstance(KeybindingsResource).getKeybindingsResourceContent(this.profile);
Expand Down
Expand Up @@ -8,7 +8,7 @@ import { ConfigurationScope, Extensions, IConfigurationRegistry } from 'vs/platf
import { FileOperationError, FileOperationResult, IFileService } from 'vs/platform/files/common/files';
import { ILogService } from 'vs/platform/log/common/log';
import { Registry } from 'vs/platform/registry/common/platform';
import { IProfileResource, IProfileResourceTreeItem, ProfileResourceType } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { IProfileResource, IProfileResourceChildTreeItem, IProfileResourceTreeItem, ProfileResourceType } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { updateIgnoredSettings } from 'vs/platform/userDataSync/common/settingsMerge';
import { IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDataSync';
import { ITreeItemCheckboxState, TreeItemCollapsibleState } from 'vs/workbench/common/views';
Expand Down Expand Up @@ -84,22 +84,29 @@ export class SettingsResource implements IProfileResource {
export class SettingsResourceTreeItem implements IProfileResourceTreeItem {

readonly type = ProfileResourceType.Settings;
readonly handle = this.profile.settingsResource.toString();
readonly handle = ProfileResourceType.Settings;
readonly label = { label: localize('settings', "Settings") };
readonly collapsibleState = TreeItemCollapsibleState.None;
readonly collapsibleState = TreeItemCollapsibleState.Expanded;
checkbox: ITreeItemCheckboxState = { isChecked: true };
readonly command = {
id: API_OPEN_EDITOR_COMMAND_ID,
title: '',
arguments: [this.profile.settingsResource, undefined, undefined]
};

constructor(
private readonly profile: IUserDataProfile,
@IInstantiationService private readonly instantiationService: IInstantiationService
) { }

async getChildren(): Promise<undefined> { return undefined; }
async getChildren(): Promise<IProfileResourceChildTreeItem[]> {
return [{
handle: this.profile.settingsResource.toString(),
resourceUri: this.profile.settingsResource,
collapsibleState: TreeItemCollapsibleState.None,
parent: this,
command: {
id: API_OPEN_EDITOR_COMMAND_ID,
title: '',
arguments: [this.profile.settingsResource, undefined, undefined]
}
}];
}

async hasContent(): Promise<boolean> {
const settingsContent = await this.instantiationService.createInstance(SettingsResource).getSettingsContent(this.profile);
Expand Down
25 changes: 16 additions & 9 deletions src/vs/workbench/services/userDataProfile/browser/tasksResource.ts
Expand Up @@ -11,7 +11,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import { IUserDataProfile } from 'vs/platform/userDataProfile/common/userDataProfile';
import { API_OPEN_EDITOR_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands';
import { ITreeItemCheckboxState, TreeItemCollapsibleState } from 'vs/workbench/common/views';
import { IProfileResource, IProfileResourceTreeItem, ProfileResourceType } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { IProfileResource, IProfileResourceChildTreeItem, IProfileResourceTreeItem, ProfileResourceType } from 'vs/workbench/services/userDataProfile/common/userDataProfile';

interface ITasksResourceContent {
tasks: string | null;
Expand Down Expand Up @@ -63,22 +63,29 @@ export class TasksResource implements IProfileResource {
export class TasksResourceTreeItem implements IProfileResourceTreeItem {

readonly type = ProfileResourceType.Tasks;
readonly handle = this.profile.tasksResource.toString();
readonly handle = ProfileResourceType.Tasks;
readonly label = { label: localize('tasks', "User Tasks") };
readonly collapsibleState = TreeItemCollapsibleState.None;
readonly collapsibleState = TreeItemCollapsibleState.Expanded;
checkbox: ITreeItemCheckboxState = { isChecked: true };
readonly command = {
id: API_OPEN_EDITOR_COMMAND_ID,
title: '',
arguments: [this.profile.tasksResource, undefined, undefined]
};

constructor(
private readonly profile: IUserDataProfile,
@IInstantiationService private readonly instantiationService: IInstantiationService
) { }

async getChildren(): Promise<undefined> { return undefined; }
async getChildren(): Promise<IProfileResourceChildTreeItem[]> {
return [{
handle: this.profile.tasksResource.toString(),
resourceUri: this.profile.tasksResource,
collapsibleState: TreeItemCollapsibleState.None,
parent: this,
command: {
id: API_OPEN_EDITOR_COMMAND_ID,
title: '',
arguments: [this.profile.tasksResource, undefined, undefined]
}
}];
}

async hasContent(): Promise<boolean> {
const tasksContent = await this.instantiationService.createInstance(TasksResource).getTasksResourceContent(this.profile);
Expand Down

0 comments on commit a97d52a

Please sign in to comment.