Skip to content

Commit 9de85cb

Browse files
committed
Remove IEditorPosition
1 parent 3b0df36 commit 9de85cb

51 files changed

Lines changed: 566 additions & 532 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/lib/monaco-editor.d.ts

Lines changed: 297 additions & 239 deletions
Large diffs are not rendered by default.

build/lib/monaco-editor.d.ts.recipe

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ declare module monaco {
6666

6767
#include(vs/base/common/uri): URI
6868

69-
#include(vs/base/common/eventEmitter): IEmitterEvent, ListenerCallback, IBulkListenerCallback, ListenerUnbind, IEventEmitter
69+
#include(vs/base/common/eventEmitter): EmitterEvent, ListenerCallback, BulkListenerCallback, IEventEmitter
7070

7171
#include(vs/base/common/keyCodes): KeyCode, KeyMod
7272

@@ -91,6 +91,11 @@ declare module monaco {
9191
export interface IConstructorSignature2<A1, A2, T> {
9292
new (context: IPlatformServices, first: A1, second: A2): T;
9393
}
94+
95+
#include(vs/editor/common/editorCommon): IPosition, IRange, IEditorRange, SelectionDirection, ISelection, IEditorSelection
96+
#include(vs/editor/common/core/position): Position
97+
#include(vs/editor/common/core/range): Range
98+
#include(vs/editor/common/core/selection): Selection
9499
}
95100

96101

@@ -110,7 +115,7 @@ declare module monaco.editor {
110115

111116
#include(vs/editor/common/core/viewLineToken): ViewLineToken
112117

113-
#includeAll(vs/editor/common/editorCommon): KeyCode, KeyMod
118+
#includeAll(vs/editor/common/editorCommon): IPosition, IRange, IEditorRange, SelectionDirection, ISelection, IEditorSelection, IFoundBracket
114119

115120
#includeAll(vs/editor/browser/editorBrowser):
116121

build/lib/monaco.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ lines.forEach(function (line) {
171171
typesToExclude_1[typeName] = true;
172172
});
173173
getAllTopLevelDeclarations(sourceFile_2).forEach(function (declaration) {
174+
if (isDeclaration(declaration)) {
175+
if (typesToExclude_1[declaration.name.text]) {
176+
return;
177+
}
178+
}
179+
else {
180+
}
174181
result.push(getMassagedTopLevelDeclarationText(sourceFile_2, declaration));
175182
});
176183
return;

build/lib/monaco.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,15 @@ lines.forEach(line => {
214214
});
215215

216216
getAllTopLevelDeclarations(sourceFile).forEach((declaration) => {
217+
if (isDeclaration(declaration)) {
218+
if (typesToExclude[declaration.name.text]) {
219+
return;
220+
}
221+
} else {
222+
// todo
223+
// node is ts.VariableStatement
224+
// return (getNodeText(sourceFile, declaration).indexOf(typeName) >= 0);
225+
}
217226
result.push(getMassagedTopLevelDeclarationText(sourceFile, declaration));
218227
});
219228
return;

src/vs/editor/browser/controller/mouseHandler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ class EventGateKeeper<T> extends Disposable {
7777
}
7878

7979
class MousePosition {
80-
public position: editorCommon.IEditorPosition;
80+
public position: Position;
8181
public mouseColumn: number;
8282

83-
constructor(position:editorCommon.IEditorPosition, mouseColumn:number) {
83+
constructor(position:Position, mouseColumn:number) {
8484
this.position = position;
8585
this.mouseColumn = mouseColumn;
8686
}
@@ -523,7 +523,7 @@ class MouseDownState {
523523
private _startedOnLineNumbers: boolean;
524524
public get startedOnLineNumbers(): boolean { return this._startedOnLineNumbers; }
525525

526-
private _lastMouseDownPosition: editorCommon.IEditorPosition;
526+
private _lastMouseDownPosition: Position;
527527
private _lastMouseDownPositionEqualCount: number;
528528
private _lastMouseDownCount: number;
529529
private _lastSetMouseDownCountTime: number;
@@ -555,7 +555,7 @@ class MouseDownState {
555555
this._startedOnLineNumbers = startedOnLineNumbers;
556556
}
557557

558-
public trySetCount(setMouseDownCount:number, newMouseDownPosition:editorCommon.IEditorPosition): void {
558+
public trySetCount(setMouseDownCount:number, newMouseDownPosition:Position): void {
559559
// a. Invalidate multiple clicking if too much time has passed (will be hit by IE because the detail field of mouse events contains garbage in IE10)
560560
let currentTime = (new Date()).getTime();
561561
if (currentTime - this._lastSetMouseDownCountTime > MouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME) {

src/vs/editor/browser/controller/mouseTarget.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import {Position} from 'vs/editor/common/core/position';
88
import {Range as EditorRange} from 'vs/editor/common/core/range';
9-
import {EditorLayoutInfo, IEditorPosition, IEditorRange, IPosition, MouseTargetType} from 'vs/editor/common/editorCommon';
9+
import {EditorLayoutInfo, IEditorRange, IPosition, MouseTargetType} from 'vs/editor/common/editorCommon';
1010
import {ClassNames, IMouseTarget, IViewZoneData} from 'vs/editor/browser/editorBrowser';
1111
import {IDomNodePosition} from 'vs/base/browser/dom';
1212
import {ViewContext} from 'vs/editor/common/view/viewContext';
@@ -28,11 +28,11 @@ class MouseTarget implements IMouseTarget {
2828
public element: Element;
2929
public type: MouseTargetType;
3030
public mouseColumn: number;
31-
public position: IEditorPosition;
31+
public position: Position;
3232
public range: IEditorRange;
3333
public detail: any;
3434

35-
constructor(element: Element, type: MouseTargetType, mouseColumn:number = 0, position:IEditorPosition = null, range: IEditorRange = null, detail: any = null) {
35+
constructor(element: Element, type: MouseTargetType, mouseColumn:number = 0, position:Position = null, range: IEditorRange = null, detail: any = null) {
3636
this.element = element;
3737
this.type = type;
3838
this.mouseColumn = mouseColumn;
@@ -541,9 +541,9 @@ export class MouseTargetFactory {
541541
if (viewZoneWhitespace) {
542542
var viewZoneMiddle = viewZoneWhitespace.verticalOffset + viewZoneWhitespace.height / 2,
543543
lineCount = this._context.model.getLineCount(),
544-
positionBefore: IEditorPosition = null,
545-
position: IEditorPosition,
546-
positionAfter: IEditorPosition = null;
544+
positionBefore: Position = null,
545+
position: Position,
546+
positionAfter: Position = null;
547547

548548
if (viewZoneWhitespace.afterLineNumber !== lineCount) {
549549
// There are more lines after this view zone

src/vs/editor/browser/editorBrowser.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {IKeyboardEvent} from 'vs/base/browser/keyboardEvent';
1010
import {IMouseEvent} from 'vs/base/browser/mouseEvent';
1111
import {IInstantiationService, IConstructorSignature1} from 'vs/platform/instantiation/common/instantiation';
1212
import * as editorCommon from 'vs/editor/common/editorCommon';
13+
import {Position} from 'vs/editor/common/core/position';
1314

1415
export interface IContentWidgetData {
1516
widget: IContentWidget;
@@ -69,14 +70,14 @@ export interface IView extends IDisposable {
6970

7071
export interface IViewZoneData {
7172
viewZoneId: number;
72-
positionBefore:editorCommon.IEditorPosition;
73-
positionAfter:editorCommon.IEditorPosition;
74-
position: editorCommon.IEditorPosition;
73+
positionBefore:Position;
74+
positionAfter:Position;
75+
position: Position;
7576
afterLineNumber: number;
7677
}
7778

7879
export interface IMouseDispatchData {
79-
position: editorCommon.IEditorPosition;
80+
position: Position;
8081
/**
8182
* Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line).
8283
*/
@@ -94,7 +95,7 @@ export interface IMouseDispatchData {
9495
export interface IViewController {
9596
dispatchMouse(data:IMouseDispatchData);
9697

97-
moveTo(source:string, position:editorCommon.IEditorPosition): void;
98+
moveTo(source:string, position:Position): void;
9899

99100
paste(source:string, text:string, pasteOnNewLine:boolean): void;
100101
type(source: string, text: string): void;
@@ -323,7 +324,7 @@ export interface IMouseTarget {
323324
/**
324325
* The 'approximate' editor position
325326
*/
326-
position: editorCommon.IEditorPosition;
327+
position: Position;
327328
/**
328329
* Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line).
329330
*/

src/vs/editor/browser/view/viewController.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class ViewController implements IViewController {
5959
this.keybindingService.executeCommand(editorCommon.Handler.Cut, {});
6060
}
6161

62-
private _validateViewColumn(viewPosition:editorCommon.IEditorPosition): editorCommon.IEditorPosition {
62+
private _validateViewColumn(viewPosition:Position): Position {
6363
var minColumn = this.viewModel.getLineMinColumn(viewPosition.lineNumber);
6464
if (viewPosition.column < minColumn) {
6565
return new Position(viewPosition.lineNumber, minColumn);
@@ -133,23 +133,23 @@ export class ViewController implements IViewController {
133133
}
134134
}
135135

136-
public moveTo(source:string, viewPosition:editorCommon.IEditorPosition): void {
136+
public moveTo(source:string, viewPosition:Position): void {
137137
viewPosition = this._validateViewColumn(viewPosition);
138138
this.triggerCursorHandler(source, editorCommon.Handler.MoveTo, {
139139
position: this.convertViewToModelPosition(viewPosition),
140140
viewPosition: viewPosition
141141
});
142142
}
143143

144-
private moveToSelect(source:string, viewPosition:editorCommon.IEditorPosition): void {
144+
private moveToSelect(source:string, viewPosition:Position): void {
145145
viewPosition = this._validateViewColumn(viewPosition);
146146
this.triggerCursorHandler(source, editorCommon.Handler.MoveToSelect, {
147147
position: this.convertViewToModelPosition(viewPosition),
148148
viewPosition: viewPosition
149149
});
150150
}
151151

152-
private columnSelect(source:string, viewPosition:editorCommon.IEditorPosition, mouseColumn:number): void {
152+
private columnSelect(source:string, viewPosition:Position, mouseColumn:number): void {
153153
viewPosition = this._validateViewColumn(viewPosition);
154154
this.triggerCursorHandler(source, editorCommon.Handler.ColumnSelect, {
155155
position: this.convertViewToModelPosition(viewPosition),
@@ -158,7 +158,7 @@ export class ViewController implements IViewController {
158158
});
159159
}
160160

161-
private createCursor(source:string, viewPosition:editorCommon.IEditorPosition, wholeLine:boolean): void {
161+
private createCursor(source:string, viewPosition:Position, wholeLine:boolean): void {
162162
viewPosition = this._validateViewColumn(viewPosition);
163163
this.triggerCursorHandler(source, editorCommon.Handler.CreateCursor, {
164164
position: this.convertViewToModelPosition(viewPosition),
@@ -167,60 +167,60 @@ export class ViewController implements IViewController {
167167
});
168168
}
169169

170-
private lastCursorMoveToSelect(source:string, viewPosition:editorCommon.IEditorPosition): void {
170+
private lastCursorMoveToSelect(source:string, viewPosition:Position): void {
171171
viewPosition = this._validateViewColumn(viewPosition);
172172
this.triggerCursorHandler(source, editorCommon.Handler.LastCursorMoveToSelect, {
173173
position: this.convertViewToModelPosition(viewPosition),
174174
viewPosition: viewPosition
175175
});
176176
}
177177

178-
private wordSelect(source:string, viewPosition:editorCommon.IEditorPosition): void {
178+
private wordSelect(source:string, viewPosition:Position): void {
179179
viewPosition = this._validateViewColumn(viewPosition);
180180
this.triggerCursorHandler(source, editorCommon.Handler.WordSelect, {
181181
position: this.convertViewToModelPosition(viewPosition)
182182
});
183183
}
184184

185-
private wordSelectDrag(source:string, viewPosition:editorCommon.IEditorPosition): void {
185+
private wordSelectDrag(source:string, viewPosition:Position): void {
186186
viewPosition = this._validateViewColumn(viewPosition);
187187
this.triggerCursorHandler(source, editorCommon.Handler.WordSelectDrag, {
188188
position: this.convertViewToModelPosition(viewPosition)
189189
});
190190
}
191191

192-
private lastCursorWordSelect(source:string, viewPosition:editorCommon.IEditorPosition): void {
192+
private lastCursorWordSelect(source:string, viewPosition:Position): void {
193193
viewPosition = this._validateViewColumn(viewPosition);
194194
this.triggerCursorHandler(source, editorCommon.Handler.LastCursorWordSelect, {
195195
position: this.convertViewToModelPosition(viewPosition)
196196
});
197197
}
198198

199-
private lineSelect(source:string, viewPosition:editorCommon.IEditorPosition): void {
199+
private lineSelect(source:string, viewPosition:Position): void {
200200
viewPosition = this._validateViewColumn(viewPosition);
201201
this.triggerCursorHandler(source, editorCommon.Handler.LineSelect, {
202202
position: this.convertViewToModelPosition(viewPosition),
203203
viewPosition: viewPosition
204204
});
205205
}
206206

207-
private lineSelectDrag(source:string, viewPosition:editorCommon.IEditorPosition): void {
207+
private lineSelectDrag(source:string, viewPosition:Position): void {
208208
viewPosition = this._validateViewColumn(viewPosition);
209209
this.triggerCursorHandler(source, editorCommon.Handler.LineSelectDrag, {
210210
position: this.convertViewToModelPosition(viewPosition),
211211
viewPosition: viewPosition
212212
});
213213
}
214214

215-
private lastCursorLineSelect(source:string, viewPosition:editorCommon.IEditorPosition): void {
215+
private lastCursorLineSelect(source:string, viewPosition:Position): void {
216216
viewPosition = this._validateViewColumn(viewPosition);
217217
this.triggerCursorHandler(source, editorCommon.Handler.LastCursorLineSelect, {
218218
position: this.convertViewToModelPosition(viewPosition),
219219
viewPosition: viewPosition
220220
});
221221
}
222222

223-
private lastCursorLineSelectDrag(source:string, viewPosition:editorCommon.IEditorPosition): void {
223+
private lastCursorLineSelectDrag(source:string, viewPosition:Position): void {
224224
viewPosition = this._validateViewColumn(viewPosition);
225225
this.triggerCursorHandler(source, editorCommon.Handler.LastCursorLineSelectDrag, {
226226
position: this.convertViewToModelPosition(viewPosition),
@@ -234,7 +234,7 @@ export class ViewController implements IViewController {
234234

235235
// ----------------------
236236

237-
private convertViewToModelPosition(viewPosition:editorCommon.IEditorPosition): editorCommon.IEditorPosition {
237+
private convertViewToModelPosition(viewPosition:Position): Position {
238238
return this.viewModel.convertViewPositionToModelPosition(viewPosition.lineNumber, viewPosition.column);
239239
}
240240

src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {ClassNames, ContentWidgetPositionPreference, IContentWidget} from 'vs/ed
1313
import {ViewPart} from 'vs/editor/browser/view/viewPart';
1414
import {ViewContext} from 'vs/editor/common/view/viewContext';
1515
import {IRenderingContext, IRestrictedRenderingContext} from 'vs/editor/common/view/renderingContext';
16+
import {Position} from 'vs/editor/common/core/position';
1617

1718
interface IWidgetData {
1819
allowEditorOverflow: boolean;
@@ -184,7 +185,7 @@ export class ViewContentWidgets extends ViewPart {
184185
}
185186
}
186187

187-
private _layoutBoxInViewport(position:editorCommon.IEditorPosition, domNode:HTMLElement, ctx:IRenderingContext): IBoxLayoutResult {
188+
private _layoutBoxInViewport(position:Position, domNode:HTMLElement, ctx:IRenderingContext): IBoxLayoutResult {
188189

189190
let visibleRange = ctx.visibleRangeForPosition(position);
190191

@@ -228,7 +229,7 @@ export class ViewContentWidgets extends ViewPart {
228229
};
229230
}
230231

231-
private _layoutBoxInPage(position: editorCommon.IEditorPosition, domNode: HTMLElement, ctx: IRenderingContext): IBoxLayoutResult {
232+
private _layoutBoxInPage(position: Position, domNode: HTMLElement, ctx: IRenderingContext): IBoxLayoutResult {
232233
let visibleRange = ctx.visibleRangeForPosition(position);
233234

234235
if (!visibleRange) {
@@ -282,7 +283,7 @@ export class ViewContentWidgets extends ViewPart {
282283
};
283284
}
284285

285-
private _prepareRenderWidgetAtExactPosition(position:editorCommon.IEditorPosition, ctx:IRenderingContext): IMyWidgetRenderData {
286+
private _prepareRenderWidgetAtExactPosition(position:Position, ctx:IRenderingContext): IMyWidgetRenderData {
286287
let visibleRange = ctx.visibleRangeForPosition(position);
287288

288289
if (!visibleRange) {

src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {ViewPart} from 'vs/editor/browser/view/viewPart';
1111
import {OverviewRulerImpl} from 'vs/editor/browser/viewParts/overviewRuler/overviewRulerImpl';
1212
import {ViewContext} from 'vs/editor/common/view/viewContext';
1313
import {IRenderingContext, IRestrictedRenderingContext} from 'vs/editor/common/view/renderingContext';
14+
import {Position} from 'vs/editor/common/core/position';
1415

1516
export class DecorationsOverviewRuler extends ViewPart {
1617

@@ -25,7 +26,7 @@ export class DecorationsOverviewRuler extends ViewPart {
2526
private _shouldUpdateCursorPosition:boolean;
2627

2728
private _hideCursor:boolean;
28-
private _cursorPositions: editorCommon.IEditorPosition[];
29+
private _cursorPositions: Position[];
2930

3031
private _zonesFromDecorations: OverviewRulerZone[];
3132
private _zonesFromCursors: OverviewRulerZone[];

0 commit comments

Comments
 (0)