mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-28 08:04:00 +01:00
Adopt new configuration change event in markers and preferences areas
This commit is contained in:
@@ -19,7 +19,7 @@ import { IEditorGroupService } from 'vs/workbench/services/group/common/groupSer
|
||||
import { Panel } from 'vs/workbench/browser/panel';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import Constants from 'vs/workbench/parts/markers/common/constants';
|
||||
import { IProblemsConfiguration, MarkersModel, Marker, Resource, FilterOptions } from 'vs/workbench/parts/markers/common/markersModel';
|
||||
import { MarkersModel, Marker, Resource, FilterOptions } from 'vs/workbench/parts/markers/common/markersModel';
|
||||
import { Controller } from 'vs/workbench/parts/markers/browser/markersTreeController';
|
||||
import Tree = require('vs/base/parts/tree/browser/tree');
|
||||
import TreeImpl = require('vs/base/parts/tree/browser/treeImpl');
|
||||
@@ -47,7 +47,6 @@ export class MarkersPanel extends Panel {
|
||||
|
||||
private lastSelectedRelativeTop: number = 0;
|
||||
private currentActiveResource: URI = null;
|
||||
private hasToAutoReveal: boolean;
|
||||
|
||||
private tree: Tree.ITree;
|
||||
private autoExpanded: Set<string>;
|
||||
@@ -90,9 +89,6 @@ export class MarkersPanel extends Panel {
|
||||
|
||||
dom.addClass(parent.getHTMLElement(), 'markers-panel');
|
||||
|
||||
const conf = this.configurationService.getConfiguration<IProblemsConfiguration>();
|
||||
this.onConfigurationsUpdated(conf);
|
||||
|
||||
let container = dom.append(parent.getHTMLElement(), dom.$('.markers-panel-container'));
|
||||
|
||||
this.createMessageBox(container);
|
||||
@@ -253,7 +249,6 @@ export class MarkersPanel extends Panel {
|
||||
}
|
||||
|
||||
private createListeners(): void {
|
||||
this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationsUpdated(this.configurationService.getConfiguration<IProblemsConfiguration>())));
|
||||
this.toUnbind.push(this.markerService.onMarkerChanged(this.onMarkerChanged, this));
|
||||
this.toUnbind.push(this.editorGroupService.onEditorsChanged(this.onEditorsChanged, this));
|
||||
this.toUnbind.push(this.tree.addListener('selection', () => this.onSelected()));
|
||||
@@ -289,10 +284,6 @@ export class MarkersPanel extends Panel {
|
||||
this.autoReveal();
|
||||
}
|
||||
|
||||
private onConfigurationsUpdated(conf: IProblemsConfiguration): void {
|
||||
this.hasToAutoReveal = conf && conf.problems && conf.problems.autoReveal;
|
||||
}
|
||||
|
||||
private onSelected(): void {
|
||||
let selection = this.tree.getSelection();
|
||||
if (selection && selection.length > 0) {
|
||||
@@ -338,8 +329,8 @@ export class MarkersPanel extends Panel {
|
||||
}
|
||||
|
||||
private autoReveal(focus: boolean = false): void {
|
||||
let conf = this.configurationService.getConfiguration<IProblemsConfiguration>();
|
||||
if (conf && conf.problems && conf.problems.autoReveal) {
|
||||
let autoReveal = this.configurationService.getValue<boolean>('problems.autoReveal');
|
||||
if (typeof autoReveal === 'boolean' && autoReveal) {
|
||||
this.revealMarkersForCurrentActiveEditor(focus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorE
|
||||
import { ModelDecorationOptions } from 'vs/editor/common/model/textModelWithDecorations';
|
||||
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 { overrideIdentifierFromKey, IConfigurationService, ConfigurationTarget, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export interface IPreferencesRenderer<T> extends IDisposable {
|
||||
preferencesModel: IPreferencesEditorModel<T>;
|
||||
@@ -950,7 +950,7 @@ class UnsupportedWorkspaceSettingsRenderer extends Disposable {
|
||||
@IMarkerService private markerService: IMarkerService
|
||||
) {
|
||||
super();
|
||||
this._register(this.configurationService.onDidChangeConfiguration(() => this.render()));
|
||||
this._register(this.configurationService.onDidChangeConfiguration(e => this.onDidConfigurationChange(e)));
|
||||
}
|
||||
|
||||
private getMarkerMessage(settingKey: string): string {
|
||||
@@ -987,6 +987,12 @@ class UnsupportedWorkspaceSettingsRenderer extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private onDidConfigurationChange(event: IConfigurationChangeEvent): void {
|
||||
if (event.source === ConfigurationTarget.DEFAULT || event.source === ConfigurationTarget.WORKSPACE || event.source === ConfigurationTarget.WORKSPACE_FOLDER) {
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.markerService.remove('preferencesEditor', [this.workspaceSettingsEditorModel.uri]);
|
||||
super.dispose();
|
||||
|
||||
@@ -38,7 +38,11 @@ export class PreferencesContribution implements IWorkbenchContribution {
|
||||
@IWorkspaceContextService private workspaceService: IWorkspaceContextService,
|
||||
@IConfigurationService private configurationService: IConfigurationService
|
||||
) {
|
||||
this.settingsListener = this.configurationService.onDidChangeConfiguration(() => this.handleSettingsEditorOverride());
|
||||
this.settingsListener = this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration(DEFAULT_SETTINGS_EDITOR_SETTING)) {
|
||||
this.handleSettingsEditorOverride();
|
||||
}
|
||||
});
|
||||
this.handleSettingsEditorOverride();
|
||||
|
||||
this.start();
|
||||
|
||||
Reference in New Issue
Block a user