mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-31 01:00:29 -04:00
Merge from vscode 4636be2b71c87bfb0bfe3c94278b447a5efcc1f1 (#8722)
* Merge from vscode 4636be2b71c87bfb0bfe3c94278b447a5efcc1f1 * remove tests that aren't working
This commit is contained in:
@@ -87,6 +87,20 @@ interface ISerializedPreferencesEditorInput {
|
||||
// Register Preferences Editor Input Factory
|
||||
class PreferencesEditorInputFactory implements IEditorInputFactory {
|
||||
|
||||
canSerialize(editorInput: EditorInput): boolean {
|
||||
const input = <PreferencesEditorInput>editorInput;
|
||||
|
||||
if (input.details && input.master) {
|
||||
const registry = Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories);
|
||||
const detailsInputFactory = registry.getEditorInputFactory(input.details.getTypeId());
|
||||
const masterInputFactory = registry.getEditorInputFactory(input.master.getTypeId());
|
||||
|
||||
return !!(detailsInputFactory?.canSerialize(input.details) && masterInputFactory?.canSerialize(input.master));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
serialize(editorInput: EditorInput): string | undefined {
|
||||
const input = <PreferencesEditorInput>editorInput;
|
||||
|
||||
@@ -137,6 +151,10 @@ class PreferencesEditorInputFactory implements IEditorInputFactory {
|
||||
|
||||
class KeybindingsEditorInputFactory implements IEditorInputFactory {
|
||||
|
||||
canSerialize(editorInput: EditorInput): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
serialize(editorInput: EditorInput): string {
|
||||
const input = <KeybindingsEditorInput>editorInput;
|
||||
return JSON.stringify({
|
||||
@@ -150,21 +168,18 @@ class KeybindingsEditorInputFactory implements IEditorInputFactory {
|
||||
}
|
||||
}
|
||||
|
||||
interface ISerializedSettingsEditor2EditorInput {
|
||||
}
|
||||
|
||||
class SettingsEditor2InputFactory implements IEditorInputFactory {
|
||||
|
||||
serialize(input: SettingsEditor2Input): string {
|
||||
const serialized: ISerializedSettingsEditor2EditorInput = {
|
||||
};
|
||||
canSerialize(editorInput: EditorInput): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
return JSON.stringify(serialized);
|
||||
serialize(input: SettingsEditor2Input): string {
|
||||
return '{}';
|
||||
}
|
||||
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): SettingsEditor2Input {
|
||||
return instantiationService.createInstance(
|
||||
SettingsEditor2Input);
|
||||
return instantiationService.createInstance(SettingsEditor2Input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +190,10 @@ interface ISerializedDefaultPreferencesEditorInput {
|
||||
// Register Default Preferences Editor Input Factory
|
||||
class DefaultPreferencesEditorInputFactory implements IEditorInputFactory {
|
||||
|
||||
canSerialize(editorInput: EditorInput): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
serialize(editorInput: EditorInput): string {
|
||||
const input = <DefaultPreferencesEditorInput>editorInput;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import { EditorExtensionsRegistry, registerEditorContribution, IEditorContributi
|
||||
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
|
||||
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import { IResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { FindController } from 'vs/editor/contrib/find/findController';
|
||||
import { FoldingController } from 'vs/editor/contrib/folding/folding';
|
||||
import { MessageController } from 'vs/editor/contrib/message/messageController';
|
||||
@@ -973,7 +973,7 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@IStorageService storageService: IStorageService,
|
||||
@IResourceConfigurationService configurationService: IResourceConfigurationService,
|
||||
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IEditorGroupsService editorGroupService: IEditorGroupsService,
|
||||
@IEditorService editorService: IEditorService
|
||||
|
||||
@@ -772,7 +772,7 @@ class EditSettingRenderer extends Disposable {
|
||||
if ((<SettingsEditorModel>this.masterSettingsModel).configurationTarget !== ConfigurationTarget.WORKSPACE_FOLDER) {
|
||||
return true;
|
||||
}
|
||||
if (configurationNode.scope === ConfigurationScope.RESOURCE) {
|
||||
if (configurationNode.scope === ConfigurationScope.RESOURCE || configurationNode.scope === ConfigurationScope.RESOURCE_LANGUAGE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -807,7 +807,7 @@ export class SettingsEditor2 extends BaseEditor {
|
||||
|
||||
// If the user is changing the value back to the default, do a 'reset' instead
|
||||
const inspected = this.configurationService.inspect(key, overrides);
|
||||
if (inspected.default === value) {
|
||||
if (inspected.defaultValue === value) {
|
||||
value = undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -155,23 +155,23 @@ export class SettingsTreeSettingElement extends SettingsTreeElement {
|
||||
update(inspectResult: IInspectResult): void {
|
||||
const { isConfigured, inspected, targetSelector } = inspectResult;
|
||||
|
||||
const displayValue = isConfigured ? inspected[targetSelector] : inspected.default;
|
||||
const displayValue = isConfigured ? inspected[targetSelector] : inspected.defaultValue;
|
||||
const overriddenScopeList: string[] = [];
|
||||
if (targetSelector !== 'workspace' && typeof inspected.workspace !== 'undefined') {
|
||||
if (targetSelector !== 'workspaceValue' && typeof inspected.workspaceValue !== 'undefined') {
|
||||
overriddenScopeList.push(localize('workspace', "Workspace"));
|
||||
}
|
||||
|
||||
if (targetSelector !== 'userRemote' && typeof inspected.userRemote !== 'undefined') {
|
||||
if (targetSelector !== 'userRemoteValue' && typeof inspected.userRemoteValue !== 'undefined') {
|
||||
overriddenScopeList.push(localize('remote', "Remote"));
|
||||
}
|
||||
|
||||
if (targetSelector !== 'userLocal' && typeof inspected.userLocal !== 'undefined') {
|
||||
if (targetSelector !== 'userLocalValue' && typeof inspected.userLocalValue !== 'undefined') {
|
||||
overriddenScopeList.push(localize('user', "User"));
|
||||
}
|
||||
|
||||
this.value = displayValue;
|
||||
this.scopeValue = isConfigured && inspected[targetSelector];
|
||||
this.defaultValue = inspected.default;
|
||||
this.defaultValue = inspected.defaultValue;
|
||||
|
||||
this.isConfigured = isConfigured;
|
||||
if (isConfigured || this.setting.tags || this.tags) {
|
||||
@@ -375,16 +375,16 @@ export class SettingsTreeModel {
|
||||
interface IInspectResult {
|
||||
isConfigured: boolean;
|
||||
inspected: IConfigurationValue<any>;
|
||||
targetSelector: 'userLocal' | 'userRemote' | 'workspace' | 'workspaceFolder';
|
||||
targetSelector: 'userLocalValue' | 'userRemoteValue' | 'workspaceValue' | 'workspaceFolderValue';
|
||||
}
|
||||
|
||||
function inspectSetting(key: string, target: SettingsTarget, configurationService: IConfigurationService): IInspectResult {
|
||||
const inspectOverrides = URI.isUri(target) ? { resource: target } : undefined;
|
||||
const inspected = configurationService.inspect(key, inspectOverrides);
|
||||
const targetSelector = target === ConfigurationTarget.USER_LOCAL ? 'userLocal' :
|
||||
target === ConfigurationTarget.USER_REMOTE ? 'userRemote' :
|
||||
target === ConfigurationTarget.WORKSPACE ? 'workspace' :
|
||||
'workspaceFolder';
|
||||
const targetSelector = target === ConfigurationTarget.USER_LOCAL ? 'userLocalValue' :
|
||||
target === ConfigurationTarget.USER_REMOTE ? 'userRemoteValue' :
|
||||
target === ConfigurationTarget.WORKSPACE ? 'workspaceValue' :
|
||||
'workspaceFolderValue';
|
||||
const isConfigured = typeof inspected[targetSelector] !== 'undefined';
|
||||
|
||||
return { isConfigured, inspected, targetSelector };
|
||||
|
||||
Reference in New Issue
Block a user