81
});
82
}
84
>
export const PROFILE_URL_AUTHORITY_PREFIX = 'profile-';
85
>
export function isProfileURL(uri: URI): boolean {
86
return uri.authority === PROFILE_URL_AUTHORITY || new RegExp(`^${PROFILE_URL_AUTHORITY_PREFIX}`).test(uri.authority);
87
}
89
>
export interface IUserDataProfileCreateOptions extends IUserDataProfileOptions {
90
>
readonly name?: string;
91
>
readonly resourceTypeFlags?: ProfileResourceTypeFlags;
92
>
}
93
>
94
>
export interface IProfileImportOptions extends IUserDataProfileCreateOptions {
95
>
readonly name?: string;
96
>
readonly icon?: string;
97
>
readonly mode?: 'apply';
98
>
}
99
>
100
>
export const IUserDataProfileImportExportService = createDecorator<IUserDataProfileImportExportService>('IUserDataProfileImportExportService');
101
>
export interface IUserDataProfileImportExportService {
102
>
readonly _serviceBrand: undefined;
103
>
104
>
registerProfileContentHandler(id: string, profileContentHandler: IUserDataProfileContentHandler): IDisposable;
105
>
unregisterProfileContentHandler(id: string): void;
106
>
107
>
resolveProfileTemplate(uri: URI): Promise<IUserDataProfileTemplate | null>;
108
>
exportProfile(profile: IUserDataProfile, exportFlags?: ProfileResourceTypeFlags): Promise<void>;
109
>
createFromProfile(from: IUserDataProfile, options: IUserDataProfileCreateOptions, token: CancellationToken): Promise<IUserDataProfile | undefined>;
110
>
createProfileFromTemplate(profileTemplate: IUserDataProfileTemplate, options: IUserDataProfileCreateOptions, token: CancellationToken): Promise<IUserDataProfile | undefined>;
111
>
createTroubleshootProfile(): Promise<void>;
112
>
}
113
>
114
>
export interface IProfileResourceInitializer {
115
>
initialize(content: string): Promise<void>;
116
>
}
117
>
118
>
export interface IProfileResource {
119
>
getContent(profile: IUserDataProfile): Promise<string>;
120
>
apply(content: string, profile: IUserDataProfile): Promise<void>;
121
>
}
122
>
123
>
export interface IProfileResourceTreeItem extends ITreeItem {
124
>
readonly type: ProfileResourceType;
125
>
readonly label: ITreeItemLabel;
126
>
isFromDefaultProfile(): boolean;
127
>
getChildren(): Promise<IProfileResourceChildTreeItem[] | undefined>;
128
>
getContent(): Promise<string>;
129
>
}
130
>
131
>
export interface IProfileResourceChildTreeItem extends ITreeItem {
132
>
parent: IProfileResourceTreeItem;
133
>
}
134
>
135
>
export interface ISaveProfileResult {
136
>
readonly id: string;
137
>
readonly link: URI;
138
>
}
139
>
140
>
export interface IUserDataProfileContentHandler {
141
>
readonly name: string;
142
>
readonly description?: string;
143
>
readonly extensionId?: string;
144
>
saveProfile(name: string, content: string, token: CancellationToken): Promise<ISaveProfileResult | null>;
145
>
readProfile(idOrUri: string | URI, token: CancellationToken): Promise<string | null>;
146
>
}
147
>
148
>
export const defaultUserDataProfileIcon = registerIcon('defaultProfile-icon', Codicon.settings, localize('defaultProfileIcon', 'Icon for Default Profile.'));
149
>
150
>
export const PROFILES_TITLE = localize2('profiles', 'Profiles');
151
>
export const PROFILES_CATEGORY = { ...PROFILES_TITLE };
152
>
export const PROFILE_EXTENSION = 'code-profile';
153
>
export const PROFILE_FILTER = [{ name: localize('profile', "Profile"), extensions: [PROFILE_EXTENSION] }];
154
>
export const CURRENT_PROFILE_CONTEXT = new RawContextKey<string>('currentProfile', '');
155
>
export const HAS_PROFILES_CONTEXT = new RawContextKey<boolean>('hasProfiles', false);