diff --git a/src/vs/workbench/common/editor/rangeDecorations.ts b/src/vs/workbench/common/editor/rangeDecorations.ts index aee5a530fb8..e0c82ca6476 100644 --- a/src/vs/workbench/common/editor/rangeDecorations.ts +++ b/src/vs/workbench/common/editor/rangeDecorations.ts @@ -25,9 +25,9 @@ export class RangeHighlightDecorations implements IDisposable { constructor(@IWorkbenchEditorService private editorService: IWorkbenchEditorService) { } - public clearCurrentFileRangeDecoration() { + public removeHighlightRange() { if (this.editor && this.rangeHighlightDecorationId) { - this.doClearRangeDecoration(this.editor, this.rangeHighlightDecorationId); + this.doRemoveRangeHighlight(this.editor, this.rangeHighlightDecorationId); } this.rangeHighlightDecorationId = null; } @@ -40,11 +40,11 @@ export class RangeHighlightDecorations implements IDisposable { } private doHighlightRange(editor: editorCommon.ICommonCodeEditor, selectionRange: IRangeHighlightDecoration) { - this.clearCurrentFileRangeDecoration(); + this.removeHighlightRange(); editor.changeDecorations((changeAccessor: editorCommon.IModelDecorationsChangeAccessor) => { this.rangeHighlightDecorationId = changeAccessor.addDecoration(selectionRange.range, this.createRangeHighlightDecoration()); }); - this.updateEditor(editor); + this.setEditor(editor); } private getEditor(resourceRange: IRangeHighlightDecoration): IEditor { @@ -57,7 +57,7 @@ export class RangeHighlightDecorations implements IDisposable { return null; } - private updateEditor(editor: editorCommon.ICommonCodeEditor) { + private setEditor(editor: editorCommon.ICommonCodeEditor) { if (this.editor !== editor) { this.disposeEditorListeners(); this.editor = editor; @@ -67,12 +67,12 @@ export class RangeHighlightDecorations implements IDisposable { || e.reason === editorCommon.CursorChangeReason.Undo || e.reason === editorCommon.CursorChangeReason.Redo ) { - this.doClearRangeDecoration(this.editor, this.rangeHighlightDecorationId); + this.doRemoveRangeHighlight(this.editor, this.rangeHighlightDecorationId); } })); - this.editorDisposables.push(this.editor.onDidChangeModel(() => { this.doClearRangeDecoration(this.editor, this.rangeHighlightDecorationId); })); + this.editorDisposables.push(this.editor.onDidChangeModel(() => { this.doRemoveRangeHighlight(this.editor, this.rangeHighlightDecorationId); })); this.editorDisposables.push(this.editor.onDidDispose(() => { - this.doClearRangeDecoration(this.editor, this.rangeHighlightDecorationId); + this.doRemoveRangeHighlight(this.editor, this.rangeHighlightDecorationId); this.editor = null; })); } @@ -83,7 +83,7 @@ export class RangeHighlightDecorations implements IDisposable { this.editorDisposables = []; } - private doClearRangeDecoration(model: editorCommon.ICommonCodeEditor, rangeHighlightDecorationId: string) { + private doRemoveRangeHighlight(model: editorCommon.ICommonCodeEditor, rangeHighlightDecorationId: string) { model.deltaDecorations([rangeHighlightDecorationId], []); } @@ -96,7 +96,7 @@ export class RangeHighlightDecorations implements IDisposable { } public dispose() { - this.clearCurrentFileRangeDecoration(); + this.removeHighlightRange(); this.disposeEditorListeners(); this.editor = null; } diff --git a/src/vs/workbench/parts/markers/browser/markersPanel.ts b/src/vs/workbench/parts/markers/browser/markersPanel.ts index b9fbe2e6607..710ff436e94 100644 --- a/src/vs/workbench/parts/markers/browser/markersPanel.ts +++ b/src/vs/workbench/parts/markers/browser/markersPanel.ts @@ -128,7 +128,7 @@ export class MarkersPanel extends Panel { public setVisible(visible: boolean): TPromise { let promise: TPromise = super.setVisible(visible); if (!visible) { - this.rangeHighlightDecorations.clearCurrentFileRangeDecoration(); + this.rangeHighlightDecorations.removeHighlightRange(); } return promise; } @@ -313,7 +313,7 @@ export class MarkersPanel extends Panel { } private updateRangeHighlights() { - this.rangeHighlightDecorations.clearCurrentFileRangeDecoration(); + this.rangeHighlightDecorations.removeHighlightRange(); if (this.tree.isDOMFocused()) { this.highlightCurrentSelectedMarkerRange(); } diff --git a/src/vs/workbench/parts/markers/browser/markersTreeController.ts b/src/vs/workbench/parts/markers/browser/markersTreeController.ts index 25587727bee..057d2a1eb20 100644 --- a/src/vs/workbench/parts/markers/browser/markersTreeController.ts +++ b/src/vs/workbench/parts/markers/browser/markersTreeController.ts @@ -53,7 +53,7 @@ export class Controller extends treedefaults.DefaultController { tree.setSelection([element]); return this.openFileAtElement(tree.getFocus(), true, false, false); } else { - this.rangeHighlightDecorations.clearCurrentFileRangeDecoration(); + this.rangeHighlightDecorations.removeHighlightRange(); } return super.onSpace(tree, event); } @@ -79,12 +79,12 @@ export class Controller extends treedefaults.DefaultController { if (preserveFocus) { this.rangeHighlightDecorations.highlightRange(element, editor); } else { - this.rangeHighlightDecorations.clearCurrentFileRangeDecoration(); + this.rangeHighlightDecorations.removeHighlightRange(); } }, errors.onUnexpectedError); return true; } else { - this.rangeHighlightDecorations.clearCurrentFileRangeDecoration(); + this.rangeHighlightDecorations.removeHighlightRange(); } return false; } diff --git a/src/vs/workbench/parts/search/browser/searchViewlet.ts b/src/vs/workbench/parts/search/browser/searchViewlet.ts index 819f1939f63..a6363176d64 100644 --- a/src/vs/workbench/parts/search/browser/searchViewlet.ts +++ b/src/vs/workbench/parts/search/browser/searchViewlet.ts @@ -900,7 +900,7 @@ export class SearchViewlet extends Viewlet { private onFocus(lineMatch: any, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): TPromise { if (!(lineMatch instanceof Match)) { - this.viewModel.searchResult.rangeHighlightDecorations.clearCurrentFileRangeDecoration(); + this.viewModel.searchResult.rangeHighlightDecorations.removeHighlightRange(); return TPromise.as(true); } @@ -927,7 +927,7 @@ export class SearchViewlet extends Viewlet { range: element.range() }, editor); } else { - this.viewModel.searchResult.rangeHighlightDecorations.clearCurrentFileRangeDecoration(); + this.viewModel.searchResult.rangeHighlightDecorations.removeHighlightRange(); } }, errors.onUnexpectedError); } diff --git a/src/vs/workbench/parts/search/common/searchModel.ts b/src/vs/workbench/parts/search/common/searchModel.ts index 46a59940f2c..a617df1ec08 100644 --- a/src/vs/workbench/parts/search/common/searchModel.ts +++ b/src/vs/workbench/parts/search/common/searchModel.ts @@ -415,7 +415,7 @@ export class SearchResult extends Disposable { range: selectedMatch.range() }); } else { - this._rangeHighlightDecorations.clearCurrentFileRangeDecoration(); + this._rangeHighlightDecorations.removeHighlightRange(); } } @@ -465,7 +465,7 @@ export class SearchResult extends Disposable { this._unDisposedFileMatches.values().forEach((fileMatch: FileMatch) => fileMatch.dispose()); this._fileMatches.clear(); this._unDisposedFileMatches.clear(); - this._rangeHighlightDecorations.clearCurrentFileRangeDecoration(); + this._rangeHighlightDecorations.removeHighlightRange(); } public dispose(): void {