Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
77ceff4a
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
77ceff4a
编写于
2月 21, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use proper types for all view events
上级
d9e83c04
变更
34
隐藏空白更改
内联
并排
Showing
34 changed file
with
493 addition
and
403 deletion
+493
-403
src/vs/editor/browser/controller/keyboardHandler.ts
src/vs/editor/browser/controller/keyboardHandler.ts
+12
-15
src/vs/editor/browser/controller/mouseHandler.ts
src/vs/editor/browser/controller/mouseHandler.ts
+5
-6
src/vs/editor/browser/view/viewImpl.ts
src/vs/editor/browser/view/viewImpl.ts
+11
-12
src/vs/editor/browser/view/viewLayer.ts
src/vs/editor/browser/view/viewLayer.ts
+8
-10
src/vs/editor/browser/view/viewOutgoingEvents.ts
src/vs/editor/browser/view/viewOutgoingEvents.ts
+2
-2
src/vs/editor/browser/view/viewOverlays.ts
src/vs/editor/browser/view/viewOverlays.ts
+10
-10
src/vs/editor/browser/viewLayout/layoutProvider.ts
src/vs/editor/browser/viewLayout/layoutProvider.ts
+4
-4
src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts
...editor/browser/viewParts/contentWidgets/contentWidgets.ts
+11
-12
src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts
...er/viewParts/currentLineHighlight/currentLineHighlight.ts
+8
-10
src/vs/editor/browser/viewParts/currentLineMarginHighlight/currentLineMarginHighlight.ts
.../currentLineMarginHighlight/currentLineMarginHighlight.ts
+6
-7
src/vs/editor/browser/viewParts/decorations/decorations.ts
src/vs/editor/browser/viewParts/decorations/decorations.ts
+11
-13
src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts
src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts
+11
-13
src/vs/editor/browser/viewParts/indentGuides/indentGuides.ts
src/vs/editor/browser/viewParts/indentGuides/indentGuides.ts
+7
-9
src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
+11
-13
src/vs/editor/browser/viewParts/lines/viewLines.ts
src/vs/editor/browser/viewParts/lines/viewLines.ts
+8
-9
src/vs/editor/browser/viewParts/linesDecorations/linesDecorations.ts
...or/browser/viewParts/linesDecorations/linesDecorations.ts
+11
-13
src/vs/editor/browser/viewParts/margin/margin.ts
src/vs/editor/browser/viewParts/margin/margin.ts
+3
-4
src/vs/editor/browser/viewParts/marginDecorations/marginDecorations.ts
.../browser/viewParts/marginDecorations/marginDecorations.ts
+11
-13
src/vs/editor/browser/viewParts/minimap/minimap.ts
src/vs/editor/browser/viewParts/minimap/minimap.ts
+18
-21
src/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.ts
...editor/browser/viewParts/overlayWidgets/overlayWidgets.ts
+2
-2
src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts
...owser/viewParts/overviewRuler/decorationsOverviewRuler.ts
+6
-7
src/vs/editor/browser/viewParts/overviewRuler/overviewRuler.ts
...s/editor/browser/viewParts/overviewRuler/overviewRuler.ts
+6
-6
src/vs/editor/browser/viewParts/rulers/rulers.ts
src/vs/editor/browser/viewParts/rulers/rulers.ts
+3
-4
src/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.ts
...or/browser/viewParts/scrollDecoration/scrollDecoration.ts
+3
-4
src/vs/editor/browser/viewParts/selections/selections.ts
src/vs/editor/browser/viewParts/selections/selections.ts
+11
-13
src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts
src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts
+3
-2
src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts
src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts
+13
-14
src/vs/editor/browser/viewParts/viewZones/viewZones.ts
src/vs/editor/browser/viewParts/viewZones/viewZones.ts
+6
-7
src/vs/editor/common/view/viewEvents.ts
src/vs/editor/common/view/viewEvents.ts
+206
-28
src/vs/editor/common/viewModel/splitLinesCollection.ts
src/vs/editor/common/viewModel/splitLinesCollection.ts
+10
-38
src/vs/editor/common/viewModel/viewEventHandler.ts
src/vs/editor/common/viewModel/viewEventHandler.ts
+31
-33
src/vs/editor/common/viewModel/viewModelCursors.ts
src/vs/editor/common/viewModel/viewModelCursors.ts
+9
-27
src/vs/editor/common/viewModel/viewModelDecorations.ts
src/vs/editor/common/viewModel/viewModelDecorations.ts
+2
-2
src/vs/editor/common/viewModel/viewModelImpl.ts
src/vs/editor/common/viewModel/viewModelImpl.ts
+14
-20
未找到文件。
src/vs/editor/browser/controller/keyboardHandler.ts
浏览文件 @
77ceff4a
...
...
@@ -21,7 +21,6 @@ import { ViewContext } from 'vs/editor/common/view/viewContext';
import
{
VisibleRange
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
TextAreaWrapper
}
from
'
vs/editor/browser/controller/input/textAreaWrapper
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
interface
IKeyboardHandlerHelper
{
viewDomNode
:
HTMLElement
;
...
...
@@ -76,14 +75,12 @@ export class KeyboardHandler extends ViewEventHandler implements IDisposable {
let
lineNumber
=
e
.
showAtLineNumber
;
let
column
=
e
.
showAtColumn
;
let
revealPositionEvent
:
viewEvents
.
IViewRevealRangeEvent
=
{
_viewRevealRangeEventBrand
:
void
0
,
range
:
new
Range
(
lineNumber
,
column
,
lineNumber
,
column
),
verticalType
:
editorCommon
.
VerticalRevealType
.
Simple
,
revealHorizontal
:
true
,
revealCursor
:
false
};
this
.
_context
.
privateViewEventBus
.
emit
(
viewEvents
.
ViewEventNames
.
RevealRangeEvent
,
revealPositionEvent
);
this
.
_context
.
privateViewEventBus
.
emit
(
viewEvents
.
ViewEventNames
.
RevealRangeEvent
,
new
viewEvents
.
ViewRevealRangeEvent
(
new
Range
(
lineNumber
,
column
,
lineNumber
,
column
),
editorCommon
.
VerticalRevealType
.
Simple
,
true
,
false
));
// Find range pixel position
this
.
visibleRange
=
this
.
viewHelper
.
visibleRangeForPositionRelativeToEditor
(
lineNumber
,
column
);
...
...
@@ -163,7 +160,7 @@ export class KeyboardHandler extends ViewEventHandler implements IDisposable {
this
.
textAreaHandler
.
focusTextArea
();
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
// Give textarea same font size & line height as editor, for the IME case (when the textarea is visible)
if
(
e
.
fontInfo
)
{
Configuration
.
applyFontInfoSlow
(
this
.
textArea
.
actual
,
this
.
_context
.
configuration
.
editor
.
fontInfo
);
...
...
@@ -178,7 +175,7 @@ export class KeyboardHandler extends ViewEventHandler implements IDisposable {
return
false
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
this
.
scrollLeft
=
e
.
scrollLeft
;
if
(
this
.
visibleRange
)
{
StyleMutator
.
setTop
(
this
.
textArea
.
actual
,
this
.
visibleRange
.
top
);
...
...
@@ -187,13 +184,13 @@ export class KeyboardHandler extends ViewEventHandler implements IDisposable {
return
false
;
}
public
onViewFocusChanged
(
isFocused
:
boolean
):
boolean
{
this
.
textAreaHandler
.
setHasFocus
(
isFocused
);
public
onViewFocusChanged
(
e
:
viewEvents
.
ViewFocusChangedEvent
):
boolean
{
this
.
textAreaHandler
.
setHasFocus
(
e
.
isFocused
);
return
false
;
}
private
_lastCursorSelectionChanged
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
=
null
;
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
boolean
{
private
_lastCursorSelectionChanged
:
viewEvents
.
ViewCursorSelectionChangedEvent
=
null
;
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
boolean
{
this
.
_lastCursorSelectionChanged
=
e
;
return
false
;
}
...
...
src/vs/editor/browser/controller/mouseHandler.ts
浏览文件 @
77ceff4a
...
...
@@ -22,7 +22,6 @@ import { StandardMouseWheelEvent } from 'vs/base/browser/mouseEvent';
import
{
EditorZoom
}
from
'
vs/editor/common/config/editorZoom
'
;
import
{
IViewCursorRenderData
}
from
'
vs/editor/browser/viewParts/viewCursors/viewCursor
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
/**
* Merges mouse events when mouse move events are throttled
...
...
@@ -206,17 +205,17 @@ export class MouseHandler extends ViewEventHandler implements IDisposable {
}
// --- begin event handlers
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
this
.
_mouseDownOperation
.
onScrollChanged
();
return
false
;
}
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
boolean
{
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
boolean
{
this
.
_mouseDownOperation
.
onCursorSelectionChanged
(
e
);
return
false
;
}
private
_isFocused
=
false
;
public
onViewFocusChanged
(
isFocused
:
boolean
):
boolean
{
this
.
_isFocused
=
isFocused
;
public
onViewFocusChanged
(
e
:
viewEvents
.
ViewFocusChangedEvent
):
boolean
{
this
.
_isFocused
=
e
.
isFocused
;
return
false
;
}
// --- end event handlers
...
...
@@ -454,7 +453,7 @@ class MouseDownOperation extends Disposable {
},
10
);
}
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
void
{
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
void
{
this
.
_currentSelection
=
e
.
selection
;
}
...
...
src/vs/editor/browser/view/viewImpl.ts
浏览文件 @
77ceff4a
...
...
@@ -51,7 +51,6 @@ import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData'
import
{
EditorScrollbar
}
from
'
vs/editor/browser/viewParts/editorScrollbar/editorScrollbar
'
;
import
{
Minimap
}
from
'
vs/editor/browser/viewParts/minimap/minimap
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
class
View
extends
ViewEventHandler
implements
editorBrowser
.
IView
,
IDisposable
{
...
...
@@ -455,15 +454,15 @@ export class View extends ViewEventHandler implements editorBrowser.IView, IDisp
// --- begin event handlers
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
this
.
layoutProvider
.
onModelFlushed
(
this
.
_context
.
model
.
getLineCount
());
return
false
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
this
.
layoutProvider
.
onModelLinesDeleted
(
e
);
return
false
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
this
.
layoutProvider
.
onModelLinesInserted
(
e
);
return
false
;
}
...
...
@@ -490,7 +489,7 @@ export class View extends ViewEventHandler implements editorBrowser.IView, IDisp
StyleMutator
.
setHeight
(
this
.
linesContentContainer
,
layoutInfo
.
contentHeight
);
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
viewInfo
.
editorClassName
)
{
this
.
domNode
.
className
=
this
.
_context
.
configuration
.
editor
.
viewInfo
.
editorClassName
;
}
...
...
@@ -503,13 +502,13 @@ export class View extends ViewEventHandler implements editorBrowser.IView, IDisp
this
.
layoutProvider
.
onConfigurationChanged
(
e
);
return
false
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
this
.
outgoingEvents
.
emitScrollChanged
(
e
);
return
false
;
}
public
onViewFocusChanged
(
isFocused
:
boolean
):
boolean
{
dom
.
toggleClass
(
this
.
domNode
,
'
focused
'
,
isFocused
);
if
(
isFocused
)
{
public
onViewFocusChanged
(
e
:
viewEvents
.
ViewFocusChangedEvent
):
boolean
{
dom
.
toggleClass
(
this
.
domNode
,
'
focused
'
,
e
.
isFocused
);
if
(
e
.
isFocused
)
{
this
.
outgoingEvents
.
emitViewFocusGained
();
}
else
{
this
.
outgoingEvents
.
emitViewFocusLost
();
...
...
@@ -517,7 +516,7 @@ export class View extends ViewEventHandler implements editorBrowser.IView, IDisp
return
false
;
}
public
onCursorRevealRange
(
e
:
viewEvents
.
I
ViewRevealRangeEvent
):
boolean
{
public
onCursorRevealRange
(
e
:
viewEvents
.
ViewRevealRangeEvent
):
boolean
{
return
e
.
revealCursor
?
this
.
revealCursor
()
:
false
;
}
...
...
@@ -753,7 +752,7 @@ export class View extends ViewEventHandler implements editorBrowser.IView, IDisp
if
(
zonesHaveChanged
)
{
this
.
layoutProvider
.
onHeightMaybeChanged
();
this
.
_context
.
privateViewEventBus
.
emit
(
viewEvents
.
ViewEventNames
.
ZonesChanged
,
n
ull
);
this
.
_context
.
privateViewEventBus
.
emit
(
viewEvents
.
ViewEventNames
.
ZonesChanged
,
n
ew
viewEvents
.
ViewZonesChangedEvent
()
);
}
});
return
zonesHaveChanged
;
...
...
@@ -935,7 +934,7 @@ export class View extends ViewEventHandler implements editorBrowser.IView, IDisp
private
_setHasFocus
(
newHasFocus
:
boolean
):
void
{
if
(
this
.
hasFocus
!==
newHasFocus
)
{
this
.
hasFocus
=
newHasFocus
;
this
.
_context
.
privateViewEventBus
.
emit
(
viewEvents
.
ViewEventNames
.
ViewFocusChanged
,
this
.
hasFocus
);
this
.
_context
.
privateViewEventBus
.
emit
(
viewEvents
.
ViewEventNames
.
ViewFocusChanged
,
new
viewEvents
.
ViewFocusChangedEvent
(
this
.
hasFocus
)
);
}
}
}
...
...
src/vs/editor/browser/view/viewLayer.ts
浏览文件 @
77ceff4a
...
...
@@ -4,13 +4,11 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
ViewPart
}
from
'
vs/editor/browser/view/viewPart
'
;
import
{
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/styleMutator
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
ViewportData
}
from
'
vs/editor/common/viewLayout/viewLinesViewportData
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
/**
* Represents a visible line
...
...
@@ -282,26 +280,26 @@ export abstract class ViewLayer<T extends IVisibleLine> extends ViewPart {
// ---- begin view event handlers
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
return
e
.
layoutInfo
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
e
.
scrollTopChanged
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
this
.
_linesCollection
=
new
RenderedLinesCollection
<
T
>
(()
=>
this
.
_createLine
());
this
.
_scrollDomNode
=
null
;
// No need to clear the dom node because a full .innerHTML will occur in ViewLayerRenderer._render
return
true
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
let
deleted
=
this
.
_linesCollection
.
onModelLinesDeleted
(
e
.
fromLineNumber
,
e
.
toLineNumber
);
if
(
deleted
)
{
// Remove from DOM
...
...
@@ -316,11 +314,11 @@ export abstract class ViewLayer<T extends IVisibleLine> extends ViewPart {
return
true
;
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
return
this
.
_linesCollection
.
onModelLineChanged
(
e
.
lineNumber
);
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
let
deleted
=
this
.
_linesCollection
.
onModelLinesInserted
(
e
.
fromLineNumber
,
e
.
toLineNumber
);
if
(
deleted
)
{
// Remove from DOM
...
...
@@ -335,7 +333,7 @@ export abstract class ViewLayer<T extends IVisibleLine> extends ViewPart {
return
true
;
}
public
onModelTokensChanged
(
e
:
viewEvents
.
I
ViewTokensChangedEvent
):
boolean
{
public
onModelTokensChanged
(
e
:
viewEvents
.
ViewTokensChangedEvent
):
boolean
{
return
this
.
_linesCollection
.
onModelTokensChanged
(
e
.
ranges
);
}
...
...
src/vs/editor/browser/view/viewOutgoingEvents.ts
浏览文件 @
77ceff4a
...
...
@@ -13,7 +13,7 @@ import { IViewModel } from 'vs/editor/common/viewModel/viewModel';
import
{
EventType
,
IScrollEvent
,
MouseTargetType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorMouseEvent
,
IMouseTarget
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
MouseTarget
}
from
'
vs/editor/browser/controller/mouseTarget
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
export
class
ViewOutgoingEvents
extends
Disposable
{
...
...
@@ -34,7 +34,7 @@ export class ViewOutgoingEvents extends Disposable {
return
this
.
_actual
.
deferredEmit
(
callback
);
}
public
emitScrollChanged
(
e
:
Scroll
Event
):
void
{
public
emitScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
void
{
this
.
_actual
.
emit
(
'
scroll
'
,
<
IScrollEvent
>
e
);
}
...
...
src/vs/editor/browser/view/viewOverlays.ts
浏览文件 @
77ceff4a
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/styleMutator
'
;
import
{
IConfiguration
,
IConfigurationChangedEvent
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfiguration
}
from
'
vs/editor/common/editorCommon
'
;
import
*
as
editorBrowser
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IVisibleLine
,
ViewLayer
}
from
'
vs/editor/browser/view/viewLayer
'
;
import
{
DynamicViewOverlay
}
from
'
vs/editor/browser/view/dynamicViewOverlay
'
;
...
...
@@ -13,7 +13,7 @@ import { Configuration } from 'vs/editor/browser/config/configuration';
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
,
IRestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
ViewportData
}
from
'
vs/editor/common/viewLayout/viewLinesViewportData
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
export
class
ViewOverlays
extends
ViewLayer
<
ViewOverlayLine
>
{
...
...
@@ -64,7 +64,7 @@ export class ViewOverlays extends ViewLayer<ViewOverlayLine> {
// ----- event handlers
public
onConfigurationChanged
(
e
:
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
super
.
onConfigurationChanged
(
e
);
let
startLineNumber
=
this
.
_linesCollection
.
getStartLineNumber
();
let
endLineNumber
=
this
.
_linesCollection
.
getEndLineNumber
();
...
...
@@ -75,8 +75,8 @@ export class ViewOverlays extends ViewLayer<ViewOverlayLine> {
return
true
;
}
public
onViewFocusChanged
(
isFocused
:
boolean
):
boolean
{
this
.
_isFocused
=
isFocused
;
public
onViewFocusChanged
(
e
:
viewEvents
.
ViewFocusChangedEvent
):
boolean
{
this
.
_isFocused
=
e
.
isFocused
;
return
true
;
}
...
...
@@ -144,7 +144,7 @@ export class ViewOverlayLine implements IVisibleLine {
public
onTokensChanged
():
void
{
// Nothing
}
public
onConfigurationChanged
(
e
:
I
ConfigurationChangedEvent
):
void
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
void
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_configuration
.
editor
.
lineHeight
;
}
...
...
@@ -187,13 +187,13 @@ export class ContentViewOverlays extends ViewOverlays {
this
.
domNode
.
setHeight
(
0
);
}
public
onConfigurationChanged
(
e
:
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
layoutInfo
)
{
this
.
_contentWidth
=
this
.
_context
.
configuration
.
editor
.
layoutInfo
.
contentWidth
;
}
return
super
.
onConfigurationChanged
(
e
);
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
super
.
onScrollChanged
(
e
)
||
e
.
scrollWidthChanged
;
}
...
...
@@ -221,11 +221,11 @@ export class MarginViewOverlays extends ViewOverlays {
Configuration
.
applyFontInfo
(
this
.
domNode
,
this
.
_context
.
configuration
.
editor
.
fontInfo
);
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
super
.
onScrollChanged
(
e
)
||
e
.
scrollHeightChanged
;
}
public
onConfigurationChanged
(
e
:
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
let
shouldRender
=
false
;
if
(
e
.
fontInfo
)
{
Configuration
.
applyFontInfo
(
this
.
domNode
,
this
.
_context
.
configuration
.
editor
.
fontInfo
);
...
...
src/vs/editor/browser/viewLayout/layoutProvider.ts
浏览文件 @
77ceff4a
...
...
@@ -35,7 +35,7 @@ export class LayoutProvider extends Disposable implements IViewLayout {
height
:
configuration
.
editor
.
layoutInfo
.
contentHeight
});
this
.
_register
(
this
.
_scrollable
.
onScroll
((
e
:
ScrollEvent
)
=>
{
this
.
_privateViewEventBus
.
emit
(
viewEvents
.
ViewEventNames
.
ViewScrollChanged
,
e
);
this
.
_privateViewEventBus
.
emit
(
viewEvents
.
ViewEventNames
.
ViewScrollChanged
,
new
viewEvents
.
ViewScrollChangedEvent
(
e
)
);
}));
this
.
_updateHeight
();
...
...
@@ -60,17 +60,17 @@ export class LayoutProvider extends Disposable implements IViewLayout {
this
.
_updateHeight
();
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
void
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
void
{
this
.
_linesLayout
.
onModelLinesDeleted
(
e
.
fromLineNumber
,
e
.
toLineNumber
);
this
.
_updateHeight
();
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
void
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
void
{
this
.
_linesLayout
.
onModelLinesInserted
(
e
.
fromLineNumber
,
e
.
toLineNumber
);
this
.
_updateHeight
();
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
void
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
void
{
if
(
e
.
lineHeight
)
{
this
.
_linesLayout
.
setLineHeight
(
this
.
_configuration
.
editor
.
lineHeight
);
}
...
...
src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts
浏览文件 @
77ceff4a
...
...
@@ -14,7 +14,6 @@ import { ViewContext } from 'vs/editor/common/view/viewContext';
import
{
IRenderingContext
,
IRestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
interface
IWidgetData
{
allowEditorOverflow
:
boolean
;
...
...
@@ -86,32 +85,32 @@ export class ViewContentWidgets extends ViewPart {
// --- begin event handlers
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
return
true
;
}
public
onModelDecorationsChanged
(
e
:
viewEvents
.
I
ViewDecorationsChangedEvent
):
boolean
{
public
onModelDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
// true for inline decorations that can end up relayouting text
return
true
;
//e.inlineDecorationsChanged;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
true
;
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
true
;
}
public
onCursorPositionChanged
(
e
:
viewEvents
.
I
ViewCursorPositionChangedEvent
):
boolean
{
public
onCursorPositionChanged
(
e
:
viewEvents
.
ViewCursorPositionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
boolean
{
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorRevealRange
(
e
:
viewEvents
.
I
ViewRevealRangeEvent
):
boolean
{
public
onCursorRevealRange
(
e
:
viewEvents
.
ViewRevealRangeEvent
):
boolean
{
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
...
...
@@ -137,10 +136,10 @@ export class ViewContentWidgets extends ViewPart {
}
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
true
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
...
...
src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts
浏览文件 @
77ceff4a
...
...
@@ -6,12 +6,10 @@
'
use strict
'
;
import
'
vs/css!./currentLineHighlight
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
DynamicViewOverlay
}
from
'
vs/editor/browser/view/dynamicViewOverlay
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
class
CurrentLineHighlightOverlay
extends
DynamicViewOverlay
{
private
_context
:
ViewContext
;
...
...
@@ -47,19 +45,19 @@ export class CurrentLineHighlightOverlay extends DynamicViewOverlay {
// --- begin event handlers
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
this
.
_primaryCursorIsInEditableRange
=
true
;
this
.
_selectionIsEmpty
=
true
;
this
.
_primaryCursorLineNumber
=
1
;
return
true
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
true
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
true
;
}
public
onCursorPositionChanged
(
e
:
viewEvents
.
I
ViewCursorPositionChangedEvent
):
boolean
{
public
onCursorPositionChanged
(
e
:
viewEvents
.
ViewCursorPositionChangedEvent
):
boolean
{
let
hasChanged
=
false
;
if
(
this
.
_primaryCursorIsInEditableRange
!==
e
.
isInEditableRange
)
{
this
.
_primaryCursorIsInEditableRange
=
e
.
isInEditableRange
;
...
...
@@ -71,7 +69,7 @@ export class CurrentLineHighlightOverlay extends DynamicViewOverlay {
}
return
hasChanged
;
}
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
boolean
{
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
boolean
{
let
isEmpty
=
e
.
selection
.
isEmpty
();
if
(
this
.
_selectionIsEmpty
!==
isEmpty
)
{
this
.
_selectionIsEmpty
=
isEmpty
;
...
...
@@ -79,7 +77,7 @@ export class CurrentLineHighlightOverlay extends DynamicViewOverlay {
}
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
...
...
@@ -94,10 +92,10 @@ export class CurrentLineHighlightOverlay extends DynamicViewOverlay {
}
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
e
.
scrollWidthChanged
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
// --- end event handlers
...
...
src/vs/editor/browser/viewParts/currentLineMarginHighlight/currentLineMarginHighlight.ts
浏览文件 @
77ceff4a
...
...
@@ -6,7 +6,6 @@
'
use strict
'
;
import
'
vs/css!./currentLineMarginHighlight
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
DynamicViewOverlay
}
from
'
vs/editor/browser/view/dynamicViewOverlay
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
...
...
@@ -40,18 +39,18 @@ export class CurrentLineMarginHighlightOverlay extends DynamicViewOverlay {
// --- begin event handlers
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
this
.
_primaryCursorIsInEditableRange
=
true
;
this
.
_primaryCursorLineNumber
=
1
;
return
true
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
true
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
true
;
}
public
onCursorPositionChanged
(
e
:
viewEvents
.
I
ViewCursorPositionChangedEvent
):
boolean
{
public
onCursorPositionChanged
(
e
:
viewEvents
.
ViewCursorPositionChangedEvent
):
boolean
{
let
hasChanged
=
false
;
if
(
this
.
_primaryCursorIsInEditableRange
!==
e
.
isInEditableRange
)
{
this
.
_primaryCursorIsInEditableRange
=
e
.
isInEditableRange
;
...
...
@@ -63,7 +62,7 @@ export class CurrentLineMarginHighlightOverlay extends DynamicViewOverlay {
}
return
hasChanged
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
...
...
@@ -75,7 +74,7 @@ export class CurrentLineMarginHighlightOverlay extends DynamicViewOverlay {
}
return
true
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
// --- end event handlers
...
...
src/vs/editor/browser/viewParts/decorations/decorations.ts
浏览文件 @
77ceff4a
...
...
@@ -6,14 +6,12 @@
'
use strict
'
;
import
'
vs/css!./decorations
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
DynamicViewOverlay
}
from
'
vs/editor/browser/view/dynamicViewOverlay
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
ViewModelDecoration
}
from
'
vs/editor/common/viewModel/viewModel
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
class
DecorationsOverlay
extends
DynamicViewOverlay
{
...
...
@@ -38,40 +36,40 @@ export class DecorationsOverlay extends DynamicViewOverlay {
// --- begin event handlers
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
return
true
;
}
public
onModelDecorationsChanged
(
e
:
viewEvents
.
I
ViewDecorationsChangedEvent
):
boolean
{
public
onModelDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
true
;
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
true
;
}
public
onCursorPositionChanged
(
e
:
viewEvents
.
I
ViewCursorPositionChangedEvent
):
boolean
{
public
onCursorPositionChanged
(
e
:
viewEvents
.
ViewCursorPositionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
boolean
{
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorRevealRange
(
e
:
viewEvents
.
I
ViewRevealRangeEvent
):
boolean
{
public
onCursorRevealRange
(
e
:
viewEvents
.
ViewRevealRangeEvent
):
boolean
{
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
e
.
scrollTopChanged
||
e
.
scrollWidthChanged
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
// --- end event handlers
...
...
src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts
浏览文件 @
77ceff4a
...
...
@@ -6,12 +6,10 @@
'
use strict
'
;
import
'
vs/css!./glyphMargin
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
DynamicViewOverlay
}
from
'
vs/editor/browser/view/dynamicViewOverlay
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
class
DecorationToRender
{
_decorationToRenderBrand
:
void
;
...
...
@@ -104,31 +102,31 @@ export class GlyphMarginOverlay extends DedupOverlay {
// --- begin event handlers
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
return
true
;
}
public
onModelDecorationsChanged
(
e
:
viewEvents
.
I
ViewDecorationsChangedEvent
):
boolean
{
public
onModelDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
true
;
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
true
;
}
public
onCursorPositionChanged
(
e
:
viewEvents
.
I
ViewCursorPositionChangedEvent
):
boolean
{
public
onCursorPositionChanged
(
e
:
viewEvents
.
ViewCursorPositionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
boolean
{
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorRevealRange
(
e
:
viewEvents
.
I
ViewRevealRangeEvent
):
boolean
{
public
onCursorRevealRange
(
e
:
viewEvents
.
ViewRevealRangeEvent
):
boolean
{
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
...
...
@@ -141,10 +139,10 @@ export class GlyphMarginOverlay extends DedupOverlay {
}
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
e
.
scrollTopChanged
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
...
...
src/vs/editor/browser/viewParts/indentGuides/indentGuides.ts
浏览文件 @
77ceff4a
...
...
@@ -6,12 +6,10 @@
'
use strict
'
;
import
'
vs/css!./indentGuides
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
DynamicViewOverlay
}
from
'
vs/editor/browser/view/dynamicViewOverlay
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
class
IndentGuidesOverlay
extends
DynamicViewOverlay
{
...
...
@@ -39,19 +37,19 @@ export class IndentGuidesOverlay extends DynamicViewOverlay {
}
// --- begin event handlers
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
return
true
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
true
;
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
true
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
...
...
@@ -63,10 +61,10 @@ export class IndentGuidesOverlay extends DynamicViewOverlay {
}
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
e
.
scrollTopChanged
;
// || e.scrollWidthChanged;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
// --- end event handlers
...
...
src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
浏览文件 @
77ceff4a
...
...
@@ -7,13 +7,11 @@
import
'
vs/css!./lineNumbers
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
DynamicViewOverlay
}
from
'
vs/editor/browser/view/dynamicViewOverlay
'
;
import
{
ClassNames
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
class
LineNumbersOverlay
extends
DynamicViewOverlay
{
...
...
@@ -45,34 +43,34 @@ export class LineNumbersOverlay extends DynamicViewOverlay {
// --- begin event handlers
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
return
true
;
}
public
onModelDecorationsChanged
(
e
:
viewEvents
.
I
ViewDecorationsChangedEvent
):
boolean
{
public
onModelDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
return
false
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
true
;
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
true
;
}
public
onCursorPositionChanged
(
e
:
viewEvents
.
I
ViewCursorPositionChangedEvent
):
boolean
{
public
onCursorPositionChanged
(
e
:
viewEvents
.
ViewCursorPositionChangedEvent
):
boolean
{
if
(
this
.
_renderRelativeLineNumbers
)
{
return
true
;
}
return
false
;
}
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
boolean
{
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorRevealRange
(
e
:
viewEvents
.
I
ViewRevealRangeEvent
):
boolean
{
public
onCursorRevealRange
(
e
:
viewEvents
.
ViewRevealRangeEvent
):
boolean
{
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
...
...
@@ -88,10 +86,10 @@ export class LineNumbersOverlay extends DynamicViewOverlay {
}
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
e
.
scrollTopChanged
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
...
...
src/vs/editor/browser/viewParts/lines/viewLines.ts
浏览文件 @
77ceff4a
...
...
@@ -20,7 +20,6 @@ import { IViewLines, VisibleRange, LineVisibleRanges } from 'vs/editor/common/vi
import
{
IViewLayout
}
from
'
vs/editor/common/viewModel/viewModel
'
;
import
{
PartFingerprint
,
PartFingerprints
}
from
'
vs/editor/browser/view/viewPart
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
class
LastRenderedData
{
...
...
@@ -74,7 +73,7 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
private
_maxLineWidth
:
number
;
private
_asyncUpdateLineWidths
:
RunOnceScheduler
;
private
_lastCursorRevealRangeHorizontallyEvent
:
viewEvents
.
I
ViewRevealRangeEvent
;
private
_lastCursorRevealRangeHorizontallyEvent
:
viewEvents
.
ViewRevealRangeEvent
;
private
_lastRenderedData
:
LastRenderedData
;
constructor
(
context
:
ViewContext
,
viewLayout
:
IViewLayout
)
{
...
...
@@ -115,7 +114,7 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
// ---- begin view event handlers
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
super
.
onConfigurationChanged
(
e
);
if
(
e
.
wrappingInfo
)
{
this
.
_maxLineWidth
=
0
;
...
...
@@ -156,13 +155,13 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
return
true
;
}
public
onModelFlushed
():
boolean
{
let
shouldRender
=
super
.
onModelFlushed
();
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
let
shouldRender
=
super
.
onModelFlushed
(
e
);
this
.
_maxLineWidth
=
0
;
return
shouldRender
;
}
public
onModelDecorationsChanged
(
e
:
viewEvents
.
I
ViewDecorationsChangedEvent
):
boolean
{
public
onModelDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
let
shouldRender
=
super
.
onModelDecorationsChanged
(
e
);
if
(
true
/*e.inlineDecorationsChanged*/
)
{
let
rendStartLineNumber
=
this
.
_linesCollection
.
getStartLineNumber
();
...
...
@@ -174,7 +173,7 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
return
shouldRender
||
true
;
}
public
onCursorRevealRange
(
e
:
viewEvents
.
I
ViewRevealRangeEvent
):
boolean
{
public
onCursorRevealRange
(
e
:
viewEvents
.
ViewRevealRangeEvent
):
boolean
{
let
newScrollTop
=
this
.
_computeScrollTopToRevealRange
(
this
.
_viewLayout
.
getCurrentViewport
(),
e
.
range
,
e
.
verticalType
);
if
(
e
.
revealHorizontal
)
{
...
...
@@ -188,7 +187,7 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
return
true
;
}
public
onCursorScrollRequest
(
e
:
viewEvents
.
I
ViewScrollRequestEvent
):
boolean
{
public
onCursorScrollRequest
(
e
:
viewEvents
.
ViewScrollRequestEvent
):
boolean
{
let
currentScrollTop
=
this
.
_viewLayout
.
getScrollTop
();
let
newScrollTop
=
currentScrollTop
+
e
.
deltaLines
*
this
.
_lineHeight
;
this
.
_viewLayout
.
setScrollPosition
({
...
...
@@ -197,7 +196,7 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
this
.
domNode
.
setWidth
(
e
.
scrollWidth
);
return
super
.
onScrollChanged
(
e
)
||
true
;
}
...
...
src/vs/editor/browser/viewParts/linesDecorations/linesDecorations.ts
浏览文件 @
77ceff4a
...
...
@@ -6,12 +6,10 @@
'
use strict
'
;
import
'
vs/css!./linesDecorations
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
DecorationToRender
,
DedupOverlay
}
from
'
vs/editor/browser/viewParts/glyphMargin/glyphMargin
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
class
LinesDecorationsOverlay
extends
DedupOverlay
{
...
...
@@ -38,41 +36,41 @@ export class LinesDecorationsOverlay extends DedupOverlay {
// --- begin event handlers
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
return
true
;
}
public
onModelDecorationsChanged
(
e
:
viewEvents
.
I
ViewDecorationsChangedEvent
):
boolean
{
public
onModelDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
true
;
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
true
;
}
public
onCursorPositionChanged
(
e
:
viewEvents
.
I
ViewCursorPositionChangedEvent
):
boolean
{
public
onCursorPositionChanged
(
e
:
viewEvents
.
ViewCursorPositionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
boolean
{
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorRevealRange
(
e
:
viewEvents
.
I
ViewRevealRangeEvent
):
boolean
{
public
onCursorRevealRange
(
e
:
viewEvents
.
ViewRevealRangeEvent
):
boolean
{
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
layoutInfo
)
{
this
.
_decorationsLeft
=
this
.
_context
.
configuration
.
editor
.
layoutInfo
.
decorationsLeft
;
this
.
_decorationsWidth
=
this
.
_context
.
configuration
.
editor
.
layoutInfo
.
decorationsWidth
;
}
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
e
.
scrollTopChanged
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
...
...
src/vs/editor/browser/viewParts/margin/margin.ts
浏览文件 @
77ceff4a
...
...
@@ -6,12 +6,11 @@
'
use strict
'
;
import
{
StyleMutator
,
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/styleMutator
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
ClassNames
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ViewPart
}
from
'
vs/editor/browser/view/viewPart
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
,
IRestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
export
class
Margin
extends
ViewPart
{
public
domNode
:
HTMLElement
;
...
...
@@ -51,7 +50,7 @@ export class Margin extends ViewPart {
// --- begin event handlers
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
viewInfo
.
canUseTranslate3d
)
{
this
.
_canUseTranslate3d
=
this
.
_context
.
configuration
.
editor
.
viewInfo
.
canUseTranslate3d
;
}
...
...
@@ -65,7 +64,7 @@ export class Margin extends ViewPart {
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
super
.
onScrollChanged
(
e
)
||
e
.
scrollTopChanged
;
}
...
...
src/vs/editor/browser/viewParts/marginDecorations/marginDecorations.ts
浏览文件 @
77ceff4a
...
...
@@ -6,12 +6,10 @@
'
use strict
'
;
import
'
vs/css!./marginDecorations
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
DecorationToRender
,
DedupOverlay
}
from
'
vs/editor/browser/viewParts/glyphMargin/glyphMargin
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
class
MarginViewLineDecorationsOverlay
extends
DedupOverlay
{
private
_context
:
ViewContext
;
...
...
@@ -32,37 +30,37 @@ export class MarginViewLineDecorationsOverlay extends DedupOverlay {
// --- begin event handlers
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
return
true
;
}
public
onModelDecorationsChanged
(
e
:
viewEvents
.
I
ViewDecorationsChangedEvent
):
boolean
{
public
onModelDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
true
;
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
true
;
}
public
onCursorPositionChanged
(
e
:
viewEvents
.
I
ViewCursorPositionChangedEvent
):
boolean
{
public
onCursorPositionChanged
(
e
:
viewEvents
.
ViewCursorPositionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
boolean
{
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorRevealRange
(
e
:
viewEvents
.
I
ViewRevealRangeEvent
):
boolean
{
public
onCursorRevealRange
(
e
:
viewEvents
.
ViewRevealRangeEvent
):
boolean
{
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
e
.
scrollTopChanged
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
...
...
src/vs/editor/browser/viewParts/minimap/minimap.ts
浏览文件 @
77ceff4a
...
...
@@ -24,7 +24,6 @@ import { RenderedLinesCollection, ILine } from 'vs/editor/browser/view/viewLayer
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
RGBA
}
from
'
vs/base/common/color
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
const
enum
RenderMinimap
{
None
=
0
,
...
...
@@ -297,16 +296,16 @@ class RenderData {
};
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
void
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
void
{
this
.
_renderedLines
.
onModelLinesDeleted
(
e
.
fromLineNumber
,
e
.
toLineNumber
);
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
return
this
.
_renderedLines
.
onModelLineChanged
(
e
.
lineNumber
);
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
void
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
void
{
this
.
_renderedLines
.
onModelLinesInserted
(
e
.
fromLineNumber
,
e
.
toLineNumber
);
}
public
onModelTokensChanged
(
e
:
viewEvents
.
I
ViewTokensChangedEvent
):
boolean
{
public
onModelTokensChanged
(
e
:
viewEvents
.
ViewTokensChangedEvent
):
boolean
{
return
this
.
_renderedLines
.
onModelTokensChanged
(
e
.
ranges
);
}
}
...
...
@@ -429,14 +428,12 @@ export class Minimap extends ViewPart {
let
lineNumber
=
lineIndex
+
this
.
_lastRenderData
.
renderedLayout
.
startLineNumber
;
lineNumber
=
Math
.
min
(
lineNumber
,
this
.
_context
.
model
.
getLineCount
());
let
revealPositionEvent
:
viewEvents
.
IViewRevealRangeEvent
=
{
_viewRevealRangeEventBrand
:
void
0
,
range
:
new
Range
(
lineNumber
,
1
,
lineNumber
,
1
),
verticalType
:
editorCommon
.
VerticalRevealType
.
Center
,
revealHorizontal
:
false
,
revealCursor
:
false
};
this
.
_context
.
privateViewEventBus
.
emit
(
viewEvents
.
ViewEventNames
.
RevealRangeEvent
,
revealPositionEvent
);
this
.
_context
.
privateViewEventBus
.
emit
(
viewEvents
.
ViewEventNames
.
RevealRangeEvent
,
new
viewEvents
.
ViewRevealRangeEvent
(
new
Range
(
lineNumber
,
1
,
lineNumber
,
1
),
editorCommon
.
VerticalRevealType
.
Center
,
false
,
false
));
});
}
...
...
@@ -486,41 +483,41 @@ export class Minimap extends ViewPart {
return
true
;
}
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
this
.
_lastRenderData
=
null
;
return
true
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
if
(
this
.
_lastRenderData
)
{
this
.
_lastRenderData
.
onModelLinesDeleted
(
e
);
}
return
true
;
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
if
(
this
.
_lastRenderData
)
{
return
this
.
_lastRenderData
.
onModelLineChanged
(
e
);
}
return
false
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
if
(
this
.
_lastRenderData
)
{
this
.
_lastRenderData
.
onModelLinesInserted
(
e
);
}
return
true
;
}
public
onModelTokensChanged
(
e
:
viewEvents
.
I
ViewTokensChangedEvent
):
boolean
{
public
onModelTokensChanged
(
e
:
viewEvents
.
ViewTokensChangedEvent
):
boolean
{
if
(
this
.
_lastRenderData
)
{
return
this
.
_lastRenderData
.
onModelTokensChanged
(
e
);
}
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
return
this
.
_onOptionsMaybeChanged
();
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
e
.
scrollTopChanged
||
e
.
scrollHeightChanged
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
this
.
_lastRenderData
=
null
;
return
true
;
}
...
...
src/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.ts
浏览文件 @
77ceff4a
...
...
@@ -7,11 +7,11 @@
import
'
vs/css!./overlayWidgets
'
;
import
{
StyleMutator
}
from
'
vs/base/browser/styleMutator
'
;
import
{
IConfigurationChangedEvent
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ClassNames
,
IOverlayWidget
,
OverlayWidgetPositionPreference
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ViewPart
,
PartFingerprint
,
PartFingerprints
}
from
'
vs/editor/browser/view/viewPart
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
,
IRestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
interface
IWidgetData
{
widget
:
IOverlayWidget
;
...
...
@@ -53,7 +53,7 @@ export class ViewOverlayWidgets extends ViewPart {
// ---- begin view event handlers
public
onConfigurationChanged
(
e
:
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
layoutInfo
)
{
this
.
_verticalScrollbarWidth
=
this
.
_context
.
configuration
.
editor
.
layoutInfo
.
verticalScrollbarWidth
;
this
.
_horizontalScrollbarHeight
=
this
.
_context
.
configuration
.
editor
.
layoutInfo
.
horizontalScrollbarHeight
;
...
...
src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts
浏览文件 @
77ceff4a
...
...
@@ -14,7 +14,6 @@ import { Position } from 'vs/editor/common/core/position';
import
{
TokenizationRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
class
DecorationsOverviewRuler
extends
ViewPart
{
...
...
@@ -84,14 +83,14 @@ export class DecorationsOverviewRuler extends ViewPart {
// ---- begin view event handlers
public
onCursorPositionChanged
(
e
:
viewEvents
.
I
ViewCursorPositionChangedEvent
):
boolean
{
public
onCursorPositionChanged
(
e
:
viewEvents
.
ViewCursorPositionChangedEvent
):
boolean
{
this
.
_shouldUpdateCursorPosition
=
true
;
this
.
_cursorPositions
=
[
e
.
position
];
this
.
_cursorPositions
=
this
.
_cursorPositions
.
concat
(
e
.
secondaryPositions
);
return
true
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
let
prevLanesCount
=
this
.
_overviewRuler
.
getLanesCount
();
let
newLanesCount
=
this
.
_context
.
configuration
.
editor
.
viewInfo
.
overviewRulerLanes
;
...
...
@@ -137,22 +136,22 @@ export class DecorationsOverviewRuler extends ViewPart {
return
shouldRender
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
this
.
_shouldUpdateCursorPosition
=
true
;
this
.
_shouldUpdateDecorations
=
true
;
return
true
;
}
public
onModelDecorationsChanged
(
e
:
viewEvents
.
I
ViewDecorationsChangedEvent
):
boolean
{
public
onModelDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
this
.
_shouldUpdateDecorations
=
true
;
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
this
.
_overviewRuler
.
setScrollHeight
(
e
.
scrollHeight
,
false
);
return
super
.
onScrollChanged
(
e
)
||
e
.
scrollHeightChanged
;
}
...
...
src/vs/editor/browser/viewParts/overviewRuler/overviewRuler.ts
浏览文件 @
77ceff4a
...
...
@@ -4,12 +4,12 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IConfigurationChangedEvent
,
OverviewRulerPosition
,
OverviewRulerZone
}
from
'
vs/editor/common/editorCommon
'
;
import
{
OverviewRulerPosition
,
OverviewRulerZone
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ViewEventHandler
}
from
'
vs/editor/common/viewModel/viewEventHandler
'
;
import
{
IOverviewRuler
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
OverviewRulerImpl
}
from
'
vs/editor/browser/viewParts/overviewRuler/overviewRulerImpl
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
export
class
OverviewRuler
extends
ViewEventHandler
implements
IOverviewRuler
{
...
...
@@ -30,7 +30,7 @@ export class OverviewRuler extends ViewEventHandler implements IOverviewRuler {
this
.
_overviewRuler
.
dispose
();
}
public
onConfigurationChanged
(
e
:
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_overviewRuler
.
setLineHeight
(
this
.
_context
.
configuration
.
editor
.
lineHeight
,
true
);
return
true
;
...
...
@@ -44,15 +44,15 @@ export class OverviewRuler extends ViewEventHandler implements IOverviewRuler {
return
false
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
this
.
_overviewRuler
.
setScrollHeight
(
e
.
scrollHeight
,
true
);
return
super
.
onScrollChanged
(
e
)
||
e
.
scrollHeightChanged
;
}
...
...
src/vs/editor/browser/viewParts/rulers/rulers.ts
浏览文件 @
77ceff4a
...
...
@@ -7,11 +7,10 @@
import
'
vs/css!./rulers
'
;
import
{
StyleMutator
}
from
'
vs/base/browser/styleMutator
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
ViewPart
}
from
'
vs/editor/browser/view/viewPart
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
,
IRestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
export
class
Rulers
extends
ViewPart
{
...
...
@@ -35,7 +34,7 @@ export class Rulers extends ViewPart {
// --- begin event handlers
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
viewInfo
.
rulers
||
e
.
layoutInfo
||
e
.
fontInfo
)
{
this
.
_rulers
=
this
.
_context
.
configuration
.
editor
.
viewInfo
.
rulers
;
this
.
_height
=
this
.
_context
.
configuration
.
editor
.
layoutInfo
.
contentHeight
;
...
...
@@ -44,7 +43,7 @@ export class Rulers extends ViewPart {
}
return
false
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
super
.
onScrollChanged
(
e
)
||
e
.
scrollHeightChanged
;
}
...
...
src/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.ts
浏览文件 @
77ceff4a
...
...
@@ -8,12 +8,11 @@
import
'
vs/css!./scrollDecoration
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
StyleMutator
}
from
'
vs/base/browser/styleMutator
'
;
import
{
IConfigurationChangedEvent
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ClassNames
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ViewPart
}
from
'
vs/editor/browser/view/viewPart
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
,
IRestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
export
class
ScrollDecorationViewPart
extends
ViewPart
{
...
...
@@ -48,7 +47,7 @@ export class ScrollDecorationViewPart extends ViewPart {
// --- begin event handlers
public
onConfigurationChanged
(
e
:
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
let
shouldRender
=
false
;
if
(
e
.
viewInfo
.
scrollbar
)
{
this
.
_useShadows
=
this
.
_context
.
configuration
.
editor
.
viewInfo
.
scrollbar
.
useShadows
;
...
...
@@ -61,7 +60,7 @@ export class ScrollDecorationViewPart extends ViewPart {
}
return
this
.
_updateShouldShow
()
||
shouldRender
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
this
.
_scrollTop
=
e
.
scrollTop
;
return
this
.
_updateShouldShow
();
}
...
...
src/vs/editor/browser/viewParts/selections/selections.ts
浏览文件 @
77ceff4a
...
...
@@ -6,14 +6,12 @@
'
use strict
'
;
import
'
vs/css!./selections
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
DynamicViewOverlay
}
from
'
vs/editor/browser/view/dynamicViewOverlay
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
HorizontalRange
,
LineVisibleRanges
,
IRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
*
as
browser
from
'
vs/base/browser/browser
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
const
enum
CornerStyle
{
EXTERN
,
...
...
@@ -100,34 +98,34 @@ export class SelectionsOverlay extends DynamicViewOverlay {
// --- begin event handlers
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
return
true
;
}
public
onModelDecorationsChanged
(
e
:
viewEvents
.
I
ViewDecorationsChangedEvent
):
boolean
{
public
onModelDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
// true for inline decorations that can end up relayouting text
return
true
;
//e.inlineDecorationsChanged;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
true
;
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
true
;
}
public
onCursorPositionChanged
(
e
:
viewEvents
.
I
ViewCursorPositionChangedEvent
):
boolean
{
public
onCursorPositionChanged
(
e
:
viewEvents
.
ViewCursorPositionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
boolean
{
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
boolean
{
this
.
_selections
=
[
e
.
selection
];
this
.
_selections
=
this
.
_selections
.
concat
(
e
.
secondarySelections
);
return
true
;
}
public
onCursorRevealRange
(
e
:
viewEvents
.
I
ViewRevealRangeEvent
):
boolean
{
public
onCursorRevealRange
(
e
:
viewEvents
.
ViewRevealRangeEvent
):
boolean
{
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
...
...
@@ -136,10 +134,10 @@ export class SelectionsOverlay extends DynamicViewOverlay {
}
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
e
.
scrollTopChanged
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
...
...
src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts
浏览文件 @
77ceff4a
...
...
@@ -7,10 +7,11 @@
import
{
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/styleMutator
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IConfigurationChangedEvent
,
TextEditorCursorStyle
}
from
'
vs/editor/common/editorCommon
'
;
import
{
TextEditorCursorStyle
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Configuration
}
from
'
vs/editor/browser/config/configuration
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
,
IRestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
export
interface
IViewCursorRenderData
{
domNode
:
HTMLElement
;
...
...
@@ -122,7 +123,7 @@ export class ViewCursor {
return
true
;
}
public
onConfigurationChanged
(
e
:
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
...
...
src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts
浏览文件 @
77ceff4a
...
...
@@ -16,7 +16,6 @@ import { IRenderingContext, IRestrictedRenderingContext } from 'vs/editor/common
import
{
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/styleMutator
'
;
import
{
TimeoutTimer
}
from
'
vs/base/common/async
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
class
ViewCursors
extends
ViewPart
{
...
...
@@ -75,7 +74,7 @@ export class ViewCursors extends ViewPart {
// --- begin event handlers
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
this
.
_primaryCursor
.
onModelFlushed
();
for
(
let
i
=
0
,
len
=
this
.
_secondaryCursors
.
length
;
i
<
len
;
i
++
)
{
let
domNode
=
this
.
_secondaryCursors
[
i
].
getDomNode
();
...
...
@@ -84,20 +83,20 @@ export class ViewCursors extends ViewPart {
this
.
_secondaryCursors
=
[];
return
true
;
}
public
onModelDecorationsChanged
(
e
:
viewEvents
.
I
ViewDecorationsChangedEvent
):
boolean
{
public
onModelDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
// true for inline decorations that can end up relayouting text
return
true
;
//e.inlineDecorationsChanged;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
true
;
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
true
;
}
public
onModelTokensChanged
(
e
:
viewEvents
.
I
ViewTokensChangedEvent
):
boolean
{
public
onModelTokensChanged
(
e
:
viewEvents
.
ViewTokensChangedEvent
):
boolean
{
let
shouldRender
=
(
position
:
Position
)
=>
{
for
(
let
i
=
0
,
len
=
e
.
ranges
.
length
;
i
<
len
;
i
++
)
{
if
(
e
.
ranges
[
i
].
fromLineNumber
<=
position
.
lineNumber
&&
position
.
lineNumber
<=
e
.
ranges
[
i
].
toLineNumber
)
{
...
...
@@ -116,7 +115,7 @@ export class ViewCursors extends ViewPart {
}
return
false
;
}
public
onCursorPositionChanged
(
e
:
viewEvents
.
I
ViewCursorPositionChangedEvent
):
boolean
{
public
onCursorPositionChanged
(
e
:
viewEvents
.
ViewCursorPositionChangedEvent
):
boolean
{
this
.
_primaryCursor
.
onCursorPositionChanged
(
e
.
position
,
e
.
isInEditableRange
);
this
.
_updateBlinking
();
...
...
@@ -143,7 +142,7 @@ export class ViewCursors extends ViewPart {
return
true
;
}
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
boolean
{
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
boolean
{
let
selectionIsEmpty
=
e
.
selection
.
isEmpty
();
if
(
this
.
_selectionIsEmpty
!==
selectionIsEmpty
)
{
this
.
_selectionIsEmpty
=
selectionIsEmpty
;
...
...
@@ -151,7 +150,7 @@ export class ViewCursors extends ViewPart {
}
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
readOnly
)
{
this
.
_readOnly
=
this
.
_context
.
configuration
.
editor
.
readOnly
;
...
...
@@ -173,14 +172,14 @@ export class ViewCursors extends ViewPart {
}
return
true
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
true
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
public
onViewFocusChanged
(
isFocused
:
boolean
):
boolean
{
this
.
_editorHasFocus
=
isFocused
;
public
onViewFocusChanged
(
e
:
viewEvents
.
ViewFocusChangedEvent
):
boolean
{
this
.
_editorHasFocus
=
e
.
isFocused
;
this
.
_updateBlinking
();
return
false
;
}
...
...
src/vs/editor/browser/viewParts/viewZones/viewZones.ts
浏览文件 @
77ceff4a
...
...
@@ -14,7 +14,6 @@ import { Position } from 'vs/editor/common/core/position';
import
{
IRenderingContext
,
IRestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
IViewLayout
}
from
'
vs/editor/common/viewModel/viewModel
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
interface
IMyViewZone
{
whitespaceId
:
number
;
...
...
@@ -90,7 +89,7 @@ export class ViewZones extends ViewPart {
return
hadAChange
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
...
...
@@ -105,23 +104,23 @@ export class ViewZones extends ViewPart {
return
true
;
}
public
onLineMappingChanged
():
boolean
{
public
onLineMappingChanged
(
e
:
viewEvents
.
ViewLineMappingChangedEvents
):
boolean
{
return
this
.
_recomputeWhitespacesProps
();
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
e
.
scrollTopChanged
||
e
.
scrollWidthChanged
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
true
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
true
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
true
;
}
...
...
src/vs/editor/common/view/viewEvents.ts
浏览文件 @
77ceff4a
...
...
@@ -4,10 +4,11 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
VerticalRevealType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
VerticalRevealType
,
IConfigurationChangedEvent
,
IViewConfigurationChangedEvent
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
const
ViewEventNames
=
{
ModelFlushedEvent
:
'
modelFlushedEvent
'
,
...
...
@@ -24,52 +25,102 @@ export const ViewEventNames = {
ViewScrollChanged
:
'
scrollChanged
'
,
ViewFocusChanged
:
'
focusChanged
'
,
ZonesChanged
:
'
viewZonesChanged
'
,
ConfigurationChanged
:
'
viewConfigurationChanged
'
};
export
interface
IViewDecorationsChangedEvent
{
export
const
enum
ViewEventType
{
ModelFlushedEvent
=
1
,
LinesDeletedEvent
=
2
,
LinesInsertedEvent
=
3
,
LineChangedEvent
=
4
,
TokensChangedEvent
=
5
,
DecorationsChangedEvent
=
6
,
CursorPositionChangedEvent
=
7
,
CursorSelectionChangedEvent
=
8
,
RevealRangeEvent
=
9
,
LineMappingChangedEvent
=
10
,
ScrollRequestEvent
=
11
,
ViewScrollChanged
=
12
,
ViewFocusChanged
=
13
,
ZonesChanged
=
14
,
ConfigurationChanged
=
15
}
export
interface
IViewEvent
{
readonly
type
:
ViewEventType
;
}
export
class
ViewDecorationsChangedEvent
implements
IViewEvent
{
_viewDecorationsChangedEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
DecorationsChangedEvent
;
constructor
()
{
// Nothing to do
}
}
export
interface
IViewLinesDeleted
Event
{
export
class
ViewLinesDeletedEvent
implements
IView
Event
{
_viewLinesDeletedEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
LinesDeletedEvent
;
/**
* At what line the deletion began (inclusive).
*/
readonly
fromLineNumber
:
number
;
public
readonly
fromLineNumber
:
number
;
/**
* At what line the deletion stopped (inclusive).
*/
readonly
toLineNumber
:
number
;
public
readonly
toLineNumber
:
number
;
constructor
(
fromLineNumber
:
number
,
toLineNumber
:
number
)
{
this
.
fromLineNumber
=
fromLineNumber
;
this
.
toLineNumber
=
toLineNumber
;
}
}
export
interface
IViewLineChanged
Event
{
export
class
ViewLineChangedEvent
implements
IView
Event
{
_viewLineChangedEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
LineChangedEvent
;
/**
* The line that has changed.
*/
readonly
lineNumber
:
number
;
public
readonly
lineNumber
:
number
;
constructor
(
lineNumber
:
number
)
{
this
.
lineNumber
=
lineNumber
;
}
}
export
interface
IViewLinesInserted
Event
{
export
class
ViewLinesInsertedEvent
implements
IView
Event
{
_viewLinesInsertedEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
LinesInsertedEvent
;
/**
* Before what line did the insertion begin
*/
readonly
fromLineNumber
:
number
;
public
readonly
fromLineNumber
:
number
;
/**
* `toLineNumber` - `fromLineNumber` + 1 denotes the number of lines that were inserted
*/
readonly
toLineNumber
:
number
;
public
readonly
toLineNumber
:
number
;
constructor
(
fromLineNumber
:
number
,
toLineNumber
:
number
)
{
this
.
fromLineNumber
=
fromLineNumber
;
this
.
toLineNumber
=
toLineNumber
;
}
}
export
interface
IViewTokensChanged
Event
{
export
class
ViewTokensChangedEvent
implements
IView
Event
{
_viewTokensChangedEventBrand
:
void
;
readonly
ranges
:
{
public
readonly
type
=
ViewEventType
.
TokensChangedEvent
;
public
readonly
ranges
:
{
/**
* Start line number of range
*/
...
...
@@ -79,61 +130,188 @@ export interface IViewTokensChangedEvent {
*/
readonly
toLineNumber
:
number
;
}[];
constructor
(
ranges
:
{
fromLineNumber
:
number
;
toLineNumber
:
number
;
}[])
{
this
.
ranges
=
ranges
;
}
}
export
interface
IViewCursorPositionChanged
Event
{
export
class
ViewCursorPositionChangedEvent
implements
IView
Event
{
_viewCursorPositionChangedEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
CursorPositionChangedEvent
;
/**
* Primary cursor's position.
*/
readonly
position
:
Position
;
public
readonly
position
:
Position
;
/**
* Secondary cursors' position.
*/
readonly
secondaryPositions
:
Position
[];
public
readonly
secondaryPositions
:
Position
[];
/**
* Is the primary cursor in the editable range?
*/
readonly
isInEditableRange
:
boolean
;
public
readonly
isInEditableRange
:
boolean
;
constructor
(
position
:
Position
,
secondaryPositions
:
Position
[],
isInEditableRange
:
boolean
)
{
this
.
position
=
position
;
this
.
secondaryPositions
=
secondaryPositions
;
this
.
isInEditableRange
=
isInEditableRange
;
}
}
export
interface
IViewCursorSelectionChanged
Event
{
export
class
ViewCursorSelectionChangedEvent
implements
IView
Event
{
_viewCursorSelectionChangedEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
CursorSelectionChangedEvent
;
/**
* The primary selection.
*/
readonly
selection
:
Selection
;
public
readonly
selection
:
Selection
;
/**
* The secondary selections.
*/
readonly
secondarySelections
:
Selection
[];
public
readonly
secondarySelections
:
Selection
[];
constructor
(
selection
:
Selection
,
secondarySelections
:
Selection
[])
{
this
.
selection
=
selection
;
this
.
secondarySelections
=
secondarySelections
;
}
}
export
interface
IViewRevealRange
Event
{
export
class
ViewRevealRangeEvent
implements
IView
Event
{
_viewRevealRangeEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
RevealRangeEvent
;
/**
* Range to be reavealed.
*/
readonly
range
:
Range
;
public
readonly
range
:
Range
;
readonly
verticalType
:
VerticalRevealType
;
public
readonly
verticalType
:
VerticalRevealType
;
/**
* If true: there should be a horizontal & vertical revealing
* If false: there should be just a vertical revealing
*/
readonly
revealHorizontal
:
boolean
;
public
readonly
revealHorizontal
:
boolean
;
/**
* If true: cursor is revealed if outside viewport
*/
readonly
revealCursor
:
boolean
;
public
readonly
revealCursor
:
boolean
;
constructor
(
range
:
Range
,
verticalType
:
VerticalRevealType
,
revealHorizontal
:
boolean
,
revealCursor
:
boolean
)
{
this
.
range
=
range
;
this
.
verticalType
=
verticalType
;
this
.
revealHorizontal
=
revealHorizontal
;
this
.
revealCursor
=
revealCursor
;
}
}
export
interface
IViewScrollRequest
Event
{
export
class
ViewScrollRequestEvent
implements
IView
Event
{
_viewScrollRequestEventBrand
:
void
;
readonly
deltaLines
:
number
;
readonly
revealCursor
:
boolean
;
public
readonly
type
=
ViewEventType
.
ScrollRequestEvent
;
public
readonly
deltaLines
:
number
;
public
readonly
revealCursor
:
boolean
;
constructor
(
deltaLines
:
number
,
revealCursor
:
boolean
)
{
this
.
deltaLines
=
deltaLines
;
this
.
revealCursor
=
revealCursor
;
}
}
export
class
ViewLineMappingChangedEvents
implements
IViewEvent
{
_viewLineMappingChangedEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
LineMappingChangedEvent
;
constructor
()
{
// Nothing to do
}
}
export
class
ViewModelFlushedEvent
implements
IViewEvent
{
_viewModelFlushedEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
ModelFlushedEvent
;
constructor
()
{
// Nothing to do
}
}
export
class
ViewConfigurationChangedEvent
implements
IViewEvent
{
_viewConfigurationChangedEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
ConfigurationChanged
;
public
readonly
lineHeight
:
boolean
;
public
readonly
readOnly
:
boolean
;
public
readonly
layoutInfo
:
boolean
;
public
readonly
fontInfo
:
boolean
;
public
readonly
viewInfo
:
IViewConfigurationChangedEvent
;
public
readonly
wrappingInfo
:
boolean
;
constructor
(
source
:
IConfigurationChangedEvent
)
{
this
.
lineHeight
=
source
.
lineHeight
;
this
.
readOnly
=
source
.
readOnly
;
this
.
layoutInfo
=
source
.
layoutInfo
;
this
.
fontInfo
=
source
.
fontInfo
;
this
.
viewInfo
=
source
.
viewInfo
;
this
.
wrappingInfo
=
source
.
wrappingInfo
;
}
}
export
class
ViewScrollChangedEvent
implements
IViewEvent
{
_viewScrollChangedEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
ViewScrollChanged
;
public
readonly
scrollWidth
:
number
;
public
readonly
scrollLeft
:
number
;
public
readonly
scrollHeight
:
number
;
public
readonly
scrollTop
:
number
;
public
readonly
scrollWidthChanged
:
boolean
;
public
readonly
scrollLeftChanged
:
boolean
;
public
readonly
scrollHeightChanged
:
boolean
;
public
readonly
scrollTopChanged
:
boolean
;
constructor
(
source
:
ScrollEvent
)
{
this
.
scrollWidth
=
source
.
scrollWidth
;
this
.
scrollLeft
=
source
.
scrollLeft
;
this
.
scrollHeight
=
source
.
scrollHeight
;
this
.
scrollTop
=
source
.
scrollTop
;
this
.
scrollWidthChanged
=
source
.
scrollWidthChanged
;
this
.
scrollLeftChanged
=
source
.
scrollLeftChanged
;
this
.
scrollHeightChanged
=
source
.
scrollHeightChanged
;
this
.
scrollTopChanged
=
source
.
scrollTopChanged
;
}
}
export
class
ViewZonesChangedEvent
implements
IViewEvent
{
_viewZonesChangedEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
ZonesChanged
;
constructor
()
{
// Nothing to do
}
}
export
class
ViewFocusChangedEvent
implements
IViewEvent
{
_viewFocusChangedEventBrand
:
void
;
public
readonly
type
=
ViewEventType
.
ViewFocusChanged
;
public
readonly
isFocused
:
boolean
;
constructor
(
isFocused
:
boolean
)
{
this
.
isFocused
=
isFocused
;
}
}
src/vs/editor/common/viewModel/splitLinesCollection.ts
浏览文件 @
77ceff4a
...
...
@@ -508,7 +508,7 @@ export class SplitLinesCollection {
}
}
emit
(
viewEvents
.
ViewEventNames
.
ModelFlushedEvent
,
n
ull
);
emit
(
viewEvents
.
ViewEventNames
.
ModelFlushedEvent
,
n
ew
viewEvents
.
ViewModelFlushedEvent
()
);
return
true
;
}
...
...
@@ -527,7 +527,7 @@ export class SplitLinesCollection {
this
.
tabSize
=
newTabSize
;
this
.
_constructLines
(
false
);
emit
(
viewEvents
.
ViewEventNames
.
ModelFlushedEvent
,
n
ull
);
emit
(
viewEvents
.
ViewEventNames
.
ModelFlushedEvent
,
n
ew
viewEvents
.
ViewModelFlushedEvent
()
);
return
true
;
}
...
...
@@ -539,7 +539,7 @@ export class SplitLinesCollection {
this
.
wrappingIndent
=
newWrappingIndent
;
this
.
_constructLines
(
false
);
emit
(
viewEvents
.
ViewEventNames
.
ModelFlushedEvent
,
n
ull
);
emit
(
viewEvents
.
ViewEventNames
.
ModelFlushedEvent
,
n
ew
viewEvents
.
ViewModelFlushedEvent
()
);
return
true
;
}
...
...
@@ -551,14 +551,14 @@ export class SplitLinesCollection {
this
.
wrappingColumn
=
newWrappingColumn
;
this
.
columnsForFullWidthChar
=
columnsForFullWidthChar
;
this
.
_constructLines
(
false
);
emit
(
viewEvents
.
ViewEventNames
.
ModelFlushedEvent
,
n
ull
);
emit
(
viewEvents
.
ViewEventNames
.
ModelFlushedEvent
,
n
ew
viewEvents
.
ViewModelFlushedEvent
()
);
return
true
;
}
public
onModelFlushed
(
versionId
:
number
,
emit
:
(
evenType
:
string
,
payload
:
any
)
=>
void
):
void
{
this
.
_constructLines
(
true
);
emit
(
viewEvents
.
ViewEventNames
.
ModelFlushedEvent
,
n
ull
);
emit
(
viewEvents
.
ViewEventNames
.
ModelFlushedEvent
,
n
ew
viewEvents
.
ViewModelFlushedEvent
()
);
}
public
onModelLinesDeleted
(
versionId
:
number
,
fromLineNumber
:
number
,
toLineNumber
:
number
,
emit
:
(
evenType
:
string
,
payload
:
any
)
=>
void
):
void
{
...
...
@@ -573,12 +573,7 @@ export class SplitLinesCollection {
this
.
lines
.
splice
(
fromLineNumber
-
1
,
toLineNumber
-
fromLineNumber
+
1
);
this
.
prefixSumComputer
.
removeValues
(
fromLineNumber
-
1
,
toLineNumber
-
fromLineNumber
+
1
);
let
e
:
viewEvents
.
IViewLinesDeletedEvent
=
{
_viewLinesDeletedEventBrand
:
void
0
,
fromLineNumber
:
outputFromLineNumber
,
toLineNumber
:
outputToLineNumber
};
emit
(
viewEvents
.
ViewEventNames
.
LinesDeletedEvent
,
e
);
emit
(
viewEvents
.
ViewEventNames
.
LinesDeletedEvent
,
new
viewEvents
.
ViewLinesDeletedEvent
(
outputFromLineNumber
,
outputToLineNumber
));
}
public
onModelLinesInserted
(
versionId
:
number
,
fromLineNumber
:
number
,
toLineNumber
:
number
,
text
:
string
[],
emit
:
(
evenType
:
string
,
payload
:
any
)
=>
void
):
void
{
...
...
@@ -616,12 +611,7 @@ export class SplitLinesCollection {
this
.
prefixSumComputer
.
insertValues
(
fromLineNumber
-
1
,
insertPrefixSumValues
);
let
e
:
viewEvents
.
IViewLinesInsertedEvent
=
{
_viewLinesInsertedEventBrand
:
void
0
,
fromLineNumber
:
outputFromLineNumber
,
toLineNumber
:
outputFromLineNumber
+
totalOutputLineCount
-
1
};
emit
(
viewEvents
.
ViewEventNames
.
LinesInsertedEvent
,
e
);
emit
(
viewEvents
.
ViewEventNames
.
LinesInsertedEvent
,
new
viewEvents
.
ViewLinesInsertedEvent
(
outputFromLineNumber
,
outputFromLineNumber
+
totalOutputLineCount
-
1
));
}
public
onModelLineChanged
(
versionId
:
number
,
lineNumber
:
number
,
newText
:
string
,
emit
:
(
evenType
:
string
,
payload
:
any
)
=>
void
):
boolean
{
...
...
@@ -664,34 +654,16 @@ export class SplitLinesCollection {
this
.
prefixSumComputer
.
changeValue
(
lineIndex
,
newOutputLineCount
);
let
e1
:
viewEvents
.
IViewLineChangedEvent
;
let
e2
:
viewEvents
.
IViewLinesInsertedEvent
;
let
e3
:
viewEvents
.
IViewLinesDeletedEvent
;
if
(
changeFrom
<=
changeTo
)
{
for
(
let
i
=
changeFrom
;
i
<=
changeTo
;
i
++
)
{
e1
=
{
_viewLineChangedEventBrand
:
void
0
,
lineNumber
:
i
};
emit
(
viewEvents
.
ViewEventNames
.
LineChangedEvent
,
e1
);
emit
(
viewEvents
.
ViewEventNames
.
LineChangedEvent
,
new
viewEvents
.
ViewLineChangedEvent
(
i
));
}
}
if
(
insertFrom
<=
insertTo
)
{
e2
=
{
_viewLinesInsertedEventBrand
:
void
0
,
fromLineNumber
:
insertFrom
,
toLineNumber
:
insertTo
};
emit
(
viewEvents
.
ViewEventNames
.
LinesInsertedEvent
,
e2
);
emit
(
viewEvents
.
ViewEventNames
.
LinesInsertedEvent
,
new
viewEvents
.
ViewLinesInsertedEvent
(
insertFrom
,
insertTo
));
}
if
(
deleteFrom
<=
deleteTo
)
{
e3
=
{
_viewLinesDeletedEventBrand
:
void
0
,
fromLineNumber
:
deleteFrom
,
toLineNumber
:
deleteTo
};
emit
(
viewEvents
.
ViewEventNames
.
LinesDeletedEvent
,
e3
);
emit
(
viewEvents
.
ViewEventNames
.
LinesDeletedEvent
,
new
viewEvents
.
ViewLinesDeletedEvent
(
deleteFrom
,
deleteTo
));
}
return
lineMappingChanged
;
...
...
src/vs/editor/common/viewModel/viewEventHandler.ts
浏览文件 @
77ceff4a
...
...
@@ -5,9 +5,7 @@
'
use strict
'
;
import
{
EmitterEvent
}
from
'
vs/base/common/eventEmitter
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
export
class
ViewEventHandler
{
...
...
@@ -35,49 +33,49 @@ export class ViewEventHandler {
// --- begin event handlers
public
onLineMappingChanged
():
boolean
{
public
onLineMappingChanged
(
e
:
viewEvents
.
ViewLineMappingChangedEvents
):
boolean
{
return
false
;
}
public
onModelFlushed
():
boolean
{
public
onModelFlushed
(
e
:
viewEvents
.
ViewModelFlushedEvent
):
boolean
{
return
false
;
}
public
onModelDecorationsChanged
(
e
:
viewEvents
.
I
ViewDecorationsChangedEvent
):
boolean
{
public
onModelDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
return
false
;
}
public
onModelLinesDeleted
(
e
:
viewEvents
.
I
ViewLinesDeletedEvent
):
boolean
{
public
onModelLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
false
;
}
public
onModelLineChanged
(
e
:
viewEvents
.
I
ViewLineChangedEvent
):
boolean
{
public
onModelLineChanged
(
e
:
viewEvents
.
ViewLineChangedEvent
):
boolean
{
return
false
;
}
public
onModelLinesInserted
(
e
:
viewEvents
.
I
ViewLinesInsertedEvent
):
boolean
{
public
onModelLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
false
;
}
public
onModelTokensChanged
(
e
:
viewEvents
.
I
ViewTokensChangedEvent
):
boolean
{
public
onModelTokensChanged
(
e
:
viewEvents
.
ViewTokensChangedEvent
):
boolean
{
return
false
;
}
public
onCursorPositionChanged
(
e
:
viewEvents
.
I
ViewCursorPositionChangedEvent
):
boolean
{
public
onCursorPositionChanged
(
e
:
viewEvents
.
ViewCursorPositionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorSelectionChanged
(
e
:
viewEvents
.
I
ViewCursorSelectionChangedEvent
):
boolean
{
public
onCursorSelectionChanged
(
e
:
viewEvents
.
ViewCursorSelectionChangedEvent
):
boolean
{
return
false
;
}
public
onCursorRevealRange
(
e
:
viewEvents
.
I
ViewRevealRangeEvent
):
boolean
{
public
onCursorRevealRange
(
e
:
viewEvents
.
ViewRevealRangeEvent
):
boolean
{
return
false
;
}
public
onCursorScrollRequest
(
e
:
viewEvents
.
I
ViewScrollRequestEvent
):
boolean
{
public
onCursorScrollRequest
(
e
:
viewEvents
.
ViewScrollRequestEvent
):
boolean
{
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
I
ConfigurationChangedEvent
):
boolean
{
public
onConfigurationChanged
(
e
:
viewEvents
.
View
ConfigurationChangedEvent
):
boolean
{
return
false
;
}
public
onScrollChanged
(
e
:
Scroll
Event
):
boolean
{
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChanged
Event
):
boolean
{
return
false
;
}
public
onZonesChanged
():
boolean
{
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
false
;
}
public
onViewFocusChanged
(
isFocused
:
boolean
):
boolean
{
public
onViewFocusChanged
(
e
:
viewEvents
.
ViewFocusChangedEvent
):
boolean
{
return
false
;
}
...
...
@@ -94,91 +92,91 @@ export class ViewEventHandler {
switch
(
e
.
getType
())
{
case
viewEvents
.
ViewEventNames
.
LineMappingChangedEvent
:
if
(
this
.
onLineMappingChanged
())
{
if
(
this
.
onLineMappingChanged
(
<
viewEvents
.
ViewLineMappingChangedEvents
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
ModelFlushedEvent
:
if
(
this
.
onModelFlushed
())
{
if
(
this
.
onModelFlushed
(
<
viewEvents
.
ViewModelFlushedEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
LinesDeletedEvent
:
if
(
this
.
onModelLinesDeleted
(
<
viewEvents
.
I
ViewLinesDeletedEvent
>
data
))
{
if
(
this
.
onModelLinesDeleted
(
<
viewEvents
.
ViewLinesDeletedEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
LinesInsertedEvent
:
if
(
this
.
onModelLinesInserted
(
<
viewEvents
.
I
ViewLinesInsertedEvent
>
data
))
{
if
(
this
.
onModelLinesInserted
(
<
viewEvents
.
ViewLinesInsertedEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
LineChangedEvent
:
if
(
this
.
onModelLineChanged
(
<
viewEvents
.
I
ViewLineChangedEvent
>
data
))
{
if
(
this
.
onModelLineChanged
(
<
viewEvents
.
ViewLineChangedEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
TokensChangedEvent
:
if
(
this
.
onModelTokensChanged
(
<
viewEvents
.
I
ViewTokensChangedEvent
>
data
))
{
if
(
this
.
onModelTokensChanged
(
<
viewEvents
.
ViewTokensChangedEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
DecorationsChangedEvent
:
if
(
this
.
onModelDecorationsChanged
(
<
viewEvents
.
I
ViewDecorationsChangedEvent
>
data
))
{
if
(
this
.
onModelDecorationsChanged
(
<
viewEvents
.
ViewDecorationsChangedEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
CursorPositionChangedEvent
:
if
(
this
.
onCursorPositionChanged
(
<
viewEvents
.
I
ViewCursorPositionChangedEvent
>
data
))
{
if
(
this
.
onCursorPositionChanged
(
<
viewEvents
.
ViewCursorPositionChangedEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
CursorSelectionChangedEvent
:
if
(
this
.
onCursorSelectionChanged
(
<
viewEvents
.
I
ViewCursorSelectionChangedEvent
>
data
))
{
if
(
this
.
onCursorSelectionChanged
(
<
viewEvents
.
ViewCursorSelectionChangedEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
RevealRangeEvent
:
if
(
this
.
onCursorRevealRange
(
<
viewEvents
.
I
ViewRevealRangeEvent
>
data
))
{
if
(
this
.
onCursorRevealRange
(
<
viewEvents
.
ViewRevealRangeEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
ScrollRequestEvent
:
if
(
this
.
onCursorScrollRequest
(
<
viewEvents
.
I
ViewScrollRequestEvent
>
data
))
{
if
(
this
.
onCursorScrollRequest
(
<
viewEvents
.
ViewScrollRequestEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
case
editorCommon
.
EventType
.
ConfigurationChanged
:
if
(
this
.
onConfigurationChanged
(
<
editorCommon
.
I
ConfigurationChangedEvent
>
data
))
{
case
viewEvents
.
ViewEventNames
.
ConfigurationChanged
:
if
(
this
.
onConfigurationChanged
(
<
viewEvents
.
View
ConfigurationChangedEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
ViewScrollChanged
:
if
(
this
.
onScrollChanged
(
<
Scroll
Event
>
data
))
{
if
(
this
.
onScrollChanged
(
<
viewEvents
.
ViewScrollChanged
Event
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
ZonesChanged
:
if
(
this
.
onZonesChanged
())
{
if
(
this
.
onZonesChanged
(
<
viewEvents
.
ViewZonesChangedEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
case
viewEvents
.
ViewEventNames
.
ViewFocusChanged
:
if
(
this
.
onViewFocusChanged
(
<
boolean
>
data
))
{
if
(
this
.
onViewFocusChanged
(
<
viewEvents
.
ViewFocusChangedEvent
>
data
))
{
shouldRender
=
true
;
}
break
;
...
...
src/vs/editor/common/viewModel/viewModelCursors.ts
浏览文件 @
77ceff4a
...
...
@@ -62,44 +62,26 @@ export class ViewModelCursors {
secondaryPositions
[
i
]
=
ViewModelCursors
.
_toPositionThatCanBeRendered
(
e
.
secondaryViewPositions
[
i
],
stopRenderingLineAfter
);
}
let
newEvent
:
viewEvents
.
IViewCursorPositionChangedEvent
=
{
_viewCursorPositionChangedEventBrand
:
void
0
,
position
:
position
,
secondaryPositions
:
secondaryPositions
,
isInEditableRange
:
e
.
isInEditableRange
};
emit
(
viewEvents
.
ViewEventNames
.
CursorPositionChangedEvent
,
newEvent
);
emit
(
viewEvents
.
ViewEventNames
.
CursorPositionChangedEvent
,
new
viewEvents
.
ViewCursorPositionChangedEvent
(
position
,
secondaryPositions
,
e
.
isInEditableRange
));
}
public
onCursorSelectionChanged
(
e
:
ICursorSelectionChangedEvent
,
emit
:
(
eventType
:
string
,
payload
:
any
)
=>
void
):
void
{
this
.
lastCursorSelectionChangedEvent
=
e
;
let
newEvent
:
viewEvents
.
IViewCursorSelectionChangedEvent
=
{
_viewCursorSelectionChangedEventBrand
:
void
0
,
selection
:
e
.
viewSelection
,
secondarySelections
:
e
.
secondaryViewSelections
};
emit
(
viewEvents
.
ViewEventNames
.
CursorSelectionChangedEvent
,
newEvent
);
emit
(
viewEvents
.
ViewEventNames
.
CursorSelectionChangedEvent
,
new
viewEvents
.
ViewCursorSelectionChangedEvent
(
e
.
viewSelection
,
e
.
secondaryViewSelections
));
}
public
onCursorRevealRange
(
e
:
editorCommon
.
ICursorRevealRangeEvent
,
emit
:
(
eventType
:
string
,
payload
:
any
)
=>
void
):
void
{
let
newEvent
:
viewEvents
.
IViewRevealRangeEvent
=
{
_viewRevealRangeEventBrand
:
void
0
,
range
:
e
.
viewRange
,
verticalType
:
e
.
verticalType
,
revealHorizontal
:
e
.
revealHorizontal
,
revealCursor
:
e
.
revealCursor
};
emit
(
viewEvents
.
ViewEventNames
.
RevealRangeEvent
,
newEvent
);
emit
(
viewEvents
.
ViewEventNames
.
RevealRangeEvent
,
new
viewEvents
.
ViewRevealRangeEvent
(
e
.
viewRange
,
e
.
verticalType
,
e
.
revealHorizontal
,
e
.
revealCursor
));
}
public
onCursorScrollRequest
(
e
:
editorCommon
.
ICursorScrollRequestEvent
,
emit
:
(
eventType
:
string
,
payload
:
any
)
=>
void
):
void
{
let
newEvent
:
viewEvents
.
IViewScrollRequestEvent
=
{
_viewScrollRequestEventBrand
:
void
0
,
deltaLines
:
e
.
deltaLines
,
revealCursor
:
e
.
revealCursor
};
emit
(
viewEvents
.
ViewEventNames
.
ScrollRequestEvent
,
newEvent
);
emit
(
viewEvents
.
ViewEventNames
.
ScrollRequestEvent
,
new
viewEvents
.
ViewScrollRequestEvent
(
e
.
deltaLines
,
e
.
revealCursor
));
}
public
onLineMappingChanged
(
emit
:
(
eventType
:
string
,
payload
:
any
)
=>
void
):
void
{
...
...
src/vs/editor/common/viewModel/viewModelDecorations.ts
浏览文件 @
77ceff4a
...
...
@@ -78,14 +78,14 @@ export class ViewModelDecorations implements IDisposable {
}
this
.
_clearCachedModelDecorationsResolver
();
emit
(
viewEvents
.
ViewEventNames
.
DecorationsChangedEvent
,
{}
);
emit
(
viewEvents
.
ViewEventNames
.
DecorationsChangedEvent
,
new
viewEvents
.
ViewDecorationsChangedEvent
()
);
}
public
onLineMappingChanged
(
emit
:
(
eventType
:
string
,
payload
:
any
)
=>
void
):
void
{
this
.
_decorationsCache
=
Object
.
create
(
null
);
this
.
_clearCachedModelDecorationsResolver
();
emit
(
viewEvents
.
ViewEventNames
.
DecorationsChangedEvent
,
{}
);
emit
(
viewEvents
.
ViewEventNames
.
DecorationsChangedEvent
,
new
viewEvents
.
ViewDecorationsChangedEvent
()
);
}
private
_getOrCreateViewModelDecoration
(
modelDecoration
:
editorCommon
.
IModelDecoration
):
ViewModelDecoration
{
...
...
src/vs/editor/common/viewModel/viewModelImpl.ts
浏览文件 @
77ceff4a
...
...
@@ -140,7 +140,7 @@ export class ViewModel extends EventEmitter implements IViewModel {
private
_setHiddenAreas
(
ranges
:
editorCommon
.
IRange
[]):
void
{
let
lineMappingChanged
=
this
.
lines
.
setHiddenAreas
(
ranges
,
(
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
if
(
lineMappingChanged
)
{
this
.
emit
(
viewEvents
.
ViewEventNames
.
LineMappingChangedEvent
);
this
.
emit
(
viewEvents
.
ViewEventNames
.
LineMappingChangedEvent
,
new
viewEvents
.
ViewLineMappingChangedEvents
()
);
this
.
decorations
.
onLineMappingChanged
((
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
this
.
cursors
.
onLineMappingChanged
((
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
}
...
...
@@ -156,7 +156,7 @@ export class ViewModel extends EventEmitter implements IViewModel {
private
_onTabSizeChange
(
newTabSize
:
number
):
boolean
{
var
lineMappingChanged
=
this
.
lines
.
setTabSize
(
newTabSize
,
(
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
if
(
lineMappingChanged
)
{
this
.
emit
(
viewEvents
.
ViewEventNames
.
LineMappingChangedEvent
);
this
.
emit
(
viewEvents
.
ViewEventNames
.
LineMappingChangedEvent
,
new
viewEvents
.
ViewLineMappingChangedEvents
()
);
this
.
decorations
.
onLineMappingChanged
((
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
this
.
cursors
.
onLineMappingChanged
((
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
}
...
...
@@ -166,7 +166,7 @@ export class ViewModel extends EventEmitter implements IViewModel {
private
_onWrappingIndentChange
(
newWrappingIndent
:
editorCommon
.
WrappingIndent
):
boolean
{
var
lineMappingChanged
=
this
.
lines
.
setWrappingIndent
(
newWrappingIndent
,
(
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
if
(
lineMappingChanged
)
{
this
.
emit
(
viewEvents
.
ViewEventNames
.
LineMappingChangedEvent
);
this
.
emit
(
viewEvents
.
ViewEventNames
.
LineMappingChangedEvent
,
new
viewEvents
.
ViewLineMappingChangedEvents
()
);
this
.
decorations
.
onLineMappingChanged
((
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
this
.
cursors
.
onLineMappingChanged
((
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
}
...
...
@@ -178,20 +178,18 @@ export class ViewModel extends EventEmitter implements IViewModel {
var
newCenteredViewRange
=
this
.
coordinatesConverter
.
convertModelRangeToViewRange
(
range
);
// Send a reveal event to restore the centered content
var
restoreRevealEvent
:
viewEvents
.
IViewRevealRangeEvent
=
{
_viewRevealRangeEventBrand
:
void
0
,
range
:
newCenteredViewRange
,
verticalType
:
editorCommon
.
VerticalRevealType
.
Center
,
revealHorizontal
:
false
,
revealCursor
:
false
};
this
.
emit
(
viewEvents
.
ViewEventNames
.
RevealRangeEvent
,
restoreRevealEvent
);
this
.
emit
(
viewEvents
.
ViewEventNames
.
RevealRangeEvent
,
new
viewEvents
.
ViewRevealRangeEvent
(
newCenteredViewRange
,
editorCommon
.
VerticalRevealType
.
Center
,
false
,
false
));
}
private
_onWrappingColumnChange
(
newWrappingColumn
:
number
,
columnsForFullWidthChar
:
number
):
boolean
{
let
lineMappingChanged
=
this
.
lines
.
setWrappingColumn
(
newWrappingColumn
,
columnsForFullWidthChar
,
(
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
if
(
lineMappingChanged
)
{
this
.
emit
(
viewEvents
.
ViewEventNames
.
LineMappingChangedEvent
);
this
.
emit
(
viewEvents
.
ViewEventNames
.
LineMappingChangedEvent
,
new
viewEvents
.
ViewLineMappingChangedEvents
()
);
this
.
decorations
.
onLineMappingChanged
((
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
this
.
cursors
.
onLineMappingChanged
((
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
}
...
...
@@ -367,9 +365,9 @@ export class ViewModel extends EventEmitter implements IViewModel {
if
((
<
editorCommon
.
IConfigurationChangedEvent
>
data
).
readOnly
)
{
// Must read again all decorations due to readOnly filtering
this
.
decorations
.
reset
();
this
.
emit
(
viewEvents
.
ViewEventNames
.
DecorationsChangedEvent
,
{}
);
this
.
emit
(
viewEvents
.
ViewEventNames
.
DecorationsChangedEvent
,
new
viewEvents
.
ViewDecorationsChangedEvent
()
);
}
this
.
emit
(
e
.
getType
(),
<
editorCommon
.
IConfigurationChangedEvent
>
data
);
this
.
emit
(
viewEvents
.
ViewEventNames
.
ConfigurationChanged
,
new
viewEvents
.
ViewConfigurationChangedEvent
(
<
editorCommon
.
IConfigurationChangedEvent
>
data
)
);
break
;
default
:
...
...
@@ -379,7 +377,7 @@ export class ViewModel extends EventEmitter implements IViewModel {
}
if
(
!
hadOtherModelChange
&&
hadModelLineChangeThatChangedLineMapping
)
{
this
.
emit
(
viewEvents
.
ViewEventNames
.
LineMappingChangedEvent
);
this
.
emit
(
viewEvents
.
ViewEventNames
.
LineMappingChangedEvent
,
new
viewEvents
.
ViewLineMappingChangedEvents
()
);
this
.
decorations
.
onLineMappingChanged
((
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
this
.
cursors
.
onLineMappingChanged
((
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
}
...
...
@@ -413,11 +411,7 @@ export class ViewModel extends EventEmitter implements IViewModel {
};
}
var
e2
:
viewEvents
.
IViewTokensChangedEvent
=
{
_viewTokensChangedEventBrand
:
void
0
,
ranges
:
viewRanges
};
this
.
emit
(
viewEvents
.
ViewEventNames
.
TokensChangedEvent
,
e2
);
this
.
emit
(
viewEvents
.
ViewEventNames
.
TokensChangedEvent
,
new
viewEvents
.
ViewTokensChangedEvent
(
viewRanges
));
}
private
onModelLineChanged
(
e
:
editorCommon
.
IModelContentChangedLineChangedEvent
):
boolean
{
var
lineMappingChanged
=
this
.
lines
.
onModelLineChanged
(
e
.
versionId
,
e
.
lineNumber
,
e
.
detail
,
(
eventType
:
string
,
payload
:
any
)
=>
this
.
emit
(
eventType
,
payload
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录