mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 777931080477e28b7c27e8f7d4b0d69897945946 (#9220)
This commit is contained in:
@@ -26,7 +26,7 @@ import { IResolvedTextEditorModel, ITextModelContentProvider, ITextModelService
|
||||
import { ITextResourceConfigurationService, ITextResourcePropertiesService, ITextResourceConfigurationChangeEvent } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { CommandsRegistry, ICommand, ICommandEvent, ICommandHandler, ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IConfigurationChangeEvent, IConfigurationData, IConfigurationOverrides, IConfigurationService, IConfigurationModel, IConfigurationValue, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { Configuration, ConfigurationModel, DefaultConfigurationModel } from 'vs/platform/configuration/common/configurationModels';
|
||||
import { Configuration, ConfigurationModel, DefaultConfigurationModel, ConfigurationChangeEvent } from 'vs/platform/configuration/common/configurationModels';
|
||||
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IConfirmation, IConfirmationResult, IDialogOptions, IDialogService, IShowResult } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -448,10 +448,6 @@ export class SimpleConfigurationService implements IConfigurationService {
|
||||
this._configuration = new Configuration(new DefaultConfigurationModel(), new ConfigurationModel());
|
||||
}
|
||||
|
||||
private configuration(): Configuration {
|
||||
return this._configuration;
|
||||
}
|
||||
|
||||
getValue<T>(): T;
|
||||
getValue<T>(section: string): T;
|
||||
getValue<T>(overrides: IConfigurationOverrides): T;
|
||||
@@ -459,20 +455,43 @@ export class SimpleConfigurationService implements IConfigurationService {
|
||||
getValue(arg1?: any, arg2?: any): any {
|
||||
const section = typeof arg1 === 'string' ? arg1 : undefined;
|
||||
const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
|
||||
return this.configuration().getValue(section, overrides, undefined);
|
||||
return this._configuration.getValue(section, overrides, undefined);
|
||||
}
|
||||
|
||||
public updateValue(key: string, value: any, arg3?: any, arg4?: any): Promise<void> {
|
||||
this.configuration().updateValue(key, value);
|
||||
public updateValues(values: [string, any][]): Promise<void> {
|
||||
const previous = { data: this._configuration.toData() };
|
||||
|
||||
let changedKeys: string[] = [];
|
||||
|
||||
for (const entry of values) {
|
||||
const [key, value] = entry;
|
||||
if (this.getValue(key) === value) {
|
||||
continue;
|
||||
}
|
||||
this._configuration.updateValue(key, value);
|
||||
changedKeys.push(key);
|
||||
}
|
||||
|
||||
if (changedKeys.length > 0) {
|
||||
const configurationChangeEvent = new ConfigurationChangeEvent({ keys: changedKeys, overrides: [] }, previous, this._configuration);
|
||||
configurationChangeEvent.source = ConfigurationTarget.MEMORY;
|
||||
configurationChangeEvent.sourceConfig = null;
|
||||
this._onDidChangeConfiguration.fire(configurationChangeEvent);
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public updateValue(key: string, value: any, arg3?: any, arg4?: any): Promise<void> {
|
||||
return this.updateValues([[key, value]]);
|
||||
}
|
||||
|
||||
public inspect<C>(key: string, options: IConfigurationOverrides = {}): IConfigurationValue<C> {
|
||||
return this.configuration().inspect<C>(key, options, undefined);
|
||||
return this._configuration.inspect<C>(key, options, undefined);
|
||||
}
|
||||
|
||||
public keys() {
|
||||
return this.configuration().keys(undefined);
|
||||
return this._configuration.keys(undefined);
|
||||
}
|
||||
|
||||
public reloadConfiguration(): Promise<void> {
|
||||
@@ -622,14 +641,18 @@ export function applyConfigurationValues(configurationService: IConfigurationSer
|
||||
if (!(configurationService instanceof SimpleConfigurationService)) {
|
||||
return;
|
||||
}
|
||||
let toUpdate: [string, any][] = [];
|
||||
Object.keys(source).forEach((key) => {
|
||||
if (isEditorConfigurationKey(key)) {
|
||||
configurationService.updateValue(`editor.${key}`, source[key]);
|
||||
toUpdate.push([`editor.${key}`, source[key]]);
|
||||
}
|
||||
if (isDiffEditor && isDiffEditorConfigurationKey(key)) {
|
||||
configurationService.updateValue(`diffEditor.${key}`, source[key]);
|
||||
toUpdate.push([`diffEditor.${key}`, source[key]]);
|
||||
}
|
||||
});
|
||||
if (toUpdate.length > 0) {
|
||||
configurationService.updateValues(toUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
export class SimpleBulkEditService implements IBulkEditService {
|
||||
|
||||
@@ -23,7 +23,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
||||
import { ContextKeyExpr, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { ContextViewService } from 'vs/platform/contextview/browser/contextViewService';
|
||||
import { IInstantiationService, optional, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
@@ -114,6 +114,11 @@ export interface IGlobalEditorOptions {
|
||||
* Defaults to true.
|
||||
*/
|
||||
wordBasedSuggestions?: boolean;
|
||||
/**
|
||||
* Controls whether the semanticHighlighting is shown for the languages that support it.
|
||||
* Defaults to true.
|
||||
*/
|
||||
'semanticHighlighting.enabled'?: boolean;
|
||||
/**
|
||||
* Keep peek editors open even when double clicking their content or when hitting `Escape`.
|
||||
* Defaults to false.
|
||||
@@ -443,7 +448,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@IEditorProgressService editorProgressService: IEditorProgressService,
|
||||
@optional(IClipboardService) clipboardService: IClipboardService | null,
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
) {
|
||||
applyConfigurationValues(configurationService, options, true);
|
||||
const themeDomRegistration = (<StandaloneThemeServiceImpl>themeService).registerEditorContainer(domElement);
|
||||
|
||||
@@ -39,6 +39,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
|
||||
import { clearAllFontInfos } from 'vs/editor/browser/config/configuration';
|
||||
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
|
||||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
@@ -122,7 +123,7 @@ export function createDiffEditor(domElement: HTMLElement, options?: IDiffEditorC
|
||||
services.get(IConfigurationService),
|
||||
services.get(IContextMenuService),
|
||||
services.get(IEditorProgressService),
|
||||
null
|
||||
services.get(IClipboardService)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,6 +48,8 @@ import { IAccessibilityService } from 'vs/platform/accessibility/common/accessib
|
||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||
import { getSingletonServiceDescriptors } from 'vs/platform/instantiation/common/extensions';
|
||||
import { AccessibilityService } from 'vs/platform/accessibility/common/accessibilityService';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { BrowserClipboardService } from 'vs/platform/clipboard/browser/clipboardService';
|
||||
|
||||
export interface IEditorOverrideServices {
|
||||
[index: string]: any;
|
||||
@@ -204,6 +206,8 @@ export class DynamicStandaloneServices extends Disposable {
|
||||
|
||||
let contextViewService = ensure(IContextViewService, () => this._register(new ContextViewService(layoutService)));
|
||||
|
||||
ensure(IClipboardService, () => new BrowserClipboardService());
|
||||
|
||||
ensure(IContextMenuService, () => {
|
||||
const contextMenuService = new ContextMenuService(telemetryService, notificationService, contextViewService, keybindingService, themeService);
|
||||
contextMenuService.configure({ blockMouse: false }); // we do not want that in the standalone editor
|
||||
|
||||
Reference in New Issue
Block a user