mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-31 17:20:28 -04:00
Merge from vscode 2b87545500dbc7899a493d69199aa4e061414ea0 (#5148)
This commit is contained in:
@@ -12,8 +12,8 @@ import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configur
|
||||
import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { SettingsTarget } from 'vs/workbench/contrib/preferences/browser/preferencesWidgets';
|
||||
import { ITOCEntry, knownAcronyms } from 'vs/workbench/contrib/preferences/browser/settingsLayout';
|
||||
import { IExtensionSetting, ISearchResult, ISetting, SettingValueType } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { MODIFIED_SETTING_TAG } from 'vs/workbench/contrib/preferences/common/preferences';
|
||||
import { IExtensionSetting, ISearchResult, ISetting, SettingValueType } from 'vs/workbench/services/preferences/common/preferences';
|
||||
|
||||
export const ONLINE_SERVICES_SETTING_TAG = 'usesOnlineServices';
|
||||
|
||||
@@ -142,11 +142,15 @@ export class SettingsTreeSettingElement extends SettingsTreeElement {
|
||||
|
||||
const displayValue = isConfigured ? inspected[targetSelector] : inspected.default;
|
||||
const overriddenScopeList: string[] = [];
|
||||
if (targetSelector === 'user' && typeof inspected.workspace !== 'undefined') {
|
||||
if (targetSelector !== 'workspace' && typeof inspected.workspace !== 'undefined') {
|
||||
overriddenScopeList.push(localize('workspace', "Workspace"));
|
||||
}
|
||||
|
||||
if (targetSelector === 'workspace' && typeof inspected.user !== 'undefined') {
|
||||
if (targetSelector !== 'userRemote' && typeof inspected.userRemote !== 'undefined') {
|
||||
overriddenScopeList.push(localize('remote', "Remote"));
|
||||
}
|
||||
|
||||
if (targetSelector !== 'userLocal' && typeof inspected.userLocal !== 'undefined') {
|
||||
overriddenScopeList.push(localize('user', "User"));
|
||||
}
|
||||
|
||||
@@ -354,8 +358,17 @@ export class SettingsTreeModel {
|
||||
|
||||
interface IInspectResult {
|
||||
isConfigured: boolean;
|
||||
inspected: any;
|
||||
targetSelector: string;
|
||||
inspected: {
|
||||
default: any,
|
||||
user: any,
|
||||
userLocal?: any,
|
||||
userRemote?: any,
|
||||
workspace?: any,
|
||||
workspaceFolder?: any,
|
||||
memory?: any,
|
||||
value: any,
|
||||
};
|
||||
targetSelector: 'userLocal' | 'userRemote' | 'workspace' | 'workspaceFolder';
|
||||
}
|
||||
|
||||
function inspectSetting(key: string, target: SettingsTarget, configurationService: IConfigurationService): IInspectResult {
|
||||
|
||||
@@ -16,7 +16,7 @@ import { isArray, withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import 'vs/css!./media/settingsEditor2';
|
||||
import { localize } from 'vs/nls';
|
||||
import { ConfigurationTarget, ConfigurationTargetToString, IConfigurationOverrides, IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ConfigurationTarget, IConfigurationOverrides, IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
@@ -36,7 +36,7 @@ import { AbstractSettingRenderer, ISettingLinkClickEvent, ISettingOverrideClickE
|
||||
import { ISettingsEditorViewState, parseQuery, SearchResultIdx, SearchResultModel, SettingsTreeElement, SettingsTreeGroupChild, SettingsTreeGroupElement, SettingsTreeModel, SettingsTreeSettingElement } from 'vs/workbench/contrib/preferences/browser/settingsTreeModels';
|
||||
import { settingsTextInputBorder } from 'vs/workbench/contrib/preferences/browser/settingsWidgets';
|
||||
import { createTOCIterator, TOCTree, TOCTreeModel } from 'vs/workbench/contrib/preferences/browser/tocTree';
|
||||
import { CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_SEARCH_FOCUS, CONTEXT_TOC_ROW_FOCUS, IPreferencesSearchService, ISearchProvider, MODIFIED_SETTING_TAG, EXTENSION_SETTING_TAG, SETTINGS_EDITOR_COMMAND_SHOW_CONTEXT_MENU } from 'vs/workbench/contrib/preferences/common/preferences';
|
||||
import { CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_SEARCH_FOCUS, CONTEXT_TOC_ROW_FOCUS, EXTENSION_SETTING_TAG, IPreferencesSearchService, ISearchProvider, MODIFIED_SETTING_TAG, SETTINGS_EDITOR_COMMAND_SHOW_CONTEXT_MENU } from 'vs/workbench/contrib/preferences/common/preferences';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IPreferencesService, ISearchResult, ISettingsEditorModel, ISettingsEditorOptions, SettingsEditorOptions, SettingValueType } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
|
||||
@@ -210,23 +210,23 @@ export class SettingsEditor2 extends BaseEditor {
|
||||
return super.setInput(input, options, token)
|
||||
.then(() => new Promise(process.nextTick)) // Force setInput to be async
|
||||
.then(() => {
|
||||
if (!options) {
|
||||
if (!this.viewState.settingsTarget) {
|
||||
// Persist?
|
||||
return this.render(token);
|
||||
})
|
||||
.then(() => {
|
||||
if (!this.viewState.settingsTarget) {
|
||||
if (!options) {
|
||||
options = SettingsEditorOptions.create({ target: ConfigurationTarget.USER_LOCAL });
|
||||
} else if (!options.target) {
|
||||
options.target = ConfigurationTarget.USER_LOCAL;
|
||||
}
|
||||
} else if (!options.target) {
|
||||
options.target = ConfigurationTarget.USER_LOCAL;
|
||||
}
|
||||
|
||||
this._setOptions(options);
|
||||
|
||||
this._register(input.onDispose(() => {
|
||||
this.searchWidget.setValue('');
|
||||
}));
|
||||
|
||||
return this.render(token);
|
||||
})
|
||||
.then(() => {
|
||||
// Init TOC selection
|
||||
this.updateTreeScrollSync();
|
||||
|
||||
@@ -255,17 +255,15 @@ export class SettingsEditor2 extends BaseEditor {
|
||||
}
|
||||
|
||||
private _setOptions(options: SettingsEditorOptions): void {
|
||||
if (!options) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.query) {
|
||||
this.searchWidget.setValue(options.query);
|
||||
}
|
||||
|
||||
const target: SettingsTarget = options.folderUri || <SettingsTarget>options.target;
|
||||
this.settingsTargetsWidget.settingsTarget = target;
|
||||
this.viewState.settingsTarget = target;
|
||||
if (target) {
|
||||
this.settingsTargetsWidget.settingsTarget = target;
|
||||
this.viewState.settingsTarget = target;
|
||||
}
|
||||
}
|
||||
|
||||
clearInput(): void {
|
||||
@@ -616,11 +614,11 @@ export class SettingsEditor2 extends BaseEditor {
|
||||
this.settingsTree.reveal(element);
|
||||
}));
|
||||
this._register(this.settingRenderers.onDidClickOverrideElement((element: ISettingOverrideClickEvent) => {
|
||||
if (ConfigurationTargetToString(ConfigurationTarget.WORKSPACE) === element.scope.toUpperCase()) {
|
||||
if (element.scope.toLowerCase() === 'workspace') {
|
||||
this.settingsTargetsWidget.updateTarget(ConfigurationTarget.WORKSPACE);
|
||||
} else if (ConfigurationTargetToString(ConfigurationTarget.USER_LOCAL) === element.scope.toUpperCase()) {
|
||||
} else if (element.scope.toLowerCase() === 'user') {
|
||||
this.settingsTargetsWidget.updateTarget(ConfigurationTarget.USER_LOCAL);
|
||||
} else if (ConfigurationTargetToString(ConfigurationTarget.USER_REMOTE) === element.scope.toUpperCase()) {
|
||||
} else if (element.scope.toLowerCase() === 'remote') {
|
||||
this.settingsTargetsWidget.updateTarget(ConfigurationTarget.USER_REMOTE);
|
||||
}
|
||||
|
||||
@@ -1219,11 +1217,14 @@ export class SettingsEditor2 extends BaseEditor {
|
||||
}
|
||||
|
||||
private renderResultCountMessages() {
|
||||
if (!this.currentSettingsModel || !this.searchResultModel) {
|
||||
this.countElement.style.display = 'none';
|
||||
if (!this.currentSettingsModel) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.searchResultModel) {
|
||||
this.countElement.style.display = 'none';
|
||||
}
|
||||
|
||||
if (this.tocTreeModel && this.tocTreeModel.settingsTreeRoot) {
|
||||
const count = this.tocTreeModel.settingsTreeRoot.count;
|
||||
switch (count) {
|
||||
|
||||
Reference in New Issue
Block a user