提交 580088df 编写于 作者: P Peng Lyu

Re #78168. Folding, find, color picker, dnd

上级 130499db
......@@ -17,11 +17,15 @@ export class MoveCaretCommand implements ICommand {
private _cutEndIndex: number;
private _moved: boolean;
private _selectionId: string;
private _selectionId: string | null;
constructor(selection: Selection, isMovingLeft: boolean) {
this._selection = selection;
this._isMovingLeft = isMovingLeft;
this._cutStartIndex = -1;
this._cutEndIndex = -1;
this._moved = false;
this._selectionId = null;
}
public getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void {
......@@ -64,7 +68,7 @@ export class MoveCaretCommand implements ICommand {
}
public computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection {
let result = helper.getTrackedSelection(this._selectionId);
let result = helper.getTrackedSelection(this._selectionId!);
if (this._moved) {
result = result.setStartPosition(result.startLineNumber, this._cutStartIndex);
result = result.setEndPosition(result.startLineNumber, this._cutEndIndex);
......
......@@ -123,8 +123,8 @@ class SaturationBox extends Disposable {
private readonly domNode: HTMLElement;
private readonly selection: HTMLElement;
private readonly canvas: HTMLCanvasElement;
private width: number;
private height: number;
private width!: number;
private height!: number;
private monitor: GlobalMouseMoveMonitor<IStandardMouseMoveEventData> | null;
private _onDidChange = new Emitter<{ s: number, v: number }>();
......@@ -235,7 +235,7 @@ abstract class Strip extends Disposable {
protected domNode: HTMLElement;
protected overlay: HTMLElement;
protected slider: HTMLElement;
private height: number;
private height!: number;
private _onDidChange = new Emitter<number>();
readonly onDidChange: Event<number> = this._onDidChange.event;
......
......@@ -14,13 +14,14 @@ export class DragAndDropCommand implements editorCommon.ICommand {
private readonly selection: Selection;
private readonly targetPosition: Position;
private targetSelection: Selection;
private targetSelection: Selection | null;
private readonly copy: boolean;
constructor(selection: Selection, targetPosition: Position, copy: boolean) {
this.selection = selection;
this.targetPosition = targetPosition;
this.copy = copy;
this.targetSelection = null;
}
public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void {
......@@ -102,6 +103,6 @@ export class DragAndDropCommand implements editorCommon.ICommand {
}
public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection {
return this.targetSelection;
return this.targetSelection!;
}
}
......@@ -93,19 +93,19 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
private readonly _keybindingService: IKeybindingService;
private readonly _contextKeyService: IContextKeyService;
private _domNode: HTMLElement;
private _findInput: FindInput;
private _replaceInputBox: HistoryInputBox;
private _toggleReplaceBtn: SimpleButton;
private _matchesCount: HTMLElement;
private _prevBtn: SimpleButton;
private _nextBtn: SimpleButton;
private _toggleSelectionFind: SimpleCheckbox;
private _closeBtn: SimpleButton;
private _preserveCase: Checkbox;
private _replaceBtn: SimpleButton;
private _replaceAllBtn: SimpleButton;
private _domNode!: HTMLElement;
private _findInput!: FindInput;
private _replaceInputBox!: HistoryInputBox;
private _toggleReplaceBtn!: SimpleButton;
private _matchesCount!: HTMLElement;
private _prevBtn!: SimpleButton;
private _nextBtn!: SimpleButton;
private _toggleSelectionFind!: SimpleCheckbox;
private _closeBtn!: SimpleButton;
private _preserveCase!: Checkbox;
private _replaceBtn!: SimpleButton;
private _replaceAllBtn!: SimpleButton;
private _isVisible: boolean;
private _isReplaceVisible: boolean;
......@@ -118,8 +118,8 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
private _viewZone?: FindWidgetViewZone;
private _viewZoneId?: number;
private _resizeSash: Sash;
private _resized: boolean;
private _resizeSash!: Sash;
private _resized!: boolean;
private readonly _updateHistoryDelayer: Delayer<void>;
constructor(
......
......@@ -16,7 +16,7 @@ interface IEditOperation {
export class ReplaceAllCommand implements editorCommon.ICommand {
private readonly _editorSelection: Selection;
private _trackedEditorSelectionId: string;
private _trackedEditorSelectionId: string | null;
private readonly _ranges: Range[];
private readonly _replaceStrings: string[];
......@@ -24,6 +24,7 @@ export class ReplaceAllCommand implements editorCommon.ICommand {
this._editorSelection = editorSelection;
this._ranges = ranges;
this._replaceStrings = replaceStrings;
this._trackedEditorSelectionId = null;
}
public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void {
......@@ -66,6 +67,6 @@ export class ReplaceAllCommand implements editorCommon.ICommand {
}
public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection {
return helper.getTrackedSelection(this._trackedEditorSelectionId);
return helper.getTrackedSelection(this._trackedEditorSelectionId!);
}
}
......@@ -24,7 +24,6 @@ export class TestFindController extends CommonFindController {
public hasFocus: boolean;
public delayUpdateHistory: boolean = false;
public delayedUpdateHistoryPromise: Promise<void>;
private _findInputFocused: IContextKey<boolean>;
......@@ -37,6 +36,7 @@ export class TestFindController extends CommonFindController {
super(editor, contextKeyService, storageService, clipboardService);
this._findInputFocused = CONTEXT_FIND_INPUT_FOCUSED.bindTo(contextKeyService);
this._updateHistoryDelayer = new Delayer<void>(50);
this.hasFocus = false;
}
protected _start(opts: IFindStartOptions): void {
......
......@@ -90,6 +90,15 @@ export class FoldingController extends Disposable implements IEditorContribution
this._autoHideFoldingControls = this.editor.getConfiguration().contribInfo.showFoldingControls === 'mouseover';
this._useFoldingProviders = this.editor.getConfiguration().contribInfo.foldingStrategy !== 'indentation';
this.foldingModel = null;
this.hiddenRangeModel = null;
this.rangeProvider = null;
this.foldingRegionPromise = null;
this.foldingStateMemento = null;
this.foldingModelPromise = null;
this.updateScheduler = null;
this.cursorChangedScheduler = null;
this.mouseDownInfo = null;
this.foldingDecorationProvider = new FoldingDecorationProvider(editor);
this.foldingDecorationProvider.autoHideFoldingControls = this._autoHideFoldingControls;
......
......@@ -28,6 +28,7 @@ export class FoldingRegions {
this._endIndexes = endIndexes;
this._collapseStates = new Uint32Array(Math.ceil(startIndexes.length / 32));
this._types = types;
this._parentsComputed = false;
}
private ensureParentIndices() {
......@@ -186,4 +187,4 @@ export class FoldingRegion {
hidesLine(lineNumber: number) {
return this.startLineNumber < lineNumber && lineNumber <= this.endLineNumber;
}
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册