mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-30 00:30:29 -04:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -8,7 +8,7 @@ import * as nls from 'vs/nls';
|
||||
import { OS } from 'vs/base/common/platform';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel';
|
||||
import { Widget } from 'vs/base/browser/ui/widget';
|
||||
import { ResolvedKeybinding, KeyCode } from 'vs/base/common/keyCodes';
|
||||
@@ -17,7 +17,6 @@ import { InputBox, IInputOptions } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { Dimension } from 'vs/base/browser/builder';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition } from 'vs/editor/browser/editorBrowser';
|
||||
@@ -189,7 +188,7 @@ export class DefineKeybindingWidget extends Widget {
|
||||
});
|
||||
}
|
||||
|
||||
layout(layout: Dimension): void {
|
||||
layout(layout: dom.Dimension): void {
|
||||
let top = Math.round((layout.height - DefineKeybindingWidget.HEIGHT) / 2);
|
||||
this._domNode.setTop(top);
|
||||
|
||||
@@ -206,7 +205,11 @@ export class DefineKeybindingWidget extends Widget {
|
||||
dom.append(this._domNode.domNode, dom.$('.message', null, nls.localize('defineKeybinding.initial', "Press desired key combination and then press ENTER.")));
|
||||
|
||||
this._register(attachStylerCallback(this.themeService, { editorWidgetBackground, widgetShadow }, colors => {
|
||||
this._domNode.domNode.style.backgroundColor = colors.editorWidgetBackground;
|
||||
if (colors.editorWidgetBackground) {
|
||||
this._domNode.domNode.style.backgroundColor = colors.editorWidgetBackground.toString();
|
||||
} else {
|
||||
this._domNode.domNode.style.backgroundColor = null;
|
||||
}
|
||||
|
||||
if (colors.widgetShadow) {
|
||||
this._domNode.domNode.style.boxShadow = `0 2px 8px ${colors.widgetShadow}`;
|
||||
@@ -286,7 +289,7 @@ export class DefineKeybindingOverlayWidget extends Disposable implements IOverla
|
||||
public start(): TPromise<string> {
|
||||
this._editor.revealPositionInCenterIfOutsideViewport(this._editor.getPosition(), ScrollType.Smooth);
|
||||
const layoutInfo = this._editor.getLayoutInfo();
|
||||
this._widget.layout(new Dimension(layoutInfo.width, layoutInfo.height));
|
||||
this._widget.layout(new dom.Dimension(layoutInfo.width, layoutInfo.height));
|
||||
return this._widget.define();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,23 +11,23 @@ import * as DOM from 'vs/base/browser/dom';
|
||||
import { OS } from 'vs/base/common/platform';
|
||||
import { dispose } from 'vs/base/common/lifecycle';
|
||||
import { Checkbox } from 'vs/base/browser/ui/checkbox/checkbox';
|
||||
import { Builder, Dimension } from 'vs/base/browser/builder';
|
||||
import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel';
|
||||
import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { ActionBar, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { EditorInput, EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { KeybindingsEditorModel, IKeybindingItemEntry, IListEntry, KEYBINDING_ENTRY_TEMPLATE_ID, KEYBINDING_HEADER_TEMPLATE_ID } from 'vs/workbench/parts/preferences/common/keybindingsEditorModel';
|
||||
import { KeybindingsEditorModel, IKeybindingItemEntry, IListEntry, KEYBINDING_ENTRY_TEMPLATE_ID, KEYBINDING_HEADER_TEMPLATE_ID } from 'vs/workbench/services/preferences/common/keybindingsEditorModel';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IKeybindingService, IUserFriendlyKeybinding } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { SearchWidget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';
|
||||
import { DefineKeybindingWidget } from 'vs/workbench/parts/preferences/browser/keybindingWidgets';
|
||||
import {
|
||||
IPreferencesService, IKeybindingsEditor, CONTEXT_KEYBINDING_FOCUS, CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS, KEYBINDINGS_EDITOR_COMMAND_REMOVE, KEYBINDINGS_EDITOR_COMMAND_COPY,
|
||||
KEYBINDINGS_EDITOR_COMMAND_RESET, KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND, KEYBINDINGS_EDITOR_COMMAND_DEFINE, KEYBINDINGS_EDITOR_COMMAND_SHOW_SIMILAR
|
||||
IKeybindingsEditor, CONTEXT_KEYBINDING_FOCUS, CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS, KEYBINDINGS_EDITOR_COMMAND_REMOVE, KEYBINDINGS_EDITOR_COMMAND_COPY,
|
||||
KEYBINDINGS_EDITOR_COMMAND_RESET, KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND, KEYBINDINGS_EDITOR_COMMAND_DEFINE, KEYBINDINGS_EDITOR_COMMAND_SHOW_SIMILAR, KEYBINDINGS_EDITOR_SHOW_DEFAULT_KEYBINDINGS,
|
||||
KEYBINDINGS_EDITOR_SHOW_USER_KEYBINDINGS
|
||||
} from 'vs/workbench/parts/preferences/common/preferences';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IKeybindingEditingService } from 'vs/workbench/services/keybinding/common/keybindingEditing';
|
||||
@@ -42,36 +42,11 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
|
||||
import { EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions';
|
||||
import { WorkbenchList } from 'vs/platform/list/browser/listService';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { KeybindingsEditorInput } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
|
||||
|
||||
let $ = DOM.$;
|
||||
|
||||
export class KeybindingsEditorInput extends EditorInput {
|
||||
|
||||
public static readonly ID: string = 'workbench.input.keybindings';
|
||||
public readonly keybindingsModel: KeybindingsEditorModel;
|
||||
|
||||
constructor( @IInstantiationService instantiationService: IInstantiationService) {
|
||||
super();
|
||||
this.keybindingsModel = instantiationService.createInstance(KeybindingsEditorModel, OS);
|
||||
}
|
||||
|
||||
getTypeId(): string {
|
||||
return KeybindingsEditorInput.ID;
|
||||
}
|
||||
|
||||
getName(): string {
|
||||
return localize('keybindingsInputName', "Keyboard Shortcuts");
|
||||
}
|
||||
|
||||
resolve(refresh?: boolean): TPromise<KeybindingsEditorModel> {
|
||||
return TPromise.as(this.keybindingsModel);
|
||||
}
|
||||
|
||||
matches(otherInput: any): boolean {
|
||||
return otherInput instanceof KeybindingsEditorInput;
|
||||
}
|
||||
}
|
||||
|
||||
export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor {
|
||||
|
||||
public static readonly ID: string = 'workbench.editor.keybindings';
|
||||
@@ -89,7 +64,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
|
||||
private listEntries: IListEntry[];
|
||||
private keybindingsList: List<IListEntry>;
|
||||
|
||||
private dimension: Dimension;
|
||||
private dimension: DOM.Dimension;
|
||||
private delayedFiltering: Delayer<void>;
|
||||
private latestEmptyFilters: string[] = [];
|
||||
private delayedFilterLogging: Delayer<void>;
|
||||
@@ -121,16 +96,14 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
|
||||
this.delayedFilterLogging = new Delayer<void>(1000);
|
||||
}
|
||||
|
||||
createEditor(parent: Builder): void {
|
||||
const parentElement = parent.getHTMLElement();
|
||||
|
||||
const keybindingsEditorElement = DOM.append(parentElement, $('div', { class: 'keybindings-editor' }));
|
||||
createEditor(parent: HTMLElement): void {
|
||||
const keybindingsEditorElement = DOM.append(parent, $('div', { class: 'keybindings-editor' }));
|
||||
|
||||
this.createOverlayContainer(keybindingsEditorElement);
|
||||
this.createHeader(keybindingsEditorElement);
|
||||
this.createBody(keybindingsEditorElement);
|
||||
|
||||
const focusTracker = this._register(DOM.trackFocus(parentElement));
|
||||
const focusTracker = this._register(DOM.trackFocus(parent));
|
||||
this._register(focusTracker.onDidFocus(() => this.keybindingsEditorContextKey.set(true)));
|
||||
this._register(focusTracker.onDidBlur(() => this.keybindingsEditorContextKey.reset()));
|
||||
}
|
||||
@@ -151,7 +124,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
|
||||
this.keybindingFocusContextKey.reset();
|
||||
}
|
||||
|
||||
layout(dimension: Dimension): void {
|
||||
layout(dimension: DOM.Dimension): void {
|
||||
this.dimension = dimension;
|
||||
this.searchWidget.layout(dimension);
|
||||
|
||||
@@ -176,6 +149,29 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
|
||||
return focusedElement && focusedElement.templateId === KEYBINDING_ENTRY_TEMPLATE_ID ? <IKeybindingItemEntry>focusedElement : null;
|
||||
}
|
||||
|
||||
getSecondaryActions(): IAction[] {
|
||||
return <IAction[]>[
|
||||
<IAction>{
|
||||
label: localize('showDefaultKeybindings', "Show Default Keybindings"),
|
||||
enabled: true,
|
||||
id: KEYBINDINGS_EDITOR_SHOW_DEFAULT_KEYBINDINGS,
|
||||
run: (): TPromise<any> => {
|
||||
this.searchWidget.setValue('@source:default');
|
||||
return TPromise.as(null);
|
||||
}
|
||||
},
|
||||
<IAction>{
|
||||
label: localize('showUserKeybindings', "Show User Keybindings"),
|
||||
enabled: true,
|
||||
id: KEYBINDINGS_EDITOR_SHOW_USER_KEYBINDINGS,
|
||||
run: (): TPromise<any> => {
|
||||
this.searchWidget.setValue('@source:user');
|
||||
return TPromise.as(null);
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
defineKeybinding(keybindingEntry: IKeybindingItemEntry): TPromise<any> {
|
||||
this.selectEntry(keybindingEntry);
|
||||
this.showOverlayContainer();
|
||||
@@ -210,10 +206,10 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
|
||||
this.reportKeybindingAction(KEYBINDINGS_EDITOR_COMMAND_REMOVE, keybindingEntry.keybindingItem.command, keybindingEntry.keybindingItem.keybinding);
|
||||
return this.keybindingEditingService.removeKeybinding(keybindingEntry.keybindingItem.keybindingItem)
|
||||
.then(() => this.focus(),
|
||||
error => {
|
||||
this.onKeybindingEditingError(error);
|
||||
this.selectEntry(keybindingEntry);
|
||||
});
|
||||
error => {
|
||||
this.onKeybindingEditingError(error);
|
||||
this.selectEntry(keybindingEntry);
|
||||
});
|
||||
}
|
||||
return TPromise.as(null);
|
||||
}
|
||||
@@ -228,10 +224,10 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
|
||||
}
|
||||
this.selectEntry(keybindingEntry);
|
||||
},
|
||||
error => {
|
||||
this.onKeybindingEditingError(error);
|
||||
this.selectEntry(keybindingEntry);
|
||||
});
|
||||
error => {
|
||||
this.onKeybindingEditingError(error);
|
||||
this.selectEntry(keybindingEntry);
|
||||
});
|
||||
}
|
||||
|
||||
copyKeybinding(keybinding: IKeybindingItemEntry): TPromise<any> {
|
||||
|
||||
@@ -364,7 +364,7 @@ class DefineKeybindingCommand extends EditorCommand {
|
||||
id: DefineKeybindingCommand.ID,
|
||||
precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.languageId.isEqualTo('jsonc')),
|
||||
kbOpts: {
|
||||
kbExpr: EditorContextKeys.textFocus,
|
||||
kbExpr: EditorContextKeys.editorTextFocus,
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_K)
|
||||
}
|
||||
});
|
||||
|
||||
@@ -48,10 +48,14 @@
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.settings-tabs-widget > .monaco-action-bar .action-item .action-label:not([aria-haspopup]) {
|
||||
.settings-tabs-widget > .monaco-action-bar .action-item .action-label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.settings-tabs-widget > .monaco-action-bar .action-item .action-label.folder-settings {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.settings-tabs-widget > .monaco-action-bar .actions-container {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
@@ -213,7 +217,6 @@
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Action } from 'vs/base/common/actions';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IQuickOpenService, IPickOpenEntry, IFilePickOpenEntry } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences';
|
||||
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { IWorkspaceContextService, WorkbenchState, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { PICK_WORKSPACE_FOLDER_COMMAND_ID } from 'vs/workbench/browser/actions/workspaceCommands';
|
||||
@@ -34,6 +34,24 @@ export class OpenRawDefaultSettingsAction extends Action {
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenSettingsAction extends Action {
|
||||
|
||||
public static readonly ID = 'workbench.action.openSettings';
|
||||
public static readonly LABEL = nls.localize('openSettings', "Open Settings");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IPreferencesService private preferencesService: IPreferencesService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(event?: any): TPromise<any> {
|
||||
return this.preferencesService.openSettings();
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenGlobalSettingsAction extends Action {
|
||||
|
||||
public static readonly ID = 'workbench.action.openGlobalSettings';
|
||||
|
||||
@@ -11,24 +11,25 @@ import { onUnexpectedError, isPromiseCanceledError, getErrorMessage } from 'vs/b
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { Delayer, ThrottledDelayer } from 'vs/base/common/async';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
import { Dimension, Builder } from 'vs/base/browser/builder';
|
||||
import { ArrayNavigator } from 'vs/base/common/iterator';
|
||||
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { SideBySideEditorInput, EditorOptions, EditorInput, PREFERENCES_EDITOR_ID } from 'vs/workbench/common/editor';
|
||||
import { EditorOptions, EditorInput } from 'vs/workbench/common/editor';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
|
||||
import { IEditorControl, Position, Verbosity } from 'vs/platform/editor/common/editor';
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { IEditorControl, Position } from 'vs/platform/editor/common/editor';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
|
||||
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import {
|
||||
IPreferencesService, ISettingsGroup, ISetting, IFilterResult, IPreferencesSearchService,
|
||||
CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_SEARCH_FOCUS, SETTINGS_EDITOR_COMMAND_SEARCH, SETTINGS_EDITOR_COMMAND_FOCUS_FILE, ISettingsEditorModel, SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING, SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING, ISearchProvider, ISearchResult, SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING
|
||||
IPreferencesSearchService,
|
||||
CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_SEARCH_FOCUS, SETTINGS_EDITOR_COMMAND_SEARCH, SETTINGS_EDITOR_COMMAND_FOCUS_FILE, SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING, SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING, ISearchProvider, SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING
|
||||
} from 'vs/workbench/parts/preferences/common/preferences';
|
||||
import { SettingsEditorModel, DefaultSettingsEditorModel } from 'vs/workbench/parts/preferences/common/preferencesModels';
|
||||
import {
|
||||
IPreferencesService, ISettingsGroup, ISetting, IFilterResult, ISettingsEditorModel, ISearchResult
|
||||
} from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { SettingsEditorModel, DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { SearchWidget, SettingsTargetsWidget, SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';
|
||||
import { ContextKeyExpr, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
@@ -38,7 +39,6 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { VSash } from 'vs/base/browser/ui/sash/sash';
|
||||
import { Widget } from 'vs/base/browser/ui/widget';
|
||||
import { IPreferencesRenderer, DefaultSettingsRenderer, UserSettingsRenderer, WorkspaceSettingsRenderer, FolderSettingsRenderer } from 'vs/workbench/parts/preferences/browser/preferencesRenderers';
|
||||
@@ -53,55 +53,15 @@ import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRe
|
||||
import { attachStylerCallback } from 'vs/platform/theme/common/styler';
|
||||
import { scrollbarShadow } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { MessageController } from 'vs/editor/contrib/message/messageController';
|
||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { IHashService } from 'vs/workbench/services/hash/common/hashService';
|
||||
import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { IStringDictionary } from 'vs/base/common/collections';
|
||||
import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
export class PreferencesEditorInput extends SideBySideEditorInput {
|
||||
public static readonly ID: string = 'workbench.editorinputs.preferencesEditorInput';
|
||||
|
||||
getTypeId(): string {
|
||||
return PreferencesEditorInput.ID;
|
||||
}
|
||||
|
||||
public supportsSplitEditor(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
public getTitle(verbosity: Verbosity): string {
|
||||
return this.master.getTitle(verbosity);
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultPreferencesEditorInput extends ResourceEditorInput {
|
||||
public static readonly ID = 'workbench.editorinputs.defaultpreferences';
|
||||
constructor(defaultSettingsResource: URI,
|
||||
@ITextModelService textModelResolverService: ITextModelService,
|
||||
@IHashService hashService: IHashService
|
||||
) {
|
||||
super(nls.localize('settingsEditorName', "Default Settings"), '', defaultSettingsResource, textModelResolverService, hashService);
|
||||
}
|
||||
|
||||
getTypeId(): string {
|
||||
return DefaultPreferencesEditorInput.ID;
|
||||
}
|
||||
|
||||
matches(other: any): boolean {
|
||||
if (other instanceof DefaultPreferencesEditorInput) {
|
||||
return true;
|
||||
}
|
||||
if (!super.matches(other)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
import { PreferencesEditorInput, DefaultPreferencesEditorInput } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
|
||||
import { PREFERENCES_EDITOR_ID } from 'vs/workbench/parts/files/common/files';
|
||||
|
||||
export class PreferencesEditor extends BaseEditor {
|
||||
|
||||
@@ -138,11 +98,10 @@ export class PreferencesEditor extends BaseEditor {
|
||||
this.remoteSearchThrottle = new ThrottledDelayer(200);
|
||||
}
|
||||
|
||||
public createEditor(parent: Builder): void {
|
||||
const parentElement = parent.getHTMLElement();
|
||||
DOM.addClass(parentElement, 'preferences-editor');
|
||||
public createEditor(parent: HTMLElement): void {
|
||||
DOM.addClass(parent, 'preferences-editor');
|
||||
|
||||
this.headerContainer = DOM.append(parentElement, DOM.$('.preferences-header'));
|
||||
this.headerContainer = DOM.append(parent, DOM.$('.preferences-header'));
|
||||
|
||||
this.searchWidget = this._register(this.instantiationService.createInstance(SearchWidget, this.headerContainer, {
|
||||
ariaLabel: nls.localize('SearchSettingsWidget.AriaLabel', "Search settings"),
|
||||
@@ -154,7 +113,7 @@ export class PreferencesEditor extends BaseEditor {
|
||||
this._register(this.searchWidget.onFocus(() => this.lastFocusedWidget = this.searchWidget));
|
||||
this.lastFocusedWidget = this.searchWidget;
|
||||
|
||||
const editorsContainer = DOM.append(parentElement, DOM.$('.preferences-editors-container'));
|
||||
const editorsContainer = DOM.append(parent, DOM.$('.preferences-editors-container'));
|
||||
this.sideBySidePreferencesWidget = this._register(this.instantiationService.createInstance(SideBySidePreferencesWidget, editorsContainer));
|
||||
this._register(this.sideBySidePreferencesWidget.onFocus(() => this.lastFocusedWidget = this.sideBySidePreferencesWidget));
|
||||
this._register(this.sideBySidePreferencesWidget.onDidSettingsTargetChange(target => this.switchSettings(target)));
|
||||
@@ -192,11 +151,11 @@ export class PreferencesEditor extends BaseEditor {
|
||||
return super.setInput(newInput, options).then(() => this.updateInput(oldInput, newInput, options));
|
||||
}
|
||||
|
||||
public layout(dimension: Dimension): void {
|
||||
public layout(dimension: DOM.Dimension): void {
|
||||
DOM.toggleClass(this.headerContainer, 'vertical-layout', dimension.width < 700);
|
||||
this.searchWidget.layout(dimension);
|
||||
const headerHeight = DOM.getTotalHeight(this.headerContainer);
|
||||
this.sideBySidePreferencesWidget.layout(new Dimension(dimension.width, dimension.height - headerHeight));
|
||||
this.sideBySidePreferencesWidget.layout(new DOM.Dimension(dimension.width, dimension.height - headerHeight));
|
||||
}
|
||||
|
||||
public getControl(): IEditorControl {
|
||||
@@ -230,6 +189,10 @@ export class PreferencesEditor extends BaseEditor {
|
||||
super.clearInput();
|
||||
}
|
||||
|
||||
public supportsCenteredLayout(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected setEditorVisible(visible: boolean, position: Position): void {
|
||||
this.sideBySidePreferencesWidget.setEditorVisible(visible, position);
|
||||
super.setEditorVisible(visible, position);
|
||||
@@ -347,10 +310,12 @@ export class PreferencesEditor extends BaseEditor {
|
||||
|
||||
/* __GDPR__
|
||||
"defaultSettings.filter" : {
|
||||
"filter": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"durations" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"counts" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"requestCount" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
"filter": { "classification": "CustomerContent", "purpose": "FeatureInsight" },
|
||||
"durations.nlpresult" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"counts.nlpresult" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"durations.filterresult" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"counts.filterresult" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"requestCount" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('defaultSettings.filter', data);
|
||||
@@ -396,8 +361,8 @@ class PreferencesRenderersController extends Disposable {
|
||||
private _lastQuery: string;
|
||||
private _lastFilterResult: IFilterResult;
|
||||
|
||||
private _onDidFilterResultsCountChange: Emitter<IPreferencesCount> = this._register(new Emitter<IPreferencesCount>());
|
||||
public onDidFilterResultsCountChange: Event<IPreferencesCount> = this._onDidFilterResultsCountChange.event;
|
||||
private readonly _onDidFilterResultsCountChange: Emitter<IPreferencesCount> = this._register(new Emitter<IPreferencesCount>());
|
||||
public readonly onDidFilterResultsCountChange: Event<IPreferencesCount> = this._onDidFilterResultsCountChange.event;
|
||||
|
||||
constructor(
|
||||
@IPreferencesSearchService private preferencesSearchService: IPreferencesSearchService,
|
||||
@@ -717,10 +682,10 @@ class PreferencesRenderersController extends Disposable {
|
||||
"defaultSettingsActions.copySetting" : {
|
||||
"userConfigurationKeys" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"query" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"nlpIndex" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"nlpIndex" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"groupId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"displayIdx" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"editableSide" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
"displayIdx" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"editableSide" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('defaultSettingsActions.copySetting', data);
|
||||
@@ -770,7 +735,7 @@ class PreferencesRenderersController extends Disposable {
|
||||
|
||||
class SideBySidePreferencesWidget extends Widget {
|
||||
|
||||
private dimension: Dimension;
|
||||
private dimension: DOM.Dimension;
|
||||
|
||||
private defaultPreferencesHeader: HTMLElement;
|
||||
private defaultPreferencesEditor: DefaultPreferencesEditor;
|
||||
@@ -780,10 +745,10 @@ class SideBySidePreferencesWidget extends Widget {
|
||||
|
||||
private settingsTargetsWidget: SettingsTargetsWidget;
|
||||
|
||||
private _onFocus: Emitter<void> = new Emitter<void>();
|
||||
private readonly _onFocus: Emitter<void> = new Emitter<void>();
|
||||
readonly onFocus: Event<void> = this._onFocus.event;
|
||||
|
||||
private _onDidSettingsTargetChange: Emitter<SettingsTarget> = new Emitter<SettingsTarget>();
|
||||
private readonly _onDidSettingsTargetChange: Emitter<SettingsTarget> = new Emitter<SettingsTarget>();
|
||||
readonly onDidSettingsTargetChange: Event<SettingsTarget> = this._onDidSettingsTargetChange.event;
|
||||
|
||||
private lastFocusedEditor: BaseEditor;
|
||||
@@ -815,7 +780,7 @@ class SideBySidePreferencesWidget extends Widget {
|
||||
this.defaultPreferencesHeader.textContent = nls.localize('defaultSettings', "Default Settings");
|
||||
|
||||
this.defaultPreferencesEditor = this._register(this.instantiationService.createInstance(DefaultPreferencesEditor));
|
||||
this.defaultPreferencesEditor.create(new Builder(this.defaultPreferencesEditorContainer));
|
||||
this.defaultPreferencesEditor.create(this.defaultPreferencesEditorContainer);
|
||||
this.defaultPreferencesEditor.setVisible(true);
|
||||
(<CodeEditor>this.defaultPreferencesEditor.getControl()).onDidFocusEditor(() => this.lastFocusedEditor = this.defaultPreferencesEditor);
|
||||
|
||||
@@ -848,16 +813,28 @@ class SideBySidePreferencesWidget extends Widget {
|
||||
return TPromise.join([this.updateInput(this.defaultPreferencesEditor, defaultPreferencesEditorInput, DefaultSettingsEditorContribution.ID, editablePreferencesEditorInput.getResource(), options),
|
||||
this.updateInput(this.editablePreferencesEditor, editablePreferencesEditorInput, SettingsEditorContribution.ID, defaultPreferencesEditorInput.getResource(), options)])
|
||||
.then(([defaultPreferencesRenderer, editablePreferencesRenderer]) => {
|
||||
this.defaultPreferencesHeader.textContent = defaultPreferencesRenderer && (<DefaultSettingsEditorModel>defaultPreferencesRenderer.preferencesModel).configurationScope === ConfigurationScope.RESOURCE ? nls.localize('defaultFolderSettings', "Default Folder Settings") : nls.localize('defaultSettings', "Default Settings");
|
||||
this.defaultPreferencesHeader.textContent = defaultPreferencesRenderer && this.getDefaultPreferencesHeaderText((<DefaultSettingsEditorModel>defaultPreferencesRenderer.preferencesModel).target);
|
||||
return { defaultPreferencesRenderer, editablePreferencesRenderer };
|
||||
});
|
||||
}
|
||||
|
||||
private getDefaultPreferencesHeaderText(target: ConfigurationTarget): string {
|
||||
switch (target) {
|
||||
case ConfigurationTarget.USER:
|
||||
return nls.localize('defaultUserSettings', "Default User Settings");
|
||||
case ConfigurationTarget.WORKSPACE:
|
||||
return nls.localize('defaultWorkspaceSettings', "Default Workspace Settings");
|
||||
case ConfigurationTarget.WORKSPACE_FOLDER:
|
||||
return nls.localize('defaultFolderSettings', "Default Folder Settings");
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public setResultCount(settingsTarget: SettingsTarget, count: number): void {
|
||||
this.settingsTargetsWidget.setResultCount(settingsTarget, count);
|
||||
}
|
||||
|
||||
public layout(dimension: Dimension): void {
|
||||
public layout(dimension: DOM.Dimension): void {
|
||||
this.dimension = dimension;
|
||||
this.sash.setDimenesion(this.dimension);
|
||||
}
|
||||
@@ -900,7 +877,7 @@ class SideBySidePreferencesWidget extends Widget {
|
||||
const descriptor = Registry.as<IEditorRegistry>(EditorExtensions.Editors).getEditor(editorInput);
|
||||
const editor = descriptor.instantiate(this.instantiationService);
|
||||
this.editablePreferencesEditor = editor;
|
||||
this.editablePreferencesEditor.create(new Builder(this.editablePreferencesEditorContainer));
|
||||
this.editablePreferencesEditor.create(this.editablePreferencesEditorContainer);
|
||||
this.editablePreferencesEditor.setVisible(true);
|
||||
(<CodeEditor>this.editablePreferencesEditor.getControl()).onDidFocusEditor(() => this.lastFocusedEditor = this.editablePreferencesEditor);
|
||||
this.lastFocusedEditor = this.editablePreferencesEditor;
|
||||
@@ -933,8 +910,8 @@ class SideBySidePreferencesWidget extends Widget {
|
||||
this.editablePreferencesEditorContainer.style.height = `${this.dimension.height}px`;
|
||||
this.editablePreferencesEditorContainer.style.left = `${splitPoint}px`;
|
||||
|
||||
this.defaultPreferencesEditor.layout(new Dimension(detailsEditorWidth, this.dimension.height - 34 /* height of header container */));
|
||||
this.editablePreferencesEditor.layout(new Dimension(masterEditorWidth, this.dimension.height - 34 /* height of header container */));
|
||||
this.defaultPreferencesEditor.layout(new DOM.Dimension(detailsEditorWidth, this.dimension.height - 34 /* height of header container */));
|
||||
this.editablePreferencesEditor.layout(new DOM.Dimension(masterEditorWidth, this.dimension.height - 34 /* height of header container */));
|
||||
}
|
||||
|
||||
private getSettingsTarget(resource: URI): SettingsTarget {
|
||||
@@ -988,8 +965,8 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
|
||||
super(DefaultPreferencesEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorGroupService);
|
||||
}
|
||||
|
||||
public createEditorControl(parent: Builder, configuration: IEditorOptions): editorCommon.IEditor {
|
||||
const editor = this.instantiationService.createInstance(DefaultPreferencesCodeEditor, parent.getHTMLElement(), configuration);
|
||||
public createEditorControl(parent: HTMLElement, configuration: IEditorOptions): editorCommon.IEditor {
|
||||
const editor = this.instantiationService.createInstance(DefaultPreferencesCodeEditor, parent, configuration);
|
||||
|
||||
// Inform user about editor being readonly if user starts type
|
||||
this.toUnbind.push(editor.onDidType(() => this.showReadonlyHint(editor)));
|
||||
@@ -1040,10 +1017,14 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
|
||||
super.clearInput();
|
||||
}
|
||||
|
||||
public layout(dimension: Dimension) {
|
||||
public layout(dimension: DOM.Dimension) {
|
||||
this.getControl().layout(dimension);
|
||||
}
|
||||
|
||||
public supportsCenteredLayout(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected getAriaLabel(): string {
|
||||
return nls.localize('preferencesAriaLabel', "Default preferences. Readonly text editor.");
|
||||
}
|
||||
|
||||
@@ -12,24 +12,22 @@ import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import { Range, IRange } from 'vs/editor/common/core/range';
|
||||
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope, IConfigurationPropertySchema } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IPreferencesService, ISettingsGroup, ISetting, IPreferencesEditorModel, IFilterResult, ISettingsEditorModel, IWorkbenchSettingsConfiguration, IExtensionSetting, IScoredResults } from 'vs/workbench/parts/preferences/common/preferences';
|
||||
import { SettingsEditorModel, DefaultSettingsEditorModel, WorkspaceConfigurationEditorModel } from 'vs/workbench/parts/preferences/common/preferencesModels';
|
||||
import { IPreferencesService, ISettingsGroup, ISetting, IPreferencesEditorModel, IFilterResult, ISettingsEditorModel, IExtensionSetting, IScoredResults } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { SettingsEditorModel, DefaultSettingsEditorModel, WorkspaceConfigurationEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
|
||||
import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { SettingsGroupTitleWidget, EditPreferenceWidget, SettingsHeaderWidget, DefaultSettingsHeaderWidget, FloatingClickWidget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { RangeHighlightDecorations } from 'vs/workbench/browser/parts/editor/rangeDecorations';
|
||||
import { IMarkerService, IMarkerData } from 'vs/platform/markers/common/markers';
|
||||
import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
|
||||
import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { MarkdownString } from 'vs/base/common/htmlContent';
|
||||
import { overrideIdentifierFromKey, IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { ITextModel, IModelDeltaDecoration, TrackedRangeStickiness } from 'vs/editor/common/model';
|
||||
@@ -40,8 +38,9 @@ import { IssueType, ISettingsSearchIssueReporterData, ISettingSearchResult } fro
|
||||
import { ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IWorkbenchIssueService } from 'vs/workbench/services/issue/common/issue';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { ContextSubMenu } from 'vs/base/browser/contextmenu';
|
||||
import { IWorkbenchSettingsConfiguration } from 'vs/workbench/parts/preferences/common/preferences';
|
||||
|
||||
export interface IPreferencesRenderer<T> extends IDisposable {
|
||||
readonly preferencesModel: IPreferencesEditorModel<T>;
|
||||
@@ -69,13 +68,13 @@ export class UserSettingsRenderer extends Disposable implements IPreferencesRend
|
||||
private modelChangeDelayer: Delayer<void> = new Delayer<void>(200);
|
||||
private associatedPreferencesModel: IPreferencesEditorModel<ISetting>;
|
||||
|
||||
private _onFocusPreference: Emitter<ISetting> = new Emitter<ISetting>();
|
||||
private readonly _onFocusPreference: Emitter<ISetting> = new Emitter<ISetting>();
|
||||
public readonly onFocusPreference: Event<ISetting> = this._onFocusPreference.event;
|
||||
|
||||
private _onClearFocusPreference: Emitter<ISetting> = new Emitter<ISetting>();
|
||||
private readonly _onClearFocusPreference: Emitter<ISetting> = new Emitter<ISetting>();
|
||||
public readonly onClearFocusPreference: Event<ISetting> = this._onClearFocusPreference.event;
|
||||
|
||||
private _onUpdatePreference: Emitter<{ key: string, value: any, source: IIndexedSetting }> = new Emitter<{ key: string, value: any, source: IIndexedSetting }>();
|
||||
private readonly _onUpdatePreference: Emitter<{ key: string, value: any, source: IIndexedSetting }> = new Emitter<{ key: string, value: any, source: IIndexedSetting }>();
|
||||
public readonly onUpdatePreference: Event<{ key: string, value: any, source: IIndexedSetting }> = this._onUpdatePreference.event;
|
||||
|
||||
private filterResult: IFilterResult;
|
||||
@@ -188,7 +187,6 @@ export class UserSettingsRenderer extends Disposable implements IPreferencesRend
|
||||
|
||||
export class WorkspaceSettingsRenderer extends UserSettingsRenderer implements IPreferencesRenderer<ISetting> {
|
||||
|
||||
private unsupportedSettingsRenderer: UnsupportedSettingsRenderer;
|
||||
private workspaceConfigurationRenderer: WorkspaceConfigurationRenderer;
|
||||
|
||||
constructor(editor: ICodeEditor, preferencesModel: SettingsEditorModel,
|
||||
@@ -198,7 +196,6 @@ export class WorkspaceSettingsRenderer extends UserSettingsRenderer implements I
|
||||
@IInstantiationService instantiationService: IInstantiationService
|
||||
) {
|
||||
super(editor, preferencesModel, preferencesService, configurationService, instantiationService);
|
||||
this.unsupportedSettingsRenderer = this._register(instantiationService.createInstance(UnsupportedSettingsRenderer, editor, preferencesModel));
|
||||
this.workspaceConfigurationRenderer = this._register(instantiationService.createInstance(WorkspaceConfigurationRenderer, editor, preferencesModel));
|
||||
}
|
||||
|
||||
@@ -213,15 +210,12 @@ export class WorkspaceSettingsRenderer extends UserSettingsRenderer implements I
|
||||
|
||||
public render(): void {
|
||||
super.render();
|
||||
this.unsupportedSettingsRenderer.render();
|
||||
this.workspaceConfigurationRenderer.render(this.getAssociatedPreferencesModel());
|
||||
}
|
||||
}
|
||||
|
||||
export class FolderSettingsRenderer extends UserSettingsRenderer implements IPreferencesRenderer<ISetting> {
|
||||
|
||||
private unsupportedSettingsRenderer: UnsupportedSettingsRenderer;
|
||||
|
||||
constructor(editor: ICodeEditor, preferencesModel: SettingsEditorModel,
|
||||
@IPreferencesService preferencesService: IPreferencesService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@@ -229,17 +223,12 @@ export class FolderSettingsRenderer extends UserSettingsRenderer implements IPre
|
||||
@IInstantiationService instantiationService: IInstantiationService
|
||||
) {
|
||||
super(editor, preferencesModel, preferencesService, configurationService, instantiationService);
|
||||
this.unsupportedSettingsRenderer = this._register(instantiationService.createInstance(UnsupportedSettingsRenderer, editor, preferencesModel));
|
||||
}
|
||||
|
||||
protected createHeader(): void {
|
||||
this._register(new SettingsHeaderWidget(this.editor, '')).setMessage(nls.localize('emptyFolderSettingsHeader', "Place your folder settings here to overwrite those from the Workspace Settings."));
|
||||
}
|
||||
|
||||
public render(): void {
|
||||
super.render();
|
||||
this.unsupportedSettingsRenderer.render();
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultSettingsRenderer extends Disposable implements IPreferencesRenderer<ISetting> {
|
||||
@@ -257,13 +246,13 @@ export class DefaultSettingsRenderer extends Disposable implements IPreferencesR
|
||||
private extensionCodelensRenderer: ExtensionCodelensRenderer;
|
||||
private filterResult: IFilterResult;
|
||||
|
||||
private _onUpdatePreference: Emitter<{ key: string, value: any, source: IIndexedSetting }> = new Emitter<{ key: string, value: any, source: IIndexedSetting }>();
|
||||
private readonly _onUpdatePreference: Emitter<{ key: string, value: any, source: IIndexedSetting }> = new Emitter<{ key: string, value: any, source: IIndexedSetting }>();
|
||||
public readonly onUpdatePreference: Event<{ key: string, value: any, source: IIndexedSetting }> = this._onUpdatePreference.event;
|
||||
|
||||
private _onFocusPreference: Emitter<ISetting> = new Emitter<ISetting>();
|
||||
private readonly _onFocusPreference: Emitter<ISetting> = new Emitter<ISetting>();
|
||||
public readonly onFocusPreference: Event<ISetting> = this._onFocusPreference.event;
|
||||
|
||||
private _onClearFocusPreference: Emitter<ISetting> = new Emitter<ISetting>();
|
||||
private readonly _onClearFocusPreference: Emitter<ISetting> = new Emitter<ISetting>();
|
||||
public readonly onClearFocusPreference: Event<ISetting> = this._onClearFocusPreference.event;
|
||||
|
||||
constructor(protected editor: ICodeEditor, public readonly preferencesModel: DefaultSettingsEditorModel,
|
||||
@@ -273,7 +262,7 @@ export class DefaultSettingsRenderer extends Disposable implements IPreferencesR
|
||||
) {
|
||||
super();
|
||||
this.settingHighlighter = this._register(instantiationService.createInstance(SettingHighlighter, editor, this._onFocusPreference, this._onClearFocusPreference));
|
||||
this.settingsHeaderRenderer = this._register(instantiationService.createInstance(DefaultSettingsHeaderRenderer, editor, preferencesModel.configurationScope));
|
||||
this.settingsHeaderRenderer = this._register(instantiationService.createInstance(DefaultSettingsHeaderRenderer, editor));
|
||||
this.settingsGroupTitleRenderer = this._register(instantiationService.createInstance(SettingsGroupTitleRenderer, editor));
|
||||
this.filteredMatchesRenderer = this._register(instantiationService.createInstance(FilteredMatchesRenderer, editor));
|
||||
this.editSettingActionRenderer = this._register(instantiationService.createInstance(EditSettingRenderer, editor, preferencesModel, this.settingHighlighter));
|
||||
@@ -465,9 +454,9 @@ export class BracesHidingRenderer extends Disposable implements HiddenAreasProvi
|
||||
class DefaultSettingsHeaderRenderer extends Disposable {
|
||||
|
||||
private settingsHeaderWidget: DefaultSettingsHeaderWidget;
|
||||
public onClick: Event<void>;
|
||||
public readonly onClick: Event<void>;
|
||||
|
||||
constructor(editor: ICodeEditor, scope: ConfigurationScope) {
|
||||
constructor(editor: ICodeEditor) {
|
||||
super();
|
||||
this.settingsHeaderWidget = this._register(new DefaultSettingsHeaderWidget(editor, ''));
|
||||
this.onClick = this.settingsHeaderWidget.onClick;
|
||||
@@ -481,7 +470,7 @@ class DefaultSettingsHeaderRenderer extends Disposable {
|
||||
|
||||
export class SettingsGroupTitleRenderer extends Disposable implements HiddenAreasProvider {
|
||||
|
||||
private _onHiddenAreasChanged: Emitter<void> = new Emitter<void>();
|
||||
private readonly _onHiddenAreasChanged: Emitter<void> = new Emitter<void>();
|
||||
get onHiddenAreasChanged(): Event<void> { return this._onHiddenAreasChanged.event; }
|
||||
|
||||
private settingsGroups: ISettingsGroup[];
|
||||
@@ -732,10 +721,10 @@ export class FeedbackWidgetRenderer extends Disposable {
|
||||
"userComment" : { "classification": "CustomerContent", "purpose": "FeatureInsight" },
|
||||
"actualResults" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"expectedResults" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"buildNumber" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"buildNumber" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"alts" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"autoIngest" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
"autoIngest" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
return this.telemetryService.publicLog('settingsSearchResultFeedback', {
|
||||
@@ -879,29 +868,27 @@ export class FilteredMatchesRenderer extends Disposable implements HiddenAreasPr
|
||||
public render(result: IFilterResult, allSettingsGroups: ISettingsGroup[]): void {
|
||||
const model = this.editor.getModel();
|
||||
this.hiddenAreas = [];
|
||||
this.editor.changeDecorations(changeAccessor => {
|
||||
this.decorationIds = changeAccessor.deltaDecorations(this.decorationIds, []);
|
||||
});
|
||||
if (result) {
|
||||
this.hiddenAreas = this.computeHiddenRanges(result.filteredGroups, result.allGroups, model);
|
||||
this.editor.changeDecorations(changeAccessor => {
|
||||
this.decorationIds = changeAccessor.deltaDecorations(this.decorationIds, result.matches.map(match => this.createDecoration(match, model)));
|
||||
});
|
||||
this.decorationIds = this.editor.deltaDecorations(this.decorationIds, result.matches.map(match => this.createDecoration(match, model)));
|
||||
} else {
|
||||
this.hiddenAreas = this.computeHiddenRanges(null, allSettingsGroups, model);
|
||||
this.decorationIds = this.editor.deltaDecorations(this.decorationIds, []);
|
||||
}
|
||||
}
|
||||
|
||||
private createDecoration(range: IRange, model: ITextModel): IModelDeltaDecoration {
|
||||
return {
|
||||
range,
|
||||
options: {
|
||||
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
className: 'findMatch'
|
||||
}
|
||||
options: FilteredMatchesRenderer._FIND_MATCH
|
||||
};
|
||||
}
|
||||
|
||||
private static readonly _FIND_MATCH = ModelDecorationOptions.register({
|
||||
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
className: 'findMatch'
|
||||
});
|
||||
|
||||
private computeHiddenRanges(filteredGroups: ISettingsGroup[], allSettingsGroups: ISettingsGroup[], model: ITextModel): IRange[] {
|
||||
// Hide the contents of hidden groups
|
||||
const notMatchesRanges: IRange[] = [];
|
||||
@@ -920,11 +907,7 @@ export class FilteredMatchesRenderer extends Disposable implements HiddenAreasPr
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
if (this.decorationIds) {
|
||||
this.decorationIds = this.editor.changeDecorations(changeAccessor => {
|
||||
return changeAccessor.deltaDecorations(this.decorationIds, []);
|
||||
});
|
||||
}
|
||||
this.decorationIds = this.editor.deltaDecorations(this.decorationIds, []);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
@@ -940,14 +923,7 @@ export class HighlightMatchesRenderer extends Disposable {
|
||||
|
||||
public render(matches: IRange[]): void {
|
||||
const model = this.editor.getModel();
|
||||
this.editor.changeDecorations(changeAccessor => {
|
||||
this.decorationIds = changeAccessor.deltaDecorations(this.decorationIds, []) || [];
|
||||
});
|
||||
if (matches.length) {
|
||||
this.editor.changeDecorations(changeAccessor => {
|
||||
this.decorationIds = changeAccessor.deltaDecorations(this.decorationIds, matches.map(match => this.createDecoration(match, model))) || [];
|
||||
});
|
||||
}
|
||||
this.decorationIds = this.editor.deltaDecorations(this.decorationIds, matches.map(match => this.createDecoration(match, model)));
|
||||
}
|
||||
|
||||
private static readonly _FIND_MATCH = ModelDecorationOptions.register({
|
||||
@@ -963,11 +939,7 @@ export class HighlightMatchesRenderer extends Disposable {
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
if (this.decorationIds) {
|
||||
this.decorationIds = this.editor.changeDecorations(changeAccessor => {
|
||||
return changeAccessor.deltaDecorations(this.decorationIds, []);
|
||||
}) || [];
|
||||
}
|
||||
this.decorationIds = this.editor.deltaDecorations(this.decorationIds, []);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
@@ -1031,7 +1003,7 @@ class EditSettingRenderer extends Disposable {
|
||||
public associatedPreferencesModel: IPreferencesEditorModel<ISetting>;
|
||||
private toggleEditPreferencesForMouseMoveDelayer: Delayer<void>;
|
||||
|
||||
private _onUpdateSetting: Emitter<{ key: string, value: any, source: IIndexedSetting }> = new Emitter<{ key: string, value: any, source: IIndexedSetting }>();
|
||||
private readonly _onUpdateSetting: Emitter<{ key: string, value: any, source: IIndexedSetting }> = new Emitter<{ key: string, value: any, source: IIndexedSetting }>();
|
||||
public readonly onUpdateSetting: Event<{ key: string, value: any, source: IIndexedSetting }> = this._onUpdateSetting.event;
|
||||
|
||||
constructor(private editor: ICodeEditor, private masterSettingsModel: ISettingsEditorModel,
|
||||
@@ -1295,7 +1267,7 @@ class SettingHighlighter extends Disposable {
|
||||
private volatileHighlighter: RangeHighlightDecorations;
|
||||
private highlightedSetting: ISetting;
|
||||
|
||||
constructor(private editor: ICodeEditor, private focusEventEmitter: Emitter<ISetting>, private clearFocusEventEmitter: Emitter<ISetting>,
|
||||
constructor(private editor: ICodeEditor, private readonly focusEventEmitter: Emitter<ISetting>, private readonly clearFocusEventEmitter: Emitter<ISetting>,
|
||||
@IInstantiationService instantiationService: IInstantiationService
|
||||
) {
|
||||
super();
|
||||
@@ -1329,104 +1301,6 @@ class SettingHighlighter extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
class UnsupportedSettingsRenderer extends Disposable {
|
||||
|
||||
private decorationIds: string[] = [];
|
||||
private renderingDelayer: Delayer<void> = new Delayer<void>(200);
|
||||
|
||||
constructor(
|
||||
private editor: ICodeEditor,
|
||||
private settingsEditorModel: SettingsEditorModel,
|
||||
@IMarkerService private markerService: IMarkerService,
|
||||
@IEnvironmentService private environmentService: IEnvironmentService
|
||||
) {
|
||||
super();
|
||||
this._register(this.editor.getModel().onDidChangeContent(() => this.renderingDelayer.trigger(() => this.render())));
|
||||
}
|
||||
|
||||
public render(): void {
|
||||
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).getConfigurationProperties();
|
||||
const ranges: IRange[] = [];
|
||||
const markerData: IMarkerData[] = [];
|
||||
for (const settingsGroup of this.settingsEditorModel.settingsGroups) {
|
||||
for (const section of settingsGroup.sections) {
|
||||
for (const setting of section.settings) {
|
||||
if (this.settingsEditorModel.configurationTarget === ConfigurationTarget.WORKSPACE || this.settingsEditorModel.configurationTarget === ConfigurationTarget.WORKSPACE_FOLDER) {
|
||||
// Show warnings for executable settings
|
||||
if (configurationRegistry[setting.key] && configurationRegistry[setting.key].isExecutable) {
|
||||
markerData.push({
|
||||
severity: Severity.Warning,
|
||||
startLineNumber: setting.keyRange.startLineNumber,
|
||||
startColumn: setting.keyRange.startColumn,
|
||||
endLineNumber: setting.keyRange.endLineNumber,
|
||||
endColumn: setting.keyRange.endColumn,
|
||||
message: this.getMarkerMessage(setting.key)
|
||||
});
|
||||
}
|
||||
}
|
||||
if (this.settingsEditorModel.configurationTarget === ConfigurationTarget.WORKSPACE_FOLDER) {
|
||||
// Dim and show information for window settings
|
||||
if (configurationRegistry[setting.key] && configurationRegistry[setting.key].scope === ConfigurationScope.WINDOW) {
|
||||
ranges.push({
|
||||
startLineNumber: setting.keyRange.startLineNumber,
|
||||
startColumn: setting.keyRange.startColumn - 1,
|
||||
endLineNumber: setting.valueRange.endLineNumber,
|
||||
endColumn: setting.valueRange.endColumn
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (markerData.length) {
|
||||
this.markerService.changeOne('preferencesEditor', this.settingsEditorModel.uri, markerData);
|
||||
} else {
|
||||
this.markerService.remove('preferencesEditor', [this.settingsEditorModel.uri]);
|
||||
}
|
||||
this.editor.changeDecorations(changeAccessor => this.decorationIds = changeAccessor.deltaDecorations(this.decorationIds, ranges.map(range => this.createDecoration(range, this.editor.getModel()))));
|
||||
}
|
||||
|
||||
private createDecoration(range: IRange, model: ITextModel): IModelDeltaDecoration {
|
||||
return {
|
||||
range,
|
||||
options: !this.environmentService.isBuilt || this.environmentService.isExtensionDevelopment ? UnsupportedSettingsRenderer._DIM_CONFIGUARATION_DEV_MODE : UnsupportedSettingsRenderer._DIM_CONFIGUARATION_
|
||||
};
|
||||
}
|
||||
|
||||
private getMarkerMessage(settingKey: string): string {
|
||||
switch (settingKey) {
|
||||
case 'php.validate.executablePath':
|
||||
return nls.localize('unsupportedPHPExecutablePathSetting', "This setting must be a User Setting. To configure PHP for the workspace, open a PHP file and click on 'PHP Path' in the status bar.");
|
||||
default:
|
||||
return nls.localize('unsupportedWorkspaceSetting', "This setting must be a User Setting.");
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.markerService.remove('preferencesEditor', [this.settingsEditorModel.uri]);
|
||||
if (this.decorationIds) {
|
||||
this.decorationIds = this.editor.changeDecorations(changeAccessor => {
|
||||
return changeAccessor.deltaDecorations(this.decorationIds, []);
|
||||
});
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
private static readonly _DIM_CONFIGUARATION_ = ModelDecorationOptions.register({
|
||||
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
inlineClassName: 'dim-configuration',
|
||||
beforeContentClassName: 'unsupportedWorkbenhSettingInfo',
|
||||
hoverMessage: new MarkdownString().appendText(nls.localize('unsupportedWorkbenchSetting', "This setting cannot be applied now. It will be applied when you open this folder directly."))
|
||||
});
|
||||
|
||||
private static readonly _DIM_CONFIGUARATION_DEV_MODE = ModelDecorationOptions.register({
|
||||
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
inlineClassName: 'dim-configuration',
|
||||
beforeContentClassName: 'unsupportedWorkbenhSettingInfo',
|
||||
hoverMessage: new MarkdownString().appendText(nls.localize('unsupportedWorkbenchSettingDevMode', "This setting cannot be applied now. It will be applied if you define it's scope as 'resource' while registering, or when you open this folder directly."))
|
||||
});
|
||||
}
|
||||
|
||||
class WorkspaceConfigurationRenderer extends Disposable {
|
||||
|
||||
private decorationIds: string[] = [];
|
||||
@@ -1444,8 +1318,6 @@ class WorkspaceConfigurationRenderer extends Disposable {
|
||||
this.associatedSettingsEditorModel = associatedSettingsEditorModel;
|
||||
// Dim other configurations in workspace configuration file only in the context of Settings Editor
|
||||
if (this.associatedSettingsEditorModel && this.workspaceContextService.getWorkbenchState() === WorkbenchState.WORKSPACE && this.workspaceSettingsEditorModel instanceof WorkspaceConfigurationEditorModel) {
|
||||
this.editor.changeDecorations(changeAccessor => this.decorationIds = changeAccessor.deltaDecorations(this.decorationIds, []));
|
||||
|
||||
const ranges: IRange[] = [];
|
||||
for (const settingsGroup of this.workspaceSettingsEditorModel.configurationGroups) {
|
||||
for (const section of settingsGroup.sections) {
|
||||
@@ -1461,7 +1333,7 @@ class WorkspaceConfigurationRenderer extends Disposable {
|
||||
}
|
||||
}
|
||||
}
|
||||
this.editor.changeDecorations(changeAccessor => this.decorationIds = changeAccessor.deltaDecorations(this.decorationIds, ranges.map(range => this.createDecoration(range, this.editor.getModel()))));
|
||||
this.decorationIds = this.editor.deltaDecorations(this.decorationIds, ranges.map(range => this.createDecoration(range, this.editor.getModel())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1478,11 +1350,7 @@ class WorkspaceConfigurationRenderer extends Disposable {
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
if (this.decorationIds) {
|
||||
this.decorationIds = this.editor.changeDecorations(changeAccessor => {
|
||||
return changeAccessor.deltaDecorations(this.decorationIds, []);
|
||||
});
|
||||
}
|
||||
this.decorationIds = this.editor.deltaDecorations(this.decorationIds, []);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,439 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./media/preferences';
|
||||
import * as network from 'vs/base/common/network';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as nls from 'vs/nls';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import * as labels from 'vs/base/common/labels';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { Position as EditorPosition, IEditor, IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IFileService, FileOperationError, FileOperationResult } from 'vs/platform/files/common/files';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IPreferencesService, IPreferencesEditorModel, ISetting, getSettingsTargetName, FOLDER_SETTINGS_PATH, DEFAULT_SETTINGS_EDITOR_SETTING } from 'vs/workbench/parts/preferences/common/preferences';
|
||||
import { SettingsEditorModel, DefaultSettingsEditorModel, DefaultKeybindingsEditorModel, defaultKeybindingsContents, DefaultSettings, WorkspaceConfigurationEditorModel } from 'vs/workbench/parts/preferences/common/preferencesModels';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { DefaultPreferencesEditorInput, PreferencesEditorInput } from 'vs/workbench/parts/preferences/browser/preferencesEditor';
|
||||
import { KeybindingsEditorInput } from 'vs/workbench/parts/preferences/browser/keybindingsEditor';
|
||||
import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { getCodeEditor } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { EditOperation } from 'vs/editor/common/core/editOperation';
|
||||
import { Position, IPosition } from 'vs/editor/common/core/position';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IJSONEditingService } from 'vs/workbench/services/configuration/common/jsonEditing';
|
||||
import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { parse } from 'vs/base/common/json';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
const emptyEditableSettingsContent = '{\n}';
|
||||
|
||||
export class PreferencesService extends Disposable implements IPreferencesService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
private lastOpenedSettingsInput: PreferencesEditorInput = null;
|
||||
|
||||
private _onDispose: Emitter<void> = new Emitter<void>();
|
||||
|
||||
private _defaultSettingsUriCounter = 0;
|
||||
private _defaultSettingsContentModel: DefaultSettings;
|
||||
private _defaultResourceSettingsUriCounter = 0;
|
||||
private _defaultResourceSettingsContentModel: DefaultSettings;
|
||||
|
||||
constructor(
|
||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||
@IEditorGroupService private editorGroupService: IEditorGroupService,
|
||||
@IFileService private fileService: IFileService,
|
||||
@IWorkspaceConfigurationService private configurationService: IWorkspaceConfigurationService,
|
||||
@INotificationService private notificationService: INotificationService,
|
||||
@IWorkspaceContextService private contextService: IWorkspaceContextService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IEnvironmentService private environmentService: IEnvironmentService,
|
||||
@ITelemetryService private telemetryService: ITelemetryService,
|
||||
@ITextModelService private textModelResolverService: ITextModelService,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@IModelService private modelService: IModelService,
|
||||
@IJSONEditingService private jsonEditingService: IJSONEditingService,
|
||||
@IModeService private modeService: IModeService
|
||||
) {
|
||||
super();
|
||||
this.editorGroupService.onEditorsChanged(() => {
|
||||
const activeEditorInput = this.editorService.getActiveEditorInput();
|
||||
if (activeEditorInput instanceof PreferencesEditorInput) {
|
||||
this.lastOpenedSettingsInput = activeEditorInput;
|
||||
}
|
||||
});
|
||||
|
||||
// The default keybindings.json updates based on keyboard layouts, so here we make sure
|
||||
// if a model has been given out we update it accordingly.
|
||||
keybindingService.onDidUpdateKeybindings(() => {
|
||||
const model = modelService.getModel(this.defaultKeybindingsResource);
|
||||
if (!model) {
|
||||
// model has not been given out => nothing to do
|
||||
return;
|
||||
}
|
||||
modelService.updateModel(model, defaultKeybindingsContents(keybindingService));
|
||||
});
|
||||
}
|
||||
|
||||
readonly defaultKeybindingsResource = URI.from({ scheme: network.Schemas.vscode, authority: 'defaultsettings', path: '/keybindings.json' });
|
||||
private readonly defaultSettingsRawResource = URI.from({ scheme: network.Schemas.vscode, authority: 'defaultsettings', path: '/defaultSettings.json' });
|
||||
|
||||
get userSettingsResource(): URI {
|
||||
return this.getEditableSettingsURI(ConfigurationTarget.USER);
|
||||
}
|
||||
|
||||
get workspaceSettingsResource(): URI {
|
||||
return this.getEditableSettingsURI(ConfigurationTarget.WORKSPACE);
|
||||
}
|
||||
|
||||
getFolderSettingsResource(resource: URI): URI {
|
||||
return this.getEditableSettingsURI(ConfigurationTarget.WORKSPACE_FOLDER, resource);
|
||||
}
|
||||
|
||||
resolveModel(uri: URI): TPromise<ITextModel> {
|
||||
if (this.isDefaultSettingsResource(uri) || this.isDefaultResourceSettingsResource(uri)) {
|
||||
|
||||
const scope = this.isDefaultSettingsResource(uri) ? ConfigurationScope.WINDOW : ConfigurationScope.RESOURCE;
|
||||
const mode = this.modeService.getOrCreateMode('jsonc');
|
||||
const model = this._register(this.modelService.createModel('', mode, uri));
|
||||
|
||||
let defaultSettings: DefaultSettings;
|
||||
this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.source === ConfigurationTarget.DEFAULT) {
|
||||
const model = this.modelService.getModel(uri);
|
||||
if (!model) {
|
||||
// model has not been given out => nothing to do
|
||||
return;
|
||||
}
|
||||
defaultSettings = this.getDefaultSettings(scope);
|
||||
this.modelService.updateModel(model, defaultSettings.parse());
|
||||
defaultSettings._onDidChange.fire();
|
||||
}
|
||||
});
|
||||
|
||||
// Check if Default settings is already created and updated in above promise
|
||||
if (!defaultSettings) {
|
||||
defaultSettings = this.getDefaultSettings(scope);
|
||||
this.modelService.updateModel(model, defaultSettings.parse());
|
||||
}
|
||||
|
||||
return TPromise.as(model);
|
||||
}
|
||||
|
||||
if (this.defaultSettingsRawResource.toString() === uri.toString()) {
|
||||
let defaultSettings: DefaultSettings = this.getDefaultSettings(ConfigurationScope.WINDOW);
|
||||
const mode = this.modeService.getOrCreateMode('jsonc');
|
||||
const model = this._register(this.modelService.createModel(defaultSettings.raw, mode, uri));
|
||||
return TPromise.as(model);
|
||||
}
|
||||
|
||||
if (this.defaultKeybindingsResource.toString() === uri.toString()) {
|
||||
const defaultKeybindingsEditorModel = this.instantiationService.createInstance(DefaultKeybindingsEditorModel, uri);
|
||||
const mode = this.modeService.getOrCreateMode('jsonc');
|
||||
const model = this._register(this.modelService.createModel(defaultKeybindingsEditorModel.content, mode, uri));
|
||||
return TPromise.as(model);
|
||||
}
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
createPreferencesEditorModel(uri: URI): TPromise<IPreferencesEditorModel<any>> {
|
||||
if (this.isDefaultSettingsResource(uri) || this.isDefaultResourceSettingsResource(uri)) {
|
||||
return this.createDefaultSettingsEditorModel(uri);
|
||||
}
|
||||
|
||||
if (this.getEditableSettingsURI(ConfigurationTarget.USER).toString() === uri.toString()) {
|
||||
return this.createEditableSettingsEditorModel(ConfigurationTarget.USER, uri);
|
||||
}
|
||||
|
||||
const workspaceSettingsUri = this.getEditableSettingsURI(ConfigurationTarget.WORKSPACE);
|
||||
if (workspaceSettingsUri && workspaceSettingsUri.toString() === uri.toString()) {
|
||||
return this.createEditableSettingsEditorModel(ConfigurationTarget.WORKSPACE, workspaceSettingsUri);
|
||||
}
|
||||
|
||||
if (this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE) {
|
||||
return this.createEditableSettingsEditorModel(ConfigurationTarget.WORKSPACE_FOLDER, uri);
|
||||
}
|
||||
|
||||
return TPromise.wrap<IPreferencesEditorModel<any>>(null);
|
||||
}
|
||||
|
||||
openRawDefaultSettings(): TPromise<void> {
|
||||
return this.editorService.openEditor({ resource: this.defaultSettingsRawResource }, EditorPosition.ONE) as TPromise<any>;
|
||||
}
|
||||
|
||||
openGlobalSettings(options?: IEditorOptions, position?: EditorPosition): TPromise<IEditor> {
|
||||
return this.doOpenSettings(ConfigurationTarget.USER, this.userSettingsResource, options, position);
|
||||
}
|
||||
|
||||
openWorkspaceSettings(options?: IEditorOptions, position?: EditorPosition): TPromise<IEditor> {
|
||||
if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) {
|
||||
this.notificationService.info(nls.localize('openFolderFirst', "Open a folder first to create workspace settings"));
|
||||
return TPromise.as(null);
|
||||
}
|
||||
return this.doOpenSettings(ConfigurationTarget.WORKSPACE, this.workspaceSettingsResource, options, position);
|
||||
}
|
||||
|
||||
openFolderSettings(folder: URI, options?: IEditorOptions, position?: EditorPosition): TPromise<IEditor> {
|
||||
return this.doOpenSettings(ConfigurationTarget.WORKSPACE_FOLDER, this.getEditableSettingsURI(ConfigurationTarget.WORKSPACE_FOLDER, folder), options, position);
|
||||
}
|
||||
|
||||
switchSettings(target: ConfigurationTarget, resource: URI): TPromise<void> {
|
||||
const activeEditor = this.editorService.getActiveEditor();
|
||||
if (activeEditor && activeEditor.input instanceof PreferencesEditorInput) {
|
||||
return this.getOrCreateEditableSettingsEditorInput(target, this.getEditableSettingsURI(target, resource))
|
||||
.then(toInput => {
|
||||
const replaceWith = new PreferencesEditorInput(this.getPreferencesEditorInputName(target, resource), toInput.getDescription(), this.instantiationService.createInstance(DefaultPreferencesEditorInput, this.getDefaultSettingsResource(target)), toInput);
|
||||
return this.editorService.replaceEditors([{
|
||||
toReplace: this.lastOpenedSettingsInput,
|
||||
replaceWith
|
||||
}], activeEditor.position).then(() => {
|
||||
this.lastOpenedSettingsInput = replaceWith;
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.doOpenSettings(target, resource);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
openGlobalKeybindingSettings(textual: boolean): TPromise<void> {
|
||||
/* __GDPR__
|
||||
"openKeybindings" : {
|
||||
"textual" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('openKeybindings', { textual });
|
||||
if (textual) {
|
||||
const emptyContents = '// ' + nls.localize('emptyKeybindingsHeader', "Place your key bindings in this file to overwrite the defaults") + '\n[\n]';
|
||||
const editableKeybindings = URI.file(this.environmentService.appKeybindingsPath);
|
||||
|
||||
// Create as needed and open in editor
|
||||
return this.createIfNotExists(editableKeybindings, emptyContents).then(() => {
|
||||
return this.editorService.openEditors([
|
||||
{ input: { resource: this.defaultKeybindingsResource, options: { pinned: true }, label: nls.localize('defaultKeybindings', "Default Keybindings"), description: '' }, position: EditorPosition.ONE },
|
||||
{ input: { resource: editableKeybindings, options: { pinned: true } }, position: EditorPosition.TWO },
|
||||
]).then(() => {
|
||||
this.editorGroupService.focusGroup(EditorPosition.TWO);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
return this.editorService.openEditor(this.instantiationService.createInstance(KeybindingsEditorInput), { pinned: true }).then(() => null);
|
||||
}
|
||||
|
||||
configureSettingsForLanguage(language: string): void {
|
||||
this.openGlobalSettings()
|
||||
.then(editor => {
|
||||
const codeEditor = getCodeEditor(editor);
|
||||
this.getPosition(language, codeEditor)
|
||||
.then(position => {
|
||||
codeEditor.setPosition(position);
|
||||
codeEditor.focus();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private doOpenSettings(configurationTarget: ConfigurationTarget, resource: URI, options?: IEditorOptions, position?: EditorPosition): TPromise<IEditor> {
|
||||
const openDefaultSettings = !!this.configurationService.getValue(DEFAULT_SETTINGS_EDITOR_SETTING);
|
||||
return this.getOrCreateEditableSettingsEditorInput(configurationTarget, resource)
|
||||
.then(editableSettingsEditorInput => {
|
||||
if (!options) {
|
||||
options = { pinned: true };
|
||||
} else {
|
||||
options.pinned = true;
|
||||
}
|
||||
|
||||
if (openDefaultSettings) {
|
||||
const defaultPreferencesEditorInput = this.instantiationService.createInstance(DefaultPreferencesEditorInput, this.getDefaultSettingsResource(configurationTarget));
|
||||
const preferencesEditorInput = new PreferencesEditorInput(this.getPreferencesEditorInputName(configurationTarget, resource), editableSettingsEditorInput.getDescription(), defaultPreferencesEditorInput, <EditorInput>editableSettingsEditorInput);
|
||||
this.lastOpenedSettingsInput = preferencesEditorInput;
|
||||
return this.editorService.openEditor(preferencesEditorInput, options, position);
|
||||
}
|
||||
return this.editorService.openEditor(editableSettingsEditorInput, options, position);
|
||||
});
|
||||
}
|
||||
|
||||
private isDefaultSettingsResource(uri: URI): boolean {
|
||||
return uri.authority === 'defaultsettings' && uri.scheme === network.Schemas.vscode && !!uri.path.match(/\/(\d+\/)?settings\.json$/);
|
||||
}
|
||||
|
||||
private isDefaultResourceSettingsResource(uri: URI): boolean {
|
||||
return uri.authority === 'defaultsettings' && uri.scheme === network.Schemas.vscode && !!uri.path.match(/\/(\d+\/)?resourceSettings\.json$/);
|
||||
}
|
||||
|
||||
private getDefaultSettingsResource(configurationTarget: ConfigurationTarget): URI {
|
||||
if (configurationTarget === ConfigurationTarget.WORKSPACE_FOLDER) {
|
||||
return URI.from({ scheme: network.Schemas.vscode, authority: 'defaultsettings', path: `/${this._defaultResourceSettingsUriCounter++}/resourceSettings.json` });
|
||||
} else {
|
||||
return URI.from({ scheme: network.Schemas.vscode, authority: 'defaultsettings', path: `/${this._defaultSettingsUriCounter++}/settings.json` });
|
||||
}
|
||||
}
|
||||
|
||||
private getPreferencesEditorInputName(target: ConfigurationTarget, resource: URI): string {
|
||||
const name = getSettingsTargetName(target, resource, this.contextService);
|
||||
return target === ConfigurationTarget.WORKSPACE_FOLDER ? nls.localize('folderSettingsName', "{0} (Folder Settings)", name) : name;
|
||||
}
|
||||
|
||||
private getOrCreateEditableSettingsEditorInput(target: ConfigurationTarget, resource: URI): TPromise<EditorInput> {
|
||||
return this.createSettingsIfNotExists(target, resource)
|
||||
.then(() => <EditorInput>this.editorService.createInput({ resource }));
|
||||
}
|
||||
|
||||
private createEditableSettingsEditorModel(configurationTarget: ConfigurationTarget, resource: URI): TPromise<SettingsEditorModel> {
|
||||
const settingsUri = this.getEditableSettingsURI(configurationTarget, resource);
|
||||
if (settingsUri) {
|
||||
const workspace = this.contextService.getWorkspace();
|
||||
if (workspace.configuration && workspace.configuration.toString() === settingsUri.toString()) {
|
||||
return this.textModelResolverService.createModelReference(settingsUri)
|
||||
.then(reference => this.instantiationService.createInstance(WorkspaceConfigurationEditorModel, reference, configurationTarget));
|
||||
}
|
||||
return this.textModelResolverService.createModelReference(settingsUri)
|
||||
.then(reference => this.instantiationService.createInstance(SettingsEditorModel, reference, configurationTarget));
|
||||
}
|
||||
return TPromise.wrap<SettingsEditorModel>(null);
|
||||
}
|
||||
|
||||
private createDefaultSettingsEditorModel(defaultSettingsUri: URI): TPromise<DefaultSettingsEditorModel> {
|
||||
return this.textModelResolverService.createModelReference(defaultSettingsUri)
|
||||
.then(reference => {
|
||||
const scope = this.isDefaultSettingsResource(defaultSettingsUri) ? ConfigurationScope.WINDOW : ConfigurationScope.RESOURCE;
|
||||
return this.instantiationService.createInstance(DefaultSettingsEditorModel, defaultSettingsUri, reference, scope, this.getDefaultSettings(scope));
|
||||
});
|
||||
}
|
||||
|
||||
private getDefaultSettings(scope: ConfigurationScope): DefaultSettings {
|
||||
switch (scope) {
|
||||
case ConfigurationScope.WINDOW:
|
||||
if (!this._defaultSettingsContentModel) {
|
||||
this._defaultSettingsContentModel = new DefaultSettings(this.getMostCommonlyUsedSettings(), scope);
|
||||
}
|
||||
return this._defaultSettingsContentModel;
|
||||
case ConfigurationScope.RESOURCE:
|
||||
if (!this._defaultResourceSettingsContentModel) {
|
||||
this._defaultResourceSettingsContentModel = new DefaultSettings(this.getMostCommonlyUsedSettings(), scope);
|
||||
}
|
||||
return this._defaultResourceSettingsContentModel;
|
||||
}
|
||||
}
|
||||
|
||||
private getEditableSettingsURI(configurationTarget: ConfigurationTarget, resource?: URI): URI {
|
||||
switch (configurationTarget) {
|
||||
case ConfigurationTarget.USER:
|
||||
return URI.file(this.environmentService.appSettingsPath);
|
||||
case ConfigurationTarget.WORKSPACE:
|
||||
if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) {
|
||||
return null;
|
||||
}
|
||||
const workspace = this.contextService.getWorkspace();
|
||||
return workspace.configuration || workspace.folders[0].toResource(FOLDER_SETTINGS_PATH);
|
||||
case ConfigurationTarget.WORKSPACE_FOLDER:
|
||||
const folder = this.contextService.getWorkspaceFolder(resource);
|
||||
return folder ? folder.toResource(FOLDER_SETTINGS_PATH) : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private createSettingsIfNotExists(target: ConfigurationTarget, resource: URI): TPromise<void> {
|
||||
if (this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE && target === ConfigurationTarget.WORKSPACE) {
|
||||
return this.fileService.resolveContent(this.contextService.getWorkspace().configuration)
|
||||
.then(content => {
|
||||
if (Object.keys(parse(content.value)).indexOf('settings') === -1) {
|
||||
return this.jsonEditingService.write(resource, { key: 'settings', value: {} }, true).then(null, () => { });
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
return this.createIfNotExists(resource, emptyEditableSettingsContent).then(() => { });
|
||||
}
|
||||
|
||||
private createIfNotExists(resource: URI, contents: string): TPromise<any> {
|
||||
return this.fileService.resolveContent(resource, { acceptTextOnly: true }).then(null, error => {
|
||||
if ((<FileOperationError>error).fileOperationResult === FileOperationResult.FILE_NOT_FOUND) {
|
||||
return this.fileService.updateContent(resource, contents).then(null, error => {
|
||||
return TPromise.wrapError(new Error(nls.localize('fail.createSettings', "Unable to create '{0}' ({1}).", labels.getPathLabel(resource, this.contextService, this.environmentService), error)));
|
||||
});
|
||||
}
|
||||
|
||||
return TPromise.wrapError(error);
|
||||
});
|
||||
}
|
||||
|
||||
private getMostCommonlyUsedSettings(): string[] {
|
||||
return [
|
||||
'files.autoSave',
|
||||
'editor.fontSize',
|
||||
'editor.fontFamily',
|
||||
'editor.tabSize',
|
||||
'editor.renderWhitespace',
|
||||
'editor.cursorStyle',
|
||||
'editor.multiCursorModifier',
|
||||
'editor.insertSpaces',
|
||||
'editor.wordWrap',
|
||||
'files.exclude',
|
||||
'files.associations'
|
||||
];
|
||||
}
|
||||
|
||||
private getPosition(language: string, codeEditor: ICodeEditor): TPromise<IPosition> {
|
||||
return this.createPreferencesEditorModel(this.userSettingsResource)
|
||||
.then((settingsModel: IPreferencesEditorModel<ISetting>) => {
|
||||
const languageKey = `[${language}]`;
|
||||
let setting = settingsModel.getPreference(languageKey);
|
||||
const model = codeEditor.getModel();
|
||||
const configuration = this.configurationService.getValue<{ editor: { tabSize: number; insertSpaces: boolean }, files: { eol: string } }>();
|
||||
const eol = configuration.files && configuration.files.eol;
|
||||
if (setting) {
|
||||
if (setting.overrides.length) {
|
||||
const lastSetting = setting.overrides[setting.overrides.length - 1];
|
||||
let content;
|
||||
if (lastSetting.valueRange.endLineNumber === setting.range.endLineNumber) {
|
||||
content = ',' + eol + this.spaces(2, configuration.editor) + eol + this.spaces(1, configuration.editor);
|
||||
} else {
|
||||
content = ',' + eol + this.spaces(2, configuration.editor);
|
||||
}
|
||||
const editOperation = EditOperation.insert(new Position(lastSetting.valueRange.endLineNumber, lastSetting.valueRange.endColumn), content);
|
||||
model.pushEditOperations([], [editOperation], () => []);
|
||||
return { lineNumber: lastSetting.valueRange.endLineNumber + 1, column: model.getLineMaxColumn(lastSetting.valueRange.endLineNumber + 1) };
|
||||
}
|
||||
return { lineNumber: setting.valueRange.startLineNumber, column: setting.valueRange.startColumn + 1 };
|
||||
}
|
||||
return this.configurationService.updateValue(languageKey, {}, ConfigurationTarget.USER)
|
||||
.then(() => {
|
||||
setting = settingsModel.getPreference(languageKey);
|
||||
let content = eol + this.spaces(2, configuration.editor) + eol + this.spaces(1, configuration.editor);
|
||||
let editOperation = EditOperation.insert(new Position(setting.valueRange.endLineNumber, setting.valueRange.endColumn - 1), content);
|
||||
model.pushEditOperations([], [editOperation], () => []);
|
||||
let lineNumber = setting.valueRange.endLineNumber + 1;
|
||||
settingsModel.dispose();
|
||||
return { lineNumber, column: model.getLineMaxColumn(lineNumber) };
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private spaces(count: number, { tabSize, insertSpaces }: { tabSize: number; insertSpaces: boolean }): string {
|
||||
return insertSpaces ? strings.repeat(' ', tabSize * count) : strings.repeat('\t', count);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._onDispose.fire();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
@@ -5,19 +5,19 @@
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { Dimension, $ } from 'vs/base/browser/builder';
|
||||
import { $ } from 'vs/base/browser/builder';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { Widget } from 'vs/base/browser/ui/widget';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition, OverlayWidgetPositionPreference, IViewZone, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser';
|
||||
import { InputBox, IInputOptions } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { ISettingsGroup } from 'vs/workbench/parts/preferences/common/preferences';
|
||||
import { ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IWorkspaceContextService, WorkbenchState, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { IAction, Action } from 'vs/base/common/actions';
|
||||
@@ -102,7 +102,7 @@ export class SettingsHeaderWidget extends Widget implements IViewZone {
|
||||
export class DefaultSettingsHeaderWidget extends SettingsHeaderWidget {
|
||||
|
||||
private _onClick = this._register(new Emitter<void>());
|
||||
public onClick: Event<void> = this._onClick.event;
|
||||
public readonly onClick: Event<void> = this._onClick.event;
|
||||
|
||||
protected create() {
|
||||
super.create();
|
||||
@@ -130,7 +130,7 @@ export class SettingsGroupTitleWidget extends Widget implements IViewZone {
|
||||
private title: HTMLElement;
|
||||
|
||||
private _onToggled = this._register(new Emitter<boolean>());
|
||||
public onToggled: Event<boolean> = this._onToggled.event;
|
||||
public readonly onToggled: Event<boolean> = this._onToggled.event;
|
||||
|
||||
private previousPosition: Position;
|
||||
|
||||
@@ -324,7 +324,7 @@ export class FolderSettingsActionItem extends BaseActionItem {
|
||||
this.labelElement = DOM.$('.action-title');
|
||||
this.detailsElement = DOM.$('.action-details');
|
||||
this.dropDownElement = DOM.$('.dropdown-icon.octicon.octicon-triangle-down.hide');
|
||||
this.anchorElement = DOM.$('a.action-label', {
|
||||
this.anchorElement = DOM.$('a.action-label.folder-settings', {
|
||||
role: 'button',
|
||||
'aria-haspopup': 'true',
|
||||
'tabindex': '0'
|
||||
@@ -461,7 +461,7 @@ export class SettingsTargetsWidget extends Widget {
|
||||
|
||||
private _settingsTarget: SettingsTarget;
|
||||
|
||||
private _onDidTargetChange: Emitter<SettingsTarget> = new Emitter<SettingsTarget>();
|
||||
private readonly _onDidTargetChange: Emitter<SettingsTarget> = new Emitter<SettingsTarget>();
|
||||
public readonly onDidTargetChange: Event<SettingsTarget> = this._onDidTargetChange.event;
|
||||
|
||||
constructor(
|
||||
@@ -573,10 +573,10 @@ export class SearchWidget extends Widget {
|
||||
private inputBox: InputBox;
|
||||
private controlsDiv: HTMLElement;
|
||||
|
||||
private _onDidChange: Emitter<string> = this._register(new Emitter<string>());
|
||||
private readonly _onDidChange: Emitter<string> = this._register(new Emitter<string>());
|
||||
public readonly onDidChange: Event<string> = this._onDidChange.event;
|
||||
|
||||
private _onFocus: Emitter<void> = this._register(new Emitter<void>());
|
||||
private readonly _onFocus: Emitter<void> = this._register(new Emitter<void>());
|
||||
public readonly onFocus: Event<void> = this._onFocus.event;
|
||||
|
||||
constructor(parent: HTMLElement, protected options: SearchOptions,
|
||||
@@ -649,7 +649,7 @@ export class SearchWidget extends Widget {
|
||||
this.countElement.style.color = color ? color.toString() : null;
|
||||
}
|
||||
|
||||
public layout(dimension: Dimension) {
|
||||
public layout(dimension: DOM.Dimension) {
|
||||
if (dimension.width < 400) {
|
||||
if (this.countElement) {
|
||||
DOM.addClass(this.countElement, 'hide');
|
||||
@@ -705,8 +705,8 @@ export class FloatingClickWidget extends Widget implements IOverlayWidget {
|
||||
|
||||
private _domNode: HTMLElement;
|
||||
|
||||
private _onClick: Emitter<void> = this._register(new Emitter<void>());
|
||||
public onClick: Event<void> = this._onClick.event;
|
||||
private readonly _onClick: Emitter<void> = this._register(new Emitter<void>());
|
||||
public readonly onClick: Event<void> = this._onClick.event;
|
||||
|
||||
constructor(
|
||||
private editor: ICodeEditor,
|
||||
@@ -728,8 +728,8 @@ export class FloatingClickWidget extends Widget implements IOverlayWidget {
|
||||
public render() {
|
||||
this._domNode = DOM.$('.floating-click-widget');
|
||||
this._register(attachStylerCallback(this.themeService, { buttonBackground, buttonForeground }, colors => {
|
||||
this._domNode.style.backgroundColor = colors.buttonBackground;
|
||||
this._domNode.style.color = colors.buttonForeground;
|
||||
this._domNode.style.backgroundColor = colors.buttonBackground ? colors.buttonBackground.toString() : null;
|
||||
this._domNode.style.color = colors.buttonForeground ? colors.buttonForeground.toString() : null;
|
||||
}));
|
||||
|
||||
DOM.append(this._domNode, DOM.$('')).textContent = this.label;
|
||||
@@ -766,7 +766,7 @@ export class EditPreferenceWidget<T> extends Disposable {
|
||||
|
||||
private _editPreferenceDecoration: string[];
|
||||
|
||||
private _onClick: Emitter<IEditorMouseEvent> = new Emitter<IEditorMouseEvent>();
|
||||
private readonly _onClick: Emitter<IEditorMouseEvent> = new Emitter<IEditorMouseEvent>();
|
||||
public get onClick(): Event<IEditorMouseEvent> { return this._onClick.event; }
|
||||
|
||||
constructor(private editor: ICodeEditor
|
||||
|
||||
Reference in New Issue
Block a user