mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode b12f623603e2fc1c5b3037115fa37c1a6acc4165 (#6760)
This commit is contained in:
@@ -38,6 +38,7 @@ import { defaultKeybindingsContents, DefaultKeybindingsEditorModel, DefaultSetti
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
|
||||
const emptyEditableSettingsContent = '{\n}';
|
||||
|
||||
@@ -188,15 +189,15 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
return null;
|
||||
}
|
||||
|
||||
openRawDefaultSettings(): Promise<IEditor | null> {
|
||||
openRawDefaultSettings(): Promise<IEditor | undefined> {
|
||||
return this.editorService.openEditor({ resource: this.defaultSettingsRawResource });
|
||||
}
|
||||
|
||||
openRawUserSettings(): Promise<IEditor | null> {
|
||||
openRawUserSettings(): Promise<IEditor | undefined> {
|
||||
return this.editorService.openEditor({ resource: this.userSettingsResource });
|
||||
}
|
||||
|
||||
openSettings(jsonEditor: boolean | undefined, query: string | undefined): Promise<IEditor | null> {
|
||||
openSettings(jsonEditor: boolean | undefined, query: string | undefined): Promise<IEditor | undefined> {
|
||||
jsonEditor = typeof jsonEditor === 'undefined' ?
|
||||
this.configurationService.getValue('workbench.settings.editor') === 'json' :
|
||||
jsonEditor;
|
||||
@@ -217,7 +218,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
.then(() => this.editorGroupService.activeGroup.activeControl!);
|
||||
}
|
||||
|
||||
openGlobalSettings(jsonEditor?: boolean, options?: ISettingsEditorOptions, group?: IEditorGroup): Promise<IEditor | null> {
|
||||
openGlobalSettings(jsonEditor?: boolean, options?: ISettingsEditorOptions, group?: IEditorGroup): Promise<IEditor | undefined> {
|
||||
jsonEditor = typeof jsonEditor === 'undefined' ?
|
||||
this.configurationService.getValue('workbench.settings.editor') === 'json' :
|
||||
jsonEditor;
|
||||
@@ -227,16 +228,16 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
this.openOrSwitchSettings2(ConfigurationTarget.USER_LOCAL, undefined, options, group);
|
||||
}
|
||||
|
||||
async openRemoteSettings(): Promise<IEditor | null> {
|
||||
async openRemoteSettings(): Promise<IEditor | undefined> {
|
||||
const environment = await this.remoteAgentService.getEnvironment();
|
||||
if (environment) {
|
||||
await this.createIfNotExists(environment.settingsPath, emptyEditableSettingsContent);
|
||||
return this.editorService.openEditor({ resource: environment.settingsPath, options: { pinned: true, revealIfOpened: true } });
|
||||
}
|
||||
return null;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
openWorkspaceSettings(jsonEditor?: boolean, options?: ISettingsEditorOptions, group?: IEditorGroup): Promise<IEditor | null> {
|
||||
openWorkspaceSettings(jsonEditor?: boolean, options?: ISettingsEditorOptions, group?: IEditorGroup): Promise<IEditor | undefined> {
|
||||
jsonEditor = typeof jsonEditor === 'undefined' ?
|
||||
this.configurationService.getValue('workbench.settings.editor') === 'json' :
|
||||
jsonEditor;
|
||||
@@ -251,7 +252,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
this.openOrSwitchSettings2(ConfigurationTarget.WORKSPACE, undefined, options, group);
|
||||
}
|
||||
|
||||
async openFolderSettings(folder: URI, jsonEditor?: boolean, options?: ISettingsEditorOptions, group?: IEditorGroup): Promise<IEditor | null> {
|
||||
async openFolderSettings(folder: URI, jsonEditor?: boolean, options?: ISettingsEditorOptions, group?: IEditorGroup): Promise<IEditor | undefined> {
|
||||
jsonEditor = typeof jsonEditor === 'undefined' ?
|
||||
this.configurationService.getValue('workbench.settings.editor') === 'json' :
|
||||
jsonEditor;
|
||||
@@ -306,7 +307,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
return this.editorService.openEditor(this.instantiationService.createInstance(KeybindingsEditorInput), { pinned: true, revealIfOpened: true }).then(() => undefined);
|
||||
}
|
||||
|
||||
openDefaultKeybindingsFile(): Promise<IEditor | null> {
|
||||
openDefaultKeybindingsFile(): Promise<IEditor | undefined> {
|
||||
return this.editorService.openEditor({ resource: this.defaultKeybindingsResource, label: nls.localize('defaultKeybindings', "Default Keybindings") });
|
||||
}
|
||||
|
||||
@@ -328,7 +329,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
}));
|
||||
}
|
||||
|
||||
private openOrSwitchSettings(configurationTarget: ConfigurationTarget, resource: URI, options?: ISettingsEditorOptions, group: IEditorGroup = this.editorGroupService.activeGroup): Promise<IEditor | null> {
|
||||
private openOrSwitchSettings(configurationTarget: ConfigurationTarget, resource: URI, options?: ISettingsEditorOptions, group: IEditorGroup = this.editorGroupService.activeGroup): Promise<IEditor | undefined> {
|
||||
const editorInput = this.getActiveSettingsEditorInput(group);
|
||||
if (editorInput) {
|
||||
const editorInputResource = editorInput.master.getResource();
|
||||
@@ -339,11 +340,11 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
return this.doOpenSettings(configurationTarget, resource, options, group);
|
||||
}
|
||||
|
||||
private openOrSwitchSettings2(configurationTarget: ConfigurationTarget, folderUri?: URI, options?: ISettingsEditorOptions, group: IEditorGroup = this.editorGroupService.activeGroup): Promise<IEditor | null> {
|
||||
private openOrSwitchSettings2(configurationTarget: ConfigurationTarget, folderUri?: URI, options?: ISettingsEditorOptions, group: IEditorGroup = this.editorGroupService.activeGroup): Promise<IEditor | undefined> {
|
||||
return this.doOpenSettings2(configurationTarget, folderUri, options, group);
|
||||
}
|
||||
|
||||
private doOpenSettings(configurationTarget: ConfigurationTarget, resource: URI, options?: ISettingsEditorOptions, group?: IEditorGroup): Promise<IEditor | null> {
|
||||
private doOpenSettings(configurationTarget: ConfigurationTarget, resource: URI, options?: ISettingsEditorOptions, group?: IEditorGroup): Promise<IEditor | undefined> {
|
||||
const openSplitJSON = !!this.configurationService.getValue(USE_SPLIT_JSON_SETTING);
|
||||
if (openSplitJSON) {
|
||||
return this.doOpenSplitJSON(configurationTarget, resource, options, group);
|
||||
@@ -365,14 +366,14 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
return Promise.all([
|
||||
this.editorService.openEditor({ resource: this.defaultSettingsRawResource, options: { pinned: true, preserveFocus: true, revealIfOpened: true }, label: nls.localize('defaultSettings', "Default Settings"), description: '' }),
|
||||
this.editorService.openEditor(editableSettingsEditorInput, { pinned: true, revealIfOpened: true }, sideEditorGroup.id)
|
||||
]).then(([defaultEditor, editor]) => editor);
|
||||
]).then(([defaultEditor, editor]) => withNullAsUndefined(editor));
|
||||
} else {
|
||||
return this.editorService.openEditor(editableSettingsEditorInput, SettingsEditorOptions.create(options), group);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private doOpenSplitJSON(configurationTarget: ConfigurationTarget, resource: URI, options?: ISettingsEditorOptions, group?: IEditorGroup): Promise<IEditor | null> {
|
||||
private doOpenSplitJSON(configurationTarget: ConfigurationTarget, resource: URI, options?: ISettingsEditorOptions, group?: IEditorGroup): Promise<IEditor | undefined> {
|
||||
return this.getOrCreateEditableSettingsEditorInput(configurationTarget, resource)
|
||||
.then(editableSettingsEditorInput => {
|
||||
if (!options) {
|
||||
@@ -392,7 +393,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
return this.instantiationService.createInstance(Settings2EditorModel, this.getDefaultSettings(ConfigurationTarget.USER_LOCAL));
|
||||
}
|
||||
|
||||
private doOpenSettings2(target: ConfigurationTarget, folderUri: URI | undefined, options?: IEditorOptions, group?: IEditorGroup): Promise<IEditor | null> {
|
||||
private doOpenSettings2(target: ConfigurationTarget, folderUri: URI | undefined, options?: IEditorOptions, group?: IEditorGroup): Promise<IEditor | undefined> {
|
||||
const input = this.settingsEditor2Input;
|
||||
const settingsOptions: ISettingsEditorOptions = {
|
||||
...options,
|
||||
@@ -633,4 +634,4 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IPreferencesService, PreferencesService);
|
||||
registerSingleton(IPreferencesService, PreferencesService);
|
||||
|
||||
Reference in New Issue
Block a user