提交 49b07391 编写于 作者: A Alexandru Dima 提交者: GitHub

Merge pull request #11115 from Microsoft/sandy081/renameLineHighlight

Rename lineHighlight to rangeHighlight
...@@ -112,11 +112,11 @@ ...@@ -112,11 +112,11 @@
top: 0; top: 0;
} }
/* -------------------- Highlight a line -------------------- */ /* -------------------- Highlight a range -------------------- */
.monaco-editor.vs .lineHighlight { background: rgba(253, 255, 0, 0.2); } .monaco-editor.vs .rangeHighlight { background: rgba(253, 255, 0, 0.2); }
.monaco-editor.vs-dark .lineHighlight { background: rgba(243, 240, 245, 0.2); } .monaco-editor.vs-dark .rangeHighlight { background: rgba(243, 240, 245, 0.2); }
.monaco-editor.hc-black .lineHighlight { background: rgba(243, 240, 245, 0.2); } .monaco-editor.hc-black .rangeHighlight { background: rgba(243, 240, 245, 0.2); }
/* -------------------- Squigglies -------------------- */ /* -------------------- Squigglies -------------------- */
......
...@@ -14,7 +14,7 @@ export class FindDecorations implements IDisposable { ...@@ -14,7 +14,7 @@ export class FindDecorations implements IDisposable {
private _editor:editorCommon.ICommonCodeEditor; private _editor:editorCommon.ICommonCodeEditor;
private _decorations:string[]; private _decorations:string[];
private _findScopeDecorationId:string; private _findScopeDecorationId:string;
private _lineHighlightDecorationId:string; private _rangeHighlightDecorationId:string;
private _highlightedDecorationId:string; private _highlightedDecorationId:string;
private _startPosition:Position; private _startPosition:Position;
...@@ -22,7 +22,7 @@ export class FindDecorations implements IDisposable { ...@@ -22,7 +22,7 @@ export class FindDecorations implements IDisposable {
this._editor = editor; this._editor = editor;
this._decorations = []; this._decorations = [];
this._findScopeDecorationId = null; this._findScopeDecorationId = null;
this._lineHighlightDecorationId = null; this._rangeHighlightDecorationId = null;
this._highlightedDecorationId = null; this._highlightedDecorationId = null;
this._startPosition = this._editor.getPosition(); this._startPosition = this._editor.getPosition();
} }
...@@ -33,7 +33,7 @@ export class FindDecorations implements IDisposable { ...@@ -33,7 +33,7 @@ export class FindDecorations implements IDisposable {
this._editor = null; this._editor = null;
this._decorations = []; this._decorations = [];
this._findScopeDecorationId = null; this._findScopeDecorationId = null;
this._lineHighlightDecorationId = null; this._rangeHighlightDecorationId = null;
this._highlightedDecorationId = null; this._highlightedDecorationId = null;
this._startPosition = null; this._startPosition = null;
} }
...@@ -41,7 +41,7 @@ export class FindDecorations implements IDisposable { ...@@ -41,7 +41,7 @@ export class FindDecorations implements IDisposable {
public reset(): void { public reset(): void {
this._decorations = []; this._decorations = [];
this._findScopeDecorationId = null; this._findScopeDecorationId = null;
this._lineHighlightDecorationId = null; this._rangeHighlightDecorationId = null;
this._highlightedDecorationId = null; this._highlightedDecorationId = null;
} }
...@@ -99,13 +99,13 @@ export class FindDecorations implements IDisposable { ...@@ -99,13 +99,13 @@ export class FindDecorations implements IDisposable {
this._highlightedDecorationId = newCurrentDecorationId; this._highlightedDecorationId = newCurrentDecorationId;
changeAccessor.changeDecorationOptions(this._highlightedDecorationId, FindDecorations.createFindMatchDecorationOptions(true)); changeAccessor.changeDecorationOptions(this._highlightedDecorationId, FindDecorations.createFindMatchDecorationOptions(true));
} }
if (this._lineHighlightDecorationId !== null) { if (this._rangeHighlightDecorationId !== null) {
changeAccessor.removeDecoration(this._lineHighlightDecorationId); changeAccessor.removeDecoration(this._rangeHighlightDecorationId);
this._lineHighlightDecorationId = null; this._rangeHighlightDecorationId = null;
} }
if (newCurrentDecorationId !== null) { if (newCurrentDecorationId !== null) {
let rng = this._editor.getModel().getDecorationRange(newCurrentDecorationId); let rng = this._editor.getModel().getDecorationRange(newCurrentDecorationId);
this._lineHighlightDecorationId = changeAccessor.addDecoration(rng, FindDecorations.createLineHighlightDecoration()); this._rangeHighlightDecorationId = changeAccessor.addDecoration(rng, FindDecorations.createRangeHighlightDecoration());
} }
}); });
} }
...@@ -134,7 +134,7 @@ export class FindDecorations implements IDisposable { ...@@ -134,7 +134,7 @@ export class FindDecorations implements IDisposable {
this._findScopeDecorationId = null; this._findScopeDecorationId = null;
} }
this._decorations = tmpDecorations; this._decorations = tmpDecorations;
this._lineHighlightDecorationId = null; this._rangeHighlightDecorationId = null;
this._highlightedDecorationId = null; this._highlightedDecorationId = null;
} }
...@@ -144,8 +144,8 @@ export class FindDecorations implements IDisposable { ...@@ -144,8 +144,8 @@ export class FindDecorations implements IDisposable {
if (this._findScopeDecorationId) { if (this._findScopeDecorationId) {
result.push(this._findScopeDecorationId); result.push(this._findScopeDecorationId);
} }
if (this._lineHighlightDecorationId) { if (this._rangeHighlightDecorationId) {
result.push(this._lineHighlightDecorationId); result.push(this._rangeHighlightDecorationId);
} }
return result; return result;
} }
...@@ -162,10 +162,10 @@ export class FindDecorations implements IDisposable { ...@@ -162,10 +162,10 @@ export class FindDecorations implements IDisposable {
}; };
} }
private static createLineHighlightDecoration(): editorCommon.IModelDecorationOptions { private static createRangeHighlightDecoration(): editorCommon.IModelDecorationOptions {
return { return {
stickiness: editorCommon.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges, stickiness: editorCommon.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
className: 'lineHighlight', className: 'rangeHighlight',
isWholeLine: true isWholeLine: true
}; };
} }
......
...@@ -29,7 +29,7 @@ export class QuickOpenController implements editorCommon.IEditorContribution { ...@@ -29,7 +29,7 @@ export class QuickOpenController implements editorCommon.IEditorContribution {
private editor:ICodeEditor; private editor:ICodeEditor;
private widget:QuickOpenEditorWidget; private widget:QuickOpenEditorWidget;
private lineHighlightDecorationId:string; private rangeHighlightDecorationId:string;
private lastKnownEditorSelection:Selection; private lastKnownEditorSelection:Selection;
constructor(editor:ICodeEditor) { constructor(editor:ICodeEditor) {
...@@ -93,31 +93,31 @@ export class QuickOpenController implements editorCommon.IEditorContribution { ...@@ -93,31 +93,31 @@ export class QuickOpenController implements editorCommon.IEditorContribution {
public decorateLine(range:editorCommon.IRange, editor:ICodeEditor):void { public decorateLine(range:editorCommon.IRange, editor:ICodeEditor):void {
editor.changeDecorations((changeAccessor:editorCommon.IModelDecorationsChangeAccessor)=>{ editor.changeDecorations((changeAccessor:editorCommon.IModelDecorationsChangeAccessor)=>{
var oldDecorations: string[] = []; var oldDecorations: string[] = [];
if (this.lineHighlightDecorationId) { if (this.rangeHighlightDecorationId) {
oldDecorations.push(this.lineHighlightDecorationId); oldDecorations.push(this.rangeHighlightDecorationId);
this.lineHighlightDecorationId = null; this.rangeHighlightDecorationId = null;
} }
var newDecorations: editorCommon.IModelDeltaDecoration[] = [ var newDecorations: editorCommon.IModelDeltaDecoration[] = [
{ {
range: range, range: range,
options: { options: {
className: 'lineHighlight', className: 'rangeHighlight',
isWholeLine: true isWholeLine: true
} }
} }
]; ];
var decorations = changeAccessor.deltaDecorations(oldDecorations, newDecorations); var decorations = changeAccessor.deltaDecorations(oldDecorations, newDecorations);
this.lineHighlightDecorationId = decorations[0]; this.rangeHighlightDecorationId = decorations[0];
}); });
} }
public clearDecorations():void { public clearDecorations():void {
if (this.lineHighlightDecorationId) { if (this.rangeHighlightDecorationId) {
this.editor.changeDecorations((changeAccessor:editorCommon.IModelDecorationsChangeAccessor)=>{ this.editor.changeDecorations((changeAccessor:editorCommon.IModelDecorationsChangeAccessor)=>{
changeAccessor.deltaDecorations([this.lineHighlightDecorationId], []); changeAccessor.deltaDecorations([this.rangeHighlightDecorationId], []);
this.lineHighlightDecorationId = null; this.rangeHighlightDecorationId = null;
}); });
} }
} }
......
...@@ -161,13 +161,13 @@ class GotoLineEntry extends EditorQuickOpenEntry { ...@@ -161,13 +161,13 @@ class GotoLineEntry extends EditorQuickOpenEntry {
} }
interface IEditorLineDecoration { interface IEditorLineDecoration {
lineHighlightId: string; rangeHighlightId: string;
lineDecorationId: string; lineDecorationId: string;
position: Position; position: Position;
} }
export class GotoLineHandler extends QuickOpenHandler { export class GotoLineHandler extends QuickOpenHandler {
private lineHighlightDecorationId: IEditorLineDecoration; private rangeHighlightDecorationId: IEditorLineDecoration;
private lastKnownEditorViewState: IEditorViewState; private lastKnownEditorViewState: IEditorViewState;
constructor( @IWorkbenchEditorService private editorService: IWorkbenchEditorService) { constructor( @IWorkbenchEditorService private editorService: IWorkbenchEditorService) {
...@@ -200,18 +200,18 @@ export class GotoLineHandler extends QuickOpenHandler { ...@@ -200,18 +200,18 @@ export class GotoLineHandler extends QuickOpenHandler {
editor.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => { editor.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => {
let deleteDecorations: string[] = []; let deleteDecorations: string[] = [];
if (this.lineHighlightDecorationId) { if (this.rangeHighlightDecorationId) {
deleteDecorations.push(this.lineHighlightDecorationId.lineDecorationId); deleteDecorations.push(this.rangeHighlightDecorationId.lineDecorationId);
deleteDecorations.push(this.lineHighlightDecorationId.lineHighlightId); deleteDecorations.push(this.rangeHighlightDecorationId.rangeHighlightId);
this.lineHighlightDecorationId = null; this.rangeHighlightDecorationId = null;
} }
let newDecorations: IModelDeltaDecoration[] = [ let newDecorations: IModelDeltaDecoration[] = [
// lineHighlight at index 0 // rangeHighlight at index 0
{ {
range: range, range: range,
options: { options: {
className: 'lineHighlight', className: 'rangeHighlight',
isWholeLine: true isWholeLine: true
} }
}, },
...@@ -230,11 +230,11 @@ export class GotoLineHandler extends QuickOpenHandler { ...@@ -230,11 +230,11 @@ export class GotoLineHandler extends QuickOpenHandler {
]; ];
let decorations = changeAccessor.deltaDecorations(deleteDecorations, newDecorations); let decorations = changeAccessor.deltaDecorations(deleteDecorations, newDecorations);
let lineHighlightId = decorations[0]; let rangeHighlightId = decorations[0];
let lineDecorationId = decorations[1]; let lineDecorationId = decorations[1];
this.lineHighlightDecorationId = { this.rangeHighlightDecorationId = {
lineHighlightId: lineHighlightId, rangeHighlightId: rangeHighlightId,
lineDecorationId: lineDecorationId, lineDecorationId: lineDecorationId,
position: position position: position
}; };
...@@ -242,20 +242,20 @@ export class GotoLineHandler extends QuickOpenHandler { ...@@ -242,20 +242,20 @@ export class GotoLineHandler extends QuickOpenHandler {
} }
public clearDecorations(): void { public clearDecorations(): void {
if (this.lineHighlightDecorationId) { if (this.rangeHighlightDecorationId) {
this.editorService.getVisibleEditors().forEach((editor) => { this.editorService.getVisibleEditors().forEach((editor) => {
if (editor.position === this.lineHighlightDecorationId.position) { if (editor.position === this.rangeHighlightDecorationId.position) {
let editorControl = <IEditor>editor.getControl(); let editorControl = <IEditor>editor.getControl();
editorControl.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => { editorControl.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => {
changeAccessor.deltaDecorations([ changeAccessor.deltaDecorations([
this.lineHighlightDecorationId.lineDecorationId, this.rangeHighlightDecorationId.lineDecorationId,
this.lineHighlightDecorationId.lineHighlightId this.rangeHighlightDecorationId.rangeHighlightId
], []); ], []);
}); });
} }
}); });
this.lineHighlightDecorationId = null; this.rangeHighlightDecorationId = null;
} }
} }
......
...@@ -363,14 +363,14 @@ interface Outline { ...@@ -363,14 +363,14 @@ interface Outline {
} }
interface IEditorLineDecoration { interface IEditorLineDecoration {
lineHighlightId: string; rangeHighlightId: string;
lineDecorationId: string; lineDecorationId: string;
position: Position; position: Position;
} }
export class GotoSymbolHandler extends QuickOpenHandler { export class GotoSymbolHandler extends QuickOpenHandler {
private outlineToModelCache: { [modelId: string]: OutlineModel; }; private outlineToModelCache: { [modelId: string]: OutlineModel; };
private lineHighlightDecorationId: IEditorLineDecoration; private rangeHighlightDecorationId: IEditorLineDecoration;
private lastKnownEditorViewState: IEditorViewState; private lastKnownEditorViewState: IEditorViewState;
private activeOutlineRequest: TPromise<OutlineModel>; private activeOutlineRequest: TPromise<OutlineModel>;
...@@ -509,19 +509,19 @@ export class GotoSymbolHandler extends QuickOpenHandler { ...@@ -509,19 +509,19 @@ export class GotoSymbolHandler extends QuickOpenHandler {
editor.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => { editor.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => {
let deleteDecorations: string[] = []; let deleteDecorations: string[] = [];
if (this.lineHighlightDecorationId) { if (this.rangeHighlightDecorationId) {
deleteDecorations.push(this.lineHighlightDecorationId.lineDecorationId); deleteDecorations.push(this.rangeHighlightDecorationId.lineDecorationId);
deleteDecorations.push(this.lineHighlightDecorationId.lineHighlightId); deleteDecorations.push(this.rangeHighlightDecorationId.rangeHighlightId);
this.lineHighlightDecorationId = null; this.rangeHighlightDecorationId = null;
} }
let newDecorations: IModelDeltaDecoration[] = [ let newDecorations: IModelDeltaDecoration[] = [
// lineHighlight at index 0 // rangeHighlight at index 0
{ {
range: fullRange, range: fullRange,
options: { options: {
className: 'lineHighlight', className: 'rangeHighlight',
isWholeLine: true isWholeLine: true
} }
}, },
...@@ -541,11 +541,11 @@ export class GotoSymbolHandler extends QuickOpenHandler { ...@@ -541,11 +541,11 @@ export class GotoSymbolHandler extends QuickOpenHandler {
]; ];
let decorations = changeAccessor.deltaDecorations(deleteDecorations, newDecorations); let decorations = changeAccessor.deltaDecorations(deleteDecorations, newDecorations);
let lineHighlightId = decorations[0]; let rangeHighlightId = decorations[0];
let lineDecorationId = decorations[1]; let lineDecorationId = decorations[1];
this.lineHighlightDecorationId = { this.rangeHighlightDecorationId = {
lineHighlightId: lineHighlightId, rangeHighlightId: rangeHighlightId,
lineDecorationId: lineDecorationId, lineDecorationId: lineDecorationId,
position: position position: position
}; };
...@@ -553,20 +553,20 @@ export class GotoSymbolHandler extends QuickOpenHandler { ...@@ -553,20 +553,20 @@ export class GotoSymbolHandler extends QuickOpenHandler {
} }
public clearDecorations(): void { public clearDecorations(): void {
if (this.lineHighlightDecorationId) { if (this.rangeHighlightDecorationId) {
this.editorService.getVisibleEditors().forEach((editor) => { this.editorService.getVisibleEditors().forEach((editor) => {
if (editor.position === this.lineHighlightDecorationId.position) { if (editor.position === this.rangeHighlightDecorationId.position) {
let editorControl = <IEditor>editor.getControl(); let editorControl = <IEditor>editor.getControl();
editorControl.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => { editorControl.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => {
changeAccessor.deltaDecorations([ changeAccessor.deltaDecorations([
this.lineHighlightDecorationId.lineDecorationId, this.rangeHighlightDecorationId.lineDecorationId,
this.lineHighlightDecorationId.lineHighlightId this.rangeHighlightDecorationId.rangeHighlightId
], []); ], []);
}); });
} }
}); });
this.lineHighlightDecorationId = null; this.rangeHighlightDecorationId = null;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册