Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e070afce
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,发现更多精彩内容 >>
提交
e070afce
编写于
8月 30, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Editor: `reveal*` family of methods take a `ScrollType` which can be `Smooth` or `Immediate`
上级
482c3404
变更
42
隐藏空白更改
内联
并排
Showing
42 changed file
with
265 addition
and
208 deletion
+265
-208
src/vs/editor/browser/controller/textAreaHandler.ts
src/vs/editor/browser/controller/textAreaHandler.ts
+3
-2
src/vs/editor/browser/viewParts/lines/viewLines.ts
src/vs/editor/browser/viewParts/lines/viewLines.ts
+20
-6
src/vs/editor/browser/viewParts/minimap/minimap.ts
src/vs/editor/browser/viewParts/minimap/minimap.ts
+2
-1
src/vs/editor/browser/widget/diffEditorWidget.ts
src/vs/editor/browser/widget/diffEditorWidget.ts
+34
-34
src/vs/editor/browser/widget/diffNavigator.ts
src/vs/editor/browser/widget/diffNavigator.ts
+2
-2
src/vs/editor/browser/widget/diffReview.ts
src/vs/editor/browser/widget/diffReview.ts
+1
-1
src/vs/editor/common/commonCodeEditor.ts
src/vs/editor/common/commonCodeEditor.ts
+61
-53
src/vs/editor/common/controller/coreCommands.ts
src/vs/editor/common/controller/coreCommands.ts
+15
-15
src/vs/editor/common/controller/cursor.ts
src/vs/editor/common/controller/cursor.ts
+10
-10
src/vs/editor/common/controller/cursorCommon.ts
src/vs/editor/common/controller/cursorCommon.ts
+3
-3
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+18
-13
src/vs/editor/common/view/viewEvents.ts
src/vs/editor/common/view/viewEvents.ts
+5
-1
src/vs/editor/common/viewModel/viewModelImpl.ts
src/vs/editor/common/viewModel/viewModelImpl.ts
+2
-1
src/vs/editor/contrib/codelens/browser/codelensController.ts
src/vs/editor/contrib/codelens/browser/codelensController.ts
+1
-1
src/vs/editor/contrib/contextmenu/browser/contextmenu.ts
src/vs/editor/contrib/contextmenu/browser/contextmenu.ts
+2
-2
src/vs/editor/contrib/dnd/browser/dnd.ts
src/vs/editor/contrib/dnd/browser/dnd.ts
+1
-1
src/vs/editor/contrib/find/common/findController.ts
src/vs/editor/contrib/find/common/findController.ts
+4
-4
src/vs/editor/contrib/find/common/findModel.ts
src/vs/editor/contrib/find/common/findModel.ts
+2
-2
src/vs/editor/contrib/folding/browser/folding.ts
src/vs/editor/contrib/folding/browser/folding.ts
+1
-1
src/vs/editor/contrib/goToDeclaration/browser/messageController.ts
...itor/contrib/goToDeclaration/browser/messageController.ts
+1
-1
src/vs/editor/contrib/gotoError/browser/gotoError.ts
src/vs/editor/contrib/gotoError/browser/gotoError.ts
+1
-1
src/vs/editor/contrib/multicursor/common/multicursor.ts
src/vs/editor/contrib/multicursor/common/multicursor.ts
+3
-3
src/vs/editor/contrib/quickFix/browser/quickFixWidget.ts
src/vs/editor/contrib/quickFix/browser/quickFixWidget.ts
+2
-1
src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts
...ditor/contrib/referenceSearch/browser/referencesWidget.ts
+2
-2
src/vs/editor/contrib/rename/browser/renameInputField.ts
src/vs/editor/contrib/rename/browser/renameInputField.ts
+2
-1
src/vs/editor/contrib/suggest/browser/suggestController.ts
src/vs/editor/contrib/suggest/browser/suggestController.ts
+2
-2
src/vs/editor/contrib/wordOperations/common/wordOperations.ts
...vs/editor/contrib/wordOperations/common/wordOperations.ts
+2
-2
src/vs/editor/contrib/zoneWidget/browser/zoneWidget.ts
src/vs/editor/contrib/zoneWidget/browser/zoneWidget.ts
+2
-1
src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts
...vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts
+1
-1
src/vs/editor/standalone/browser/quickOpen/gotoLine.ts
src/vs/editor/standalone/browser/quickOpen/gotoLine.ts
+2
-2
src/vs/editor/standalone/browser/quickOpen/quickOutline.ts
src/vs/editor/standalone/browser/quickOpen/quickOutline.ts
+3
-3
src/vs/editor/standalone/browser/simpleServices.ts
src/vs/editor/standalone/browser/simpleServices.ts
+2
-2
src/vs/editor/standalone/browser/standaloneEditor.ts
src/vs/editor/standalone/browser/standaloneEditor.ts
+13
-0
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+18
-13
src/vs/workbench/api/electron-browser/mainThreadEditor.ts
src/vs/workbench/api/electron-browser/mainThreadEditor.ts
+4
-4
src/vs/workbench/browser/parts/editor/textResourceEditor.ts
src/vs/workbench/browser/parts/editor/textResourceEditor.ts
+2
-1
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+5
-5
src/vs/workbench/parts/preferences/browser/keybindingWidgets.ts
.../workbench/parts/preferences/browser/keybindingWidgets.ts
+2
-1
src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts
...rkbench/parts/preferences/browser/preferencesRenderers.ts
+1
-1
src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts
src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts
+3
-3
src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts
...vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts
+3
-3
src/vs/workbench/parts/search/browser/replaceService.ts
src/vs/workbench/parts/search/browser/replaceService.ts
+2
-2
未找到文件。
src/vs/editor/browser/controller/textAreaHandler.ts
浏览文件 @
e070afce
...
...
@@ -18,7 +18,7 @@ import { HorizontalRange, RenderingContext, RestrictedRenderingContext } from 'v
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/fastDomNode
'
;
import
{
ViewController
}
from
'
vs/editor/browser/view/viewController
'
;
import
{
EndOfLinePreference
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EndOfLinePreference
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
PartFingerprints
,
PartFingerprint
,
ViewPart
}
from
'
vs/editor/browser/view/viewPart
'
;
import
{
Margin
}
from
'
vs/editor/browser/viewParts/margin/margin
'
;
...
...
@@ -216,7 +216,8 @@ export class TextAreaHandler extends ViewPart {
this
.
_context
.
privateViewEventBus
.
emit
(
new
viewEvents
.
ViewRevealRangeRequestEvent
(
new
Range
(
lineNumber
,
column
,
lineNumber
,
column
),
viewEvents
.
VerticalRevealType
.
Simple
,
true
true
,
ScrollType
.
Immediate
));
// Find range pixel position
...
...
src/vs/editor/browser/viewParts/lines/viewLines.ts
浏览文件 @
e070afce
...
...
@@ -18,6 +18,7 @@ import { IViewLines, HorizontalRange, LineVisibleRanges } from 'vs/editor/common
import
{
Viewport
}
from
'
vs/editor/common/viewModel/viewModel
'
;
import
{
ViewPart
,
PartFingerprint
,
PartFingerprints
}
from
'
vs/editor/browser/view/viewPart
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
class
LastRenderedData
{
...
...
@@ -43,13 +44,15 @@ class HorizontalRevealRequest {
public
readonly
endColumn
:
number
;
public
readonly
startScrollTop
:
number
;
public
readonly
stopScrollTop
:
number
;
public
readonly
scrollType
:
ScrollType
;
constructor
(
lineNumber
:
number
,
startColumn
:
number
,
endColumn
:
number
,
startScrollTop
:
number
,
stopScrollTop
:
number
)
{
constructor
(
lineNumber
:
number
,
startColumn
:
number
,
endColumn
:
number
,
startScrollTop
:
number
,
stopScrollTop
:
number
,
scrollType
:
ScrollType
)
{
this
.
lineNumber
=
lineNumber
;
this
.
startColumn
=
startColumn
;
this
.
endColumn
=
endColumn
;
this
.
startScrollTop
=
startScrollTop
;
this
.
stopScrollTop
=
stopScrollTop
;
this
.
scrollType
=
scrollType
;
}
}
...
...
@@ -230,13 +233,17 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
};
}
else
{
// We don't necessarily know the horizontal offset of this range since the line might not be in the view...
this
.
_horizontalRevealRequest
=
new
HorizontalRevealRequest
(
e
.
range
.
startLineNumber
,
e
.
range
.
startColumn
,
e
.
range
.
endColumn
,
this
.
_context
.
viewLayout
.
getCurrentScrollTop
(),
newScrollPosition
.
scrollTop
);
this
.
_horizontalRevealRequest
=
new
HorizontalRevealRequest
(
e
.
range
.
startLineNumber
,
e
.
range
.
startColumn
,
e
.
range
.
endColumn
,
this
.
_context
.
viewLayout
.
getCurrentScrollTop
(),
newScrollPosition
.
scrollTop
,
e
.
scrollType
);
}
}
else
{
this
.
_horizontalRevealRequest
=
null
;
}
this
.
_context
.
viewLayout
.
setScrollPositionSmooth
(
newScrollPosition
);
if
(
e
.
scrollType
===
ScrollType
.
Smooth
)
{
this
.
_context
.
viewLayout
.
setScrollPositionSmooth
(
newScrollPosition
);
}
else
{
this
.
_context
.
viewLayout
.
setScrollPositionNow
(
newScrollPosition
);
}
return
true
;
}
...
...
@@ -509,6 +516,7 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
const
revealLineNumber
=
this
.
_horizontalRevealRequest
.
lineNumber
;
const
revealStartColumn
=
this
.
_horizontalRevealRequest
.
startColumn
;
const
revealEndColumn
=
this
.
_horizontalRevealRequest
.
endColumn
;
const
scrollType
=
this
.
_horizontalRevealRequest
.
scrollType
;
// Check that we have the line that contains the horizontal range in the viewport
if
(
viewportData
.
startLineNumber
<=
revealLineNumber
&&
revealLineNumber
<=
viewportData
.
endLineNumber
)
{
...
...
@@ -528,9 +536,15 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
}
// set `scrollLeft`
this
.
_context
.
viewLayout
.
setScrollPositionSmooth
({
scrollLeft
:
newScrollLeft
.
scrollLeft
});
if
(
scrollType
===
ScrollType
.
Smooth
)
{
this
.
_context
.
viewLayout
.
setScrollPositionSmooth
({
scrollLeft
:
newScrollLeft
.
scrollLeft
});
}
else
{
this
.
_context
.
viewLayout
.
setScrollPositionNow
({
scrollLeft
:
newScrollLeft
.
scrollLeft
});
}
}
}
...
...
src/vs/editor/browser/viewParts/minimap/minimap.ts
浏览文件 @
e070afce
...
...
@@ -506,7 +506,8 @@ export class Minimap extends ViewPart {
this
.
_context
.
privateViewEventBus
.
emit
(
new
viewEvents
.
ViewRevealRangeRequestEvent
(
new
Range
(
lineNumber
,
1
,
lineNumber
,
1
),
viewEvents
.
VerticalRevealType
.
Center
,
false
false
,
editorCommon
.
ScrollType
.
Smooth
));
});
...
...
src/vs/editor/browser/widget/diffEditorWidget.ts
浏览文件 @
e070afce
...
...
@@ -625,32 +625,32 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
return
this
.
modifiedEditor
.
getPosition
();
}
public
setPosition
(
position
:
IPosition
,
reveal
?:
boolean
,
revealVerticalInCenter
?:
boolean
,
revealHorizontal
?:
boolean
):
void
{
this
.
modifiedEditor
.
setPosition
(
position
,
reveal
,
revealVerticalInCenter
,
revealHorizontal
);
public
setPosition
(
position
:
IPosition
):
void
{
this
.
modifiedEditor
.
setPosition
(
position
);
}
public
revealLine
(
lineNumber
:
number
):
void
{
this
.
modifiedEditor
.
revealLine
(
lineNumber
);
public
revealLine
(
lineNumber
:
number
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
modifiedEditor
.
revealLine
(
lineNumber
,
scrollType
);
}
public
revealLineInCenter
(
lineNumber
:
number
):
void
{
this
.
modifiedEditor
.
revealLineInCenter
(
lineNumber
);
public
revealLineInCenter
(
lineNumber
:
number
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
modifiedEditor
.
revealLineInCenter
(
lineNumber
,
scrollType
);
}
public
revealLineInCenterIfOutsideViewport
(
lineNumber
:
number
):
void
{
this
.
modifiedEditor
.
revealLineInCenterIfOutsideViewport
(
lineNumber
);
public
revealLineInCenterIfOutsideViewport
(
lineNumber
:
number
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
modifiedEditor
.
revealLineInCenterIfOutsideViewport
(
lineNumber
,
scrollType
);
}
public
revealPosition
(
position
:
IPosition
,
revealVerticalInCenter
:
boolean
=
false
,
revealHorizontal
:
boolean
=
false
):
void
{
this
.
modifiedEditor
.
revealPosition
(
position
,
revealVerticalInCenter
,
revealHorizontal
);
public
revealPosition
(
position
:
IPosition
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
modifiedEditor
.
revealPosition
(
position
,
scrollType
);
}
public
revealPositionInCenter
(
position
:
IPosition
):
void
{
this
.
modifiedEditor
.
revealPositionInCenter
(
position
);
public
revealPositionInCenter
(
position
:
IPosition
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
modifiedEditor
.
revealPositionInCenter
(
position
,
scrollType
);
}
public
revealPositionInCenterIfOutsideViewport
(
position
:
IPosition
):
void
{
this
.
modifiedEditor
.
revealPositionInCenterIfOutsideViewport
(
position
);
public
revealPositionInCenterIfOutsideViewport
(
position
:
IPosition
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
modifiedEditor
.
revealPositionInCenterIfOutsideViewport
(
position
,
scrollType
);
}
public
getSelection
():
Selection
{
...
...
@@ -661,44 +661,44 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
return
this
.
modifiedEditor
.
getSelections
();
}
public
setSelection
(
range
:
IRange
,
reveal
?:
boolean
,
revealVerticalInCenter
?:
boolean
,
revealHorizontal
?:
boolean
):
void
;
public
setSelection
(
editorRange
:
Range
,
reveal
?:
boolean
,
revealVerticalInCenter
?:
boolean
,
revealHorizontal
?:
boolean
):
void
;
public
setSelection
(
selection
:
ISelection
,
reveal
?:
boolean
,
revealVerticalInCenter
?:
boolean
,
revealHorizontal
?:
boolean
):
void
;
public
setSelection
(
editorSelection
:
Selection
,
reveal
?:
boolean
,
revealVerticalInCenter
?:
boolean
,
revealHorizontal
?:
boolean
):
void
;
public
setSelection
(
something
:
any
,
reveal
?:
boolean
,
revealVerticalInCenter
?:
boolean
,
revealHorizontal
?:
boolean
):
void
{
this
.
modifiedEditor
.
setSelection
(
something
,
reveal
,
revealVerticalInCenter
,
revealHorizontal
);
public
setSelection
(
range
:
IRange
):
void
;
public
setSelection
(
editorRange
:
Range
):
void
;
public
setSelection
(
selection
:
ISelection
):
void
;
public
setSelection
(
editorSelection
:
Selection
):
void
;
public
setSelection
(
something
:
any
):
void
{
this
.
modifiedEditor
.
setSelection
(
something
);
}
public
setSelections
(
ranges
:
ISelection
[]):
void
{
this
.
modifiedEditor
.
setSelections
(
ranges
);
}
public
revealLines
(
startLineNumber
:
number
,
endLineNumber
:
number
):
void
{
this
.
modifiedEditor
.
revealLines
(
startLineNumber
,
endLineNumber
);
public
revealLines
(
startLineNumber
:
number
,
endLineNumber
:
number
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
modifiedEditor
.
revealLines
(
startLineNumber
,
endLineNumber
,
scrollType
);
}
public
revealLinesInCenter
(
startLineNumber
:
number
,
endLineNumber
:
number
):
void
{
this
.
modifiedEditor
.
revealLinesInCenter
(
startLineNumber
,
endLineNumber
);
public
revealLinesInCenter
(
startLineNumber
:
number
,
endLineNumber
:
number
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
modifiedEditor
.
revealLinesInCenter
(
startLineNumber
,
endLineNumber
,
scrollType
);
}
public
revealLinesInCenterIfOutsideViewport
(
startLineNumber
:
number
,
endLineNumber
:
number
):
void
{
this
.
modifiedEditor
.
revealLinesInCenterIfOutsideViewport
(
startLineNumber
,
endLineNumber
);
public
revealLinesInCenterIfOutsideViewport
(
startLineNumber
:
number
,
endLineNumber
:
number
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
modifiedEditor
.
revealLinesInCenterIfOutsideViewport
(
startLineNumber
,
endLineNumber
,
scrollType
);
}
public
revealRange
(
range
:
IRange
,
revealVerticalInCenter
:
boolean
=
false
,
revealHorizontal
:
boolean
=
true
):
void
{
this
.
modifiedEditor
.
revealRange
(
range
,
revealVerticalInCenter
,
revealHorizontal
);
public
revealRange
(
range
:
IRange
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
,
revealVerticalInCenter
:
boolean
=
false
,
revealHorizontal
:
boolean
=
true
):
void
{
this
.
modifiedEditor
.
revealRange
(
range
,
scrollType
,
revealVerticalInCenter
,
revealHorizontal
);
}
public
revealRangeInCenter
(
range
:
IRange
):
void
{
this
.
modifiedEditor
.
revealRangeInCenter
(
range
);
public
revealRangeInCenter
(
range
:
IRange
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
modifiedEditor
.
revealRangeInCenter
(
range
,
scrollType
);
}
public
revealRangeInCenterIfOutsideViewport
(
range
:
IRange
):
void
{
this
.
modifiedEditor
.
revealRangeInCenterIfOutsideViewport
(
range
);
public
revealRangeInCenterIfOutsideViewport
(
range
:
IRange
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
modifiedEditor
.
revealRangeInCenterIfOutsideViewport
(
range
,
scrollType
);
}
public
revealRangeAtTop
(
range
:
IRange
):
void
{
this
.
modifiedEditor
.
revealRangeAtTop
(
range
);
public
revealRangeAtTop
(
range
:
IRange
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
modifiedEditor
.
revealRangeAtTop
(
range
,
scrollType
);
}
public
getActions
():
editorCommon
.
IEditorAction
[]
{
...
...
src/vs/editor/browser/widget/diffNavigator.ts
浏览文件 @
e070afce
...
...
@@ -8,7 +8,7 @@ import * as assert from 'vs/base/common/assert';
import
{
EventEmitter
}
from
'
vs/base/common/eventEmitter
'
;
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
ICommonDiffEditor
,
ILineChange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommonDiffEditor
,
ILineChange
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
ICursorPositionChangedEvent
}
from
'
vs/editor/common/controller/cursorEvents
'
;
...
...
@@ -197,7 +197,7 @@ export class DiffNavigator extends EventEmitter {
try
{
var
pos
=
info
.
range
.
getStartPosition
();
this
.
editor
.
setPosition
(
pos
);
this
.
editor
.
revealPositionInCenter
(
pos
);
this
.
editor
.
revealPositionInCenter
(
pos
,
ScrollType
.
Smooth
);
}
finally
{
this
.
ignoreSelectionChange
=
false
;
}
...
...
src/vs/editor/browser/widget/diffReview.ts
浏览文件 @
e070afce
...
...
@@ -259,7 +259,7 @@ export class DiffReview extends Disposable {
if
(
jumpToLineNumber
!==
-
1
)
{
this
.
_diffEditor
.
setPosition
(
new
Position
(
jumpToLineNumber
,
1
));
this
.
_diffEditor
.
revealPosition
(
new
Position
(
jumpToLineNumber
,
1
));
this
.
_diffEditor
.
revealPosition
(
new
Position
(
jumpToLineNumber
,
1
)
,
editorCommon
.
ScrollType
.
Immediate
);
}
}
...
...
src/vs/editor/common/commonCodeEditor.ts
浏览文件 @
e070afce
...
...
@@ -261,7 +261,7 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo
return
this
.
cursor
.
getPosition
().
clone
();
}
public
setPosition
(
position
:
IPosition
,
reveal
:
boolean
=
false
,
revealVerticalInCenter
:
boolean
=
false
,
revealHorizontal
:
boolean
=
false
):
void
{
public
setPosition
(
position
:
IPosition
):
void
{
if
(
!
this
.
cursor
)
{
return
;
}
...
...
@@ -274,12 +274,9 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo
positionLineNumber
:
position
.
lineNumber
,
positionColumn
:
position
.
column
}]);
if
(
reveal
)
{
this
.
revealPosition
(
position
,
revealVerticalInCenter
,
revealHorizontal
);
}
}
private
_sendRevealRange
(
modelRange
:
Range
,
verticalType
:
VerticalRevealType
,
revealHorizontal
:
boolean
):
void
{
private
_sendRevealRange
(
modelRange
:
Range
,
verticalType
:
VerticalRevealType
,
revealHorizontal
:
boolean
,
scrollType
:
editorCommon
.
ScrollType
):
void
{
if
(
!
this
.
model
||
!
this
.
cursor
)
{
return
;
}
...
...
@@ -289,22 +286,22 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo
const
validatedModelRange
=
this
.
model
.
validateRange
(
modelRange
);
const
viewRange
=
this
.
viewModel
.
coordinatesConverter
.
convertModelRangeToViewRange
(
validatedModelRange
);
this
.
cursor
.
emitCursorRevealRange
(
viewRange
,
verticalType
,
revealHorizontal
);
this
.
cursor
.
emitCursorRevealRange
(
viewRange
,
verticalType
,
revealHorizontal
,
scrollType
);
}
public
revealLine
(
lineNumber
:
number
):
void
{
this
.
_revealLine
(
lineNumber
,
VerticalRevealType
.
Simple
);
public
revealLine
(
lineNumber
:
number
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
_revealLine
(
lineNumber
,
VerticalRevealType
.
Simple
,
scrollType
);
}
public
revealLineInCenter
(
lineNumber
:
number
):
void
{
this
.
_revealLine
(
lineNumber
,
VerticalRevealType
.
Center
);
public
revealLineInCenter
(
lineNumber
:
number
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
_revealLine
(
lineNumber
,
VerticalRevealType
.
Center
,
scrollType
);
}
public
revealLineInCenterIfOutsideViewport
(
lineNumber
:
number
):
void
{
this
.
_revealLine
(
lineNumber
,
VerticalRevealType
.
CenterIfOutsideViewport
);
public
revealLineInCenterIfOutsideViewport
(
lineNumber
:
number
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
_revealLine
(
lineNumber
,
VerticalRevealType
.
CenterIfOutsideViewport
,
scrollType
);
}
private
_revealLine
(
lineNumber
:
number
,
revealType
:
VerticalRevealType
):
void
{
private
_revealLine
(
lineNumber
:
number
,
revealType
:
VerticalRevealType
,
scrollType
:
editorCommon
.
ScrollType
):
void
{
if
(
typeof
lineNumber
!==
'
number
'
)
{
throw
new
Error
(
'
Invalid arguments
'
);
}
...
...
@@ -312,35 +309,39 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo
this
.
_sendRevealRange
(
new
Range
(
lineNumber
,
1
,
lineNumber
,
1
),
revealType
,
false
false
,
scrollType
);
}
public
revealPosition
(
position
:
IPosition
,
revealVerticalInCenter
:
boolean
=
false
,
revealHorizontal
:
boolean
=
false
):
void
{
public
revealPosition
(
position
:
IPosition
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
_revealPosition
(
position
,
revealVerticalInCenter
?
VerticalRevealType
.
Center
:
VerticalRevealType
.
Simple
,
revealHorizontal
VerticalRevealType
.
Simple
,
true
,
scrollType
);
}
public
revealPositionInCenter
(
position
:
IPosition
):
void
{
public
revealPositionInCenter
(
position
:
IPosition
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
_revealPosition
(
position
,
VerticalRevealType
.
Center
,
true
true
,
scrollType
);
}
public
revealPositionInCenterIfOutsideViewport
(
position
:
IPosition
):
void
{
public
revealPositionInCenterIfOutsideViewport
(
position
:
IPosition
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
_revealPosition
(
position
,
VerticalRevealType
.
CenterIfOutsideViewport
,
true
true
,
scrollType
);
}
private
_revealPosition
(
position
:
IPosition
,
verticalType
:
VerticalRevealType
,
revealHorizontal
:
boolean
):
void
{
private
_revealPosition
(
position
:
IPosition
,
verticalType
:
VerticalRevealType
,
revealHorizontal
:
boolean
,
scrollType
:
editorCommon
.
ScrollType
):
void
{
if
(
!
Position
.
isIPosition
(
position
))
{
throw
new
Error
(
'
Invalid arguments
'
);
}
...
...
@@ -348,7 +349,8 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo
this
.
_sendRevealRange
(
new
Range
(
position
.
lineNumber
,
position
.
column
,
position
.
lineNumber
,
position
.
column
),
verticalType
,
revealHorizontal
revealHorizontal
,
scrollType
);
}
...
...
@@ -371,11 +373,11 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo
return
result
;
}
public
setSelection
(
range
:
IRange
,
reveal
?:
boolean
,
revealVerticalInCenter
?:
boolean
,
revealHorizontal
?:
boolean
):
void
;
public
setSelection
(
editorRange
:
Range
,
reveal
?:
boolean
,
revealVerticalInCenter
?:
boolean
,
revealHorizontal
?:
boolean
):
void
;
public
setSelection
(
selection
:
ISelection
,
reveal
?:
boolean
,
revealVerticalInCenter
?:
boolean
,
revealHorizontal
?:
boolean
):
void
;
public
setSelection
(
editorSelection
:
Selection
,
reveal
?:
boolean
,
revealVerticalInCenter
?:
boolean
,
revealHorizontal
?:
boolean
):
void
;
public
setSelection
(
something
:
any
,
reveal
:
boolean
=
false
,
revealVerticalInCenter
:
boolean
=
false
,
revealHorizontal
:
boolean
=
false
):
void
{
public
setSelection
(
range
:
IRange
):
void
;
public
setSelection
(
editorRange
:
Range
):
void
;
public
setSelection
(
selection
:
ISelection
):
void
;
public
setSelection
(
editorSelection
:
Selection
):
void
;
public
setSelection
(
something
:
any
):
void
{
let
isSelection
=
Selection
.
isISelection
(
something
);
let
isRange
=
Range
.
isIRange
(
something
);
...
...
@@ -384,7 +386,7 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo
}
if
(
isSelection
)
{
this
.
_setSelectionImpl
(
<
ISelection
>
something
,
reveal
,
revealVerticalInCenter
,
revealHorizontal
);
this
.
_setSelectionImpl
(
<
ISelection
>
something
);
}
else
if
(
isRange
)
{
// act as if it was an IRange
let
selection
:
ISelection
=
{
...
...
@@ -393,46 +395,46 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo
positionLineNumber
:
something
.
endLineNumber
,
positionColumn
:
something
.
endColumn
};
this
.
_setSelectionImpl
(
selection
,
reveal
,
revealVerticalInCenter
,
revealHorizontal
);
this
.
_setSelectionImpl
(
selection
);
}
}
private
_setSelectionImpl
(
sel
:
ISelection
,
reveal
:
boolean
,
revealVerticalInCenter
:
boolean
,
revealHorizontal
:
boolean
):
void
{
private
_setSelectionImpl
(
sel
:
ISelection
):
void
{
if
(
!
this
.
cursor
)
{
return
;
}
let
selection
=
new
Selection
(
sel
.
selectionStartLineNumber
,
sel
.
selectionStartColumn
,
sel
.
positionLineNumber
,
sel
.
positionColumn
);
this
.
cursor
.
setSelections
(
'
api
'
,
[
selection
]);
if
(
reveal
)
{
this
.
revealRange
(
selection
,
revealVerticalInCenter
,
revealHorizontal
);
}
}
public
revealLines
(
startLineNumber
:
number
,
endLineNumber
:
number
):
void
{
public
revealLines
(
startLineNumber
:
number
,
endLineNumber
:
number
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
_revealLines
(
startLineNumber
,
endLineNumber
,
VerticalRevealType
.
Simple
VerticalRevealType
.
Simple
,
scrollType
);
}
public
revealLinesInCenter
(
startLineNumber
:
number
,
endLineNumber
:
number
):
void
{
public
revealLinesInCenter
(
startLineNumber
:
number
,
endLineNumber
:
number
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
_revealLines
(
startLineNumber
,
endLineNumber
,
VerticalRevealType
.
Center
VerticalRevealType
.
Center
,
scrollType
);
}
public
revealLinesInCenterIfOutsideViewport
(
startLineNumber
:
number
,
endLineNumber
:
number
):
void
{
public
revealLinesInCenterIfOutsideViewport
(
startLineNumber
:
number
,
endLineNumber
:
number
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
_revealLines
(
startLineNumber
,
endLineNumber
,
VerticalRevealType
.
CenterIfOutsideViewport
VerticalRevealType
.
CenterIfOutsideViewport
,
scrollType
);
}
private
_revealLines
(
startLineNumber
:
number
,
endLineNumber
:
number
,
verticalType
:
VerticalRevealType
):
void
{
private
_revealLines
(
startLineNumber
:
number
,
endLineNumber
:
number
,
verticalType
:
VerticalRevealType
,
scrollType
:
editorCommon
.
ScrollType
):
void
{
if
(
typeof
startLineNumber
!==
'
number
'
||
typeof
endLineNumber
!==
'
number
'
)
{
throw
new
Error
(
'
Invalid arguments
'
);
}
...
...
@@ -440,43 +442,48 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo
this
.
_sendRevealRange
(
new
Range
(
startLineNumber
,
1
,
endLineNumber
,
1
),
verticalType
,
false
false
,
scrollType
);
}
public
revealRange
(
range
:
IRange
,
revealVerticalInCenter
:
boolean
=
false
,
revealHorizontal
:
boolean
=
true
):
void
{
public
revealRange
(
range
:
IRange
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
,
revealVerticalInCenter
:
boolean
=
false
,
revealHorizontal
:
boolean
=
true
):
void
{
this
.
_revealRange
(
range
,
revealVerticalInCenter
?
VerticalRevealType
.
Center
:
VerticalRevealType
.
Simple
,
revealHorizontal
false
?
VerticalRevealType
.
Center
:
VerticalRevealType
.
Simple
,
revealHorizontal
,
scrollType
);
}
public
revealRangeInCenter
(
range
:
IRange
):
void
{
public
revealRangeInCenter
(
range
:
IRange
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
_revealRange
(
range
,
VerticalRevealType
.
Center
,
true
true
,
scrollType
);
}
public
revealRangeInCenterIfOutsideViewport
(
range
:
IRange
):
void
{
public
revealRangeInCenterIfOutsideViewport
(
range
:
IRange
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
_revealRange
(
range
,
VerticalRevealType
.
CenterIfOutsideViewport
,
true
true
,
scrollType
);
}
public
revealRangeAtTop
(
range
:
IRange
):
void
{
public
revealRangeAtTop
(
range
:
IRange
,
scrollType
:
editorCommon
.
ScrollType
=
editorCommon
.
ScrollType
.
Smooth
):
void
{
this
.
_revealRange
(
range
,
VerticalRevealType
.
Top
,
true
true
,
scrollType
);
}
private
_revealRange
(
range
:
IRange
,
verticalType
:
VerticalRevealType
,
revealHorizontal
:
boolean
):
void
{
private
_revealRange
(
range
:
IRange
,
verticalType
:
VerticalRevealType
,
revealHorizontal
:
boolean
,
scrollType
:
editorCommon
.
ScrollType
):
void
{
if
(
!
Range
.
isIRange
(
range
))
{
throw
new
Error
(
'
Invalid arguments
'
);
}
...
...
@@ -484,7 +491,8 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo
this
.
_sendRevealRange
(
Range
.
lift
(
range
),
verticalType
,
revealHorizontal
revealHorizontal
,
scrollType
);
}
...
...
src/vs/editor/common/controller/coreCommands.ts
浏览文件 @
e070afce
...
...
@@ -256,7 +256,7 @@ export namespace CoreNavigationCommands {
CursorMoveCommands
.
moveTo
(
cursors
.
context
,
cursors
.
getPrimaryCursor
(),
this
.
_inSelectionMode
,
args
.
position
,
args
.
viewPosition
)
]
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
@@ -281,7 +281,7 @@ export namespace CoreNavigationCommands {
toViewLineNumber
:
result
.
toLineNumber
,
toViewVisualColumn
:
result
.
toVisualColumn
});
cursors
.
reveal
(
true
,
(
result
.
reversed
?
RevealTarget
.
TopMost
:
RevealTarget
.
BottomMost
));
cursors
.
reveal
(
true
,
(
result
.
reversed
?
RevealTarget
.
TopMost
:
RevealTarget
.
BottomMost
)
,
editorCommon
.
ScrollType
.
Smooth
);
}
protected
abstract
_getColumnSelectResult
(
context
:
CursorContext
,
primary
:
CursorState
,
prevColumnSelectData
:
IColumnSelectData
,
args
:
any
):
IColumnSelectResult
;
...
...
@@ -454,7 +454,7 @@ export namespace CoreNavigationCommands {
CursorMoveCommands
.
move
(
cursors
.
context
,
cursors
.
getAll
(),
args
)
)
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
@@ -803,7 +803,7 @@ export namespace CoreNavigationCommands {
CursorMoveCommands
.
moveToBeginningOfLine
(
cursors
.
context
,
cursors
.
getAll
(),
this
.
_inSelectionMode
)
)
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
@@ -855,7 +855,7 @@ export namespace CoreNavigationCommands {
this
.
_exec
(
cursors
.
context
,
cursors
.
getAll
())
)
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
private
_exec
(
context
:
CursorContext
,
cursors
:
CursorState
[]):
CursorState
[]
{
...
...
@@ -888,7 +888,7 @@ export namespace CoreNavigationCommands {
CursorMoveCommands
.
moveToEndOfLine
(
cursors
.
context
,
cursors
.
getAll
(),
this
.
_inSelectionMode
)
)
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
@@ -940,7 +940,7 @@ export namespace CoreNavigationCommands {
this
.
_exec
(
cursors
.
context
,
cursors
.
getAll
())
)
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
private
_exec
(
context
:
CursorContext
,
cursors
:
CursorState
[]):
CursorState
[]
{
...
...
@@ -974,7 +974,7 @@ export namespace CoreNavigationCommands {
CursorMoveCommands
.
moveToBeginningOfBuffer
(
cursors
.
context
,
cursors
.
getAll
(),
this
.
_inSelectionMode
)
)
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
@@ -1021,7 +1021,7 @@ export namespace CoreNavigationCommands {
CursorMoveCommands
.
moveToEndOfBuffer
(
cursors
.
context
,
cursors
.
getAll
(),
this
.
_inSelectionMode
)
)
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
@@ -1240,7 +1240,7 @@ export namespace CoreNavigationCommands {
CursorMoveCommands
.
word
(
cursors
.
context
,
cursors
.
getPrimaryCursor
(),
this
.
_inSelectionMode
,
args
.
position
)
]
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
@@ -1301,7 +1301,7 @@ export namespace CoreNavigationCommands {
CursorMoveCommands
.
line
(
cursors
.
context
,
cursors
.
getPrimaryCursor
(),
this
.
_inSelectionMode
,
args
.
position
,
args
.
viewPosition
)
]
);
cursors
.
reveal
(
false
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
false
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
@@ -1381,7 +1381,7 @@ export namespace CoreNavigationCommands {
CursorMoveCommands
.
expandLineSelection
(
cursors
.
context
,
cursors
.
getAll
())
)
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
});
...
...
@@ -1409,7 +1409,7 @@ export namespace CoreNavigationCommands {
CursorMoveCommands
.
cancelSelection
(
cursors
.
context
,
cursors
.
getPrimaryCursor
())
]
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
});
...
...
@@ -1436,7 +1436,7 @@ export namespace CoreNavigationCommands {
cursors
.
getPrimaryCursor
()
]
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
);
cursors
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Smooth
);
}
});
...
...
@@ -1484,7 +1484,7 @@ export namespace CoreNavigationCommands {
const
viewRange
=
cursors
.
context
.
convertModelRangeToViewRange
(
range
);
cursors
.
revealRange
(
false
,
viewRange
,
revealAt
);
cursors
.
revealRange
(
false
,
viewRange
,
revealAt
,
editorCommon
.
ScrollType
.
Smooth
);
}
});
...
...
src/vs/editor/common/controller/cursor.ts
浏览文件 @
e070afce
...
...
@@ -201,12 +201,12 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors {
this
.
_columnSelectData
=
columnSelectData
;
}
public
reveal
(
horizontal
:
boolean
,
target
:
RevealTarget
):
void
{
this
.
_revealRange
(
target
,
viewEvents
.
VerticalRevealType
.
Simple
,
horizontal
);
public
reveal
(
horizontal
:
boolean
,
target
:
RevealTarget
,
scrollType
:
editorCommon
.
ScrollType
):
void
{
this
.
_revealRange
(
target
,
viewEvents
.
VerticalRevealType
.
Simple
,
horizontal
,
scrollType
);
}
public
revealRange
(
revealHorizontal
:
boolean
,
viewRange
:
Range
,
verticalType
:
viewEvents
.
VerticalRevealType
)
{
this
.
emitCursorRevealRange
(
viewRange
,
verticalType
,
revealHorizontal
);
public
revealRange
(
revealHorizontal
:
boolean
,
viewRange
:
Range
,
verticalType
:
viewEvents
.
VerticalRevealType
,
scrollType
:
editorCommon
.
ScrollType
)
{
this
.
emitCursorRevealRange
(
viewRange
,
verticalType
,
revealHorizontal
,
scrollType
);
}
public
scrollTo
(
desiredScrollTop
:
number
):
void
{
...
...
@@ -277,7 +277,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors {
}
this
.
setStates
(
'
restoreState
'
,
CursorChangeReason
.
NotSet
,
CursorState
.
fromModelSelections
(
desiredSelections
));
this
.
reveal
(
true
,
RevealTarget
.
Primary
);
this
.
reveal
(
true
,
RevealTarget
.
Primary
,
editorCommon
.
ScrollType
.
Immediate
);
}
private
_onModelContentChanged
(
hadFlushEvent
:
boolean
):
void
{
...
...
@@ -399,7 +399,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors {
return
true
;
}
private
_revealRange
(
revealTarget
:
RevealTarget
,
verticalType
:
viewEvents
.
VerticalRevealType
,
revealHorizontal
:
boolean
):
void
{
private
_revealRange
(
revealTarget
:
RevealTarget
,
verticalType
:
viewEvents
.
VerticalRevealType
,
revealHorizontal
:
boolean
,
scrollType
:
editorCommon
.
ScrollType
):
void
{
const
viewPositions
=
this
.
_cursors
.
getViewPositions
();
let
viewPosition
=
viewPositions
[
0
];
...
...
@@ -424,11 +424,11 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors {
}
const
viewRange
=
new
Range
(
viewPosition
.
lineNumber
,
viewPosition
.
column
,
viewPosition
.
lineNumber
,
viewPosition
.
column
);
this
.
emitCursorRevealRange
(
viewRange
,
verticalType
,
revealHorizontal
);
this
.
emitCursorRevealRange
(
viewRange
,
verticalType
,
revealHorizontal
,
scrollType
);
}
public
emitCursorRevealRange
(
viewRange
:
Range
,
verticalType
:
viewEvents
.
VerticalRevealType
,
revealHorizontal
:
boolean
)
{
this
.
_emit
([
new
viewEvents
.
ViewRevealRangeRequestEvent
(
viewRange
,
verticalType
,
revealHorizontal
)]);
public
emitCursorRevealRange
(
viewRange
:
Range
,
verticalType
:
viewEvents
.
VerticalRevealType
,
revealHorizontal
:
boolean
,
scrollType
:
editorCommon
.
ScrollType
)
{
this
.
_emit
([
new
viewEvents
.
ViewRevealRangeRequestEvent
(
viewRange
,
verticalType
,
revealHorizontal
,
scrollType
)]);
}
// -----------------------------------------------------------------------------------------------------------
...
...
@@ -499,7 +499,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors {
this
.
_isHandling
=
false
;
if
(
this
.
_emitStateChangedIfNecessary
(
source
,
cursorChangeReason
,
oldState
))
{
this
.
_revealRange
(
RevealTarget
.
Primary
,
viewEvents
.
VerticalRevealType
.
Simple
,
true
);
this
.
_revealRange
(
RevealTarget
.
Primary
,
viewEvents
.
VerticalRevealType
.
Simple
,
true
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
src/vs/editor/common/controller/cursorCommon.ts
浏览文件 @
e070afce
...
...
@@ -7,7 +7,7 @@
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
ICommand
,
TextModelResolvedOptions
,
IConfiguration
,
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommand
,
TextModelResolvedOptions
,
IConfiguration
,
IModel
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
TextModel
}
from
'
vs/editor/common/model/textModel
'
;
import
{
Selection
,
ISelection
}
from
'
vs/editor/common/core/selection
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
...
...
@@ -41,8 +41,8 @@ export interface ICursors {
setColumnSelectData
(
columnSelectData
:
IColumnSelectData
):
void
;
setStates
(
source
:
string
,
reason
:
CursorChangeReason
,
states
:
CursorState
[]):
void
;
reveal
(
horizontal
:
boolean
,
target
:
RevealTarget
):
void
;
revealRange
(
revealHorizontal
:
boolean
,
viewRange
:
Range
,
verticalType
:
VerticalRevealType
):
void
;
reveal
(
horizontal
:
boolean
,
target
:
RevealTarget
,
scrollType
:
ScrollType
):
void
;
revealRange
(
revealHorizontal
:
boolean
,
viewRange
:
Range
,
verticalType
:
VerticalRevealType
,
scrollType
:
ScrollType
):
void
;
scrollTo
(
desiredScrollTop
:
number
):
void
;
}
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
e070afce
...
...
@@ -1380,6 +1380,11 @@ export interface IDiffEditorViewState {
*/
export
type
IEditorViewState
=
ICodeEditorViewState
|
IDiffEditorViewState
;
export
const
enum
ScrollType
{
Smooth
=
0
,
Immediate
=
1
,
}
/**
* An editor.
*/
...
...
@@ -1484,32 +1489,32 @@ export interface IEditor {
/**
* Scroll vertically as necessary and reveal a line.
*/
revealLine
(
lineNumber
:
number
):
void
;
revealLine
(
lineNumber
:
number
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically as necessary and reveal a line centered vertically.
*/
revealLineInCenter
(
lineNumber
:
number
):
void
;
revealLineInCenter
(
lineNumber
:
number
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport.
*/
revealLineInCenterIfOutsideViewport
(
lineNumber
:
number
):
void
;
revealLineInCenterIfOutsideViewport
(
lineNumber
:
number
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a position.
*/
revealPosition
(
position
:
IPosition
,
revealVerticalInCenter
?:
boolean
,
revealHorizontal
?:
boolean
):
void
;
revealPosition
(
position
:
IPosition
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a position centered vertically.
*/
revealPositionInCenter
(
position
:
IPosition
):
void
;
revealPositionInCenter
(
position
:
IPosition
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport.
*/
revealPositionInCenterIfOutsideViewport
(
position
:
IPosition
):
void
;
revealPositionInCenterIfOutsideViewport
(
position
:
IPosition
,
scrollType
?:
ScrollType
):
void
;
/**
* Returns the primary selection of the editor.
...
...
@@ -1551,37 +1556,37 @@ export interface IEditor {
/**
* Scroll vertically as necessary and reveal lines.
*/
revealLines
(
startLineNumber
:
number
,
endLineNumber
:
number
):
void
;
revealLines
(
startLineNumber
:
number
,
endLineNumber
:
number
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically as necessary and reveal lines centered vertically.
*/
revealLinesInCenter
(
lineNumber
:
number
,
endLineNumber
:
number
):
void
;
revealLinesInCenter
(
lineNumber
:
number
,
endLineNumber
:
number
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport.
*/
revealLinesInCenterIfOutsideViewport
(
lineNumber
:
number
,
endLineNumber
:
number
):
void
;
revealLinesInCenterIfOutsideViewport
(
lineNumber
:
number
,
endLineNumber
:
number
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a range.
*/
revealRange
(
range
:
IRange
):
void
;
revealRange
(
range
:
IRange
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a range centered vertically.
*/
revealRangeInCenter
(
range
:
IRange
):
void
;
revealRangeInCenter
(
range
:
IRange
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a range at the top of the viewport.
*/
revealRangeAtTop
(
range
:
IRange
):
void
;
revealRangeAtTop
(
range
:
IRange
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.
*/
revealRangeInCenterIfOutsideViewport
(
range
:
IRange
):
void
;
revealRangeInCenterIfOutsideViewport
(
range
:
IRange
,
scrollType
?:
ScrollType
):
void
;
/**
* Directly trigger a handler or an editor action.
...
...
src/vs/editor/common/view/viewEvents.ts
浏览文件 @
e070afce
...
...
@@ -10,6 +10,7 @@ import { ScrollEvent } from 'vs/base/common/scrollable';
import
{
IConfigurationChangedEvent
}
from
'
vs/editor/common/config/editorOptions
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
{
IDisposable
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
export
const
enum
ViewEventType
{
ViewConfigurationChanged
=
1
,
...
...
@@ -198,10 +199,13 @@ export class ViewRevealRangeRequestEvent {
*/
public
readonly
revealHorizontal
:
boolean
;
constructor
(
range
:
Range
,
verticalType
:
VerticalRevealType
,
revealHorizontal
:
boolean
)
{
public
readonly
scrollType
:
ScrollType
;
constructor
(
range
:
Range
,
verticalType
:
VerticalRevealType
,
revealHorizontal
:
boolean
,
scrollType
:
ScrollType
)
{
this
.
range
=
range
;
this
.
verticalType
=
verticalType
;
this
.
revealHorizontal
=
revealHorizontal
;
this
.
scrollType
=
scrollType
;
}
}
...
...
src/vs/editor/common/viewModel/viewModelImpl.ts
浏览文件 @
e070afce
...
...
@@ -149,7 +149,8 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
eventsCollector
.
emit
(
new
viewEvents
.
ViewRevealRangeRequestEvent
(
newCenteredViewRange
,
viewEvents
.
VerticalRevealType
.
Center
,
false
false
,
editorCommon
.
ScrollType
.
Immediate
));
}
}
...
...
src/vs/editor/contrib/codelens/browser/codelensController.ts
浏览文件 @
e070afce
...
...
@@ -254,7 +254,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
});
});
if
(
shouldRestoreCenteredRange
)
{
this
.
_editor
.
revealRangeInCenter
(
centeredRange
);
this
.
_editor
.
revealRangeInCenter
(
centeredRange
,
editorCommon
.
ScrollType
.
Immediate
);
}
}
...
...
src/vs/editor/contrib/contextmenu/browser/contextmenu.ts
浏览文件 @
e070afce
...
...
@@ -16,7 +16,7 @@ import { IContextMenuService, IContextViewService } from 'vs/platform/contextvie
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IMenuService
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
{
ICommonCodeEditor
,
IEditorContribution
,
IScrollEvent
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommonCodeEditor
,
IEditorContribution
,
IScrollEvent
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
editorAction
,
ServicesAccessor
,
EditorAction
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
ICodeEditor
,
IEditorMouseEvent
,
MouseTargetType
}
from
'
vs/editor/browser/editorBrowser
'
;
...
...
@@ -150,7 +150,7 @@ export class ContextMenuController implements IEditorContribution {
var
menuPosition
=
forcedPosition
;
if
(
!
menuPosition
)
{
// Ensure selection is visible
this
.
_editor
.
revealPosition
(
this
.
_editor
.
getPosition
());
this
.
_editor
.
revealPosition
(
this
.
_editor
.
getPosition
()
,
ScrollType
.
Immediate
);
this
.
_editor
.
render
();
var
cursorCoords
=
this
.
_editor
.
getScrolledVisiblePosition
(
this
.
_editor
.
getPosition
());
...
...
src/vs/editor/contrib/dnd/browser/dnd.ts
浏览文件 @
e070afce
...
...
@@ -176,7 +176,7 @@ export class DragAndDropController implements editorCommon.IEditorContribution {
this
.
_dndDecorationIds
=
changeAccessor
.
deltaDecorations
(
this
.
_dndDecorationIds
,
newDecorations
);
});
this
.
_editor
.
revealPosition
(
position
);
this
.
_editor
.
revealPosition
(
position
,
editorCommon
.
ScrollType
.
Immediate
);
}
private
_removeDecoration
():
void
{
...
...
src/vs/editor/contrib/find/common/findController.ts
浏览文件 @
e070afce
...
...
@@ -716,7 +716,7 @@ export class AddSelectionToNextFindMatchAction extends SelectNextFindMatchAction
}
editor
.
setSelections
(
allSelections
.
concat
(
nextMatch
));
editor
.
revealRangeInCenterIfOutsideViewport
(
nextMatch
);
editor
.
revealRangeInCenterIfOutsideViewport
(
nextMatch
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
@@ -741,7 +741,7 @@ export class AddSelectionToPreviousFindMatchAction extends SelectPreviousFindMat
let
allSelections
=
editor
.
getSelections
();
editor
.
setSelections
(
allSelections
.
concat
(
previousMatch
));
editor
.
revealRangeInCenterIfOutsideViewport
(
previousMatch
);
editor
.
revealRangeInCenterIfOutsideViewport
(
previousMatch
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
@@ -770,7 +770,7 @@ export class MoveSelectionToNextFindMatchAction extends SelectNextFindMatchActio
let
allSelections
=
editor
.
getSelections
();
editor
.
setSelections
(
allSelections
.
slice
(
0
,
allSelections
.
length
-
1
).
concat
(
nextMatch
));
editor
.
revealRangeInCenterIfOutsideViewport
(
nextMatch
);
editor
.
revealRangeInCenterIfOutsideViewport
(
nextMatch
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
@@ -795,7 +795,7 @@ export class MoveSelectionToPreviousFindMatchAction extends SelectPreviousFindMa
let
allSelections
=
editor
.
getSelections
();
editor
.
setSelections
(
allSelections
.
slice
(
0
,
allSelections
.
length
-
1
).
concat
(
previousMatch
));
editor
.
revealRangeInCenterIfOutsideViewport
(
previousMatch
);
editor
.
revealRangeInCenterIfOutsideViewport
(
previousMatch
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
src/vs/editor/contrib/find/common/findModel.ts
浏览文件 @
e070afce
...
...
@@ -193,7 +193,7 @@ export class FindModelBoundToEditorModel {
let
findScope
=
this
.
_decorations
.
getFindScope
();
if
(
findScope
)
{
// Reveal the selection so user is reminded that 'selection find' is on.
this
.
_editor
.
revealRangeInCenterIfOutsideViewport
(
findScope
);
this
.
_editor
.
revealRangeInCenterIfOutsideViewport
(
findScope
,
editorCommon
.
ScrollType
.
Smooth
);
}
return
true
;
}
...
...
@@ -209,7 +209,7 @@ export class FindModelBoundToEditorModel {
);
this
.
_editor
.
setSelection
(
match
);
this
.
_editor
.
revealRangeInCenterIfOutsideViewport
(
match
);
this
.
_editor
.
revealRangeInCenterIfOutsideViewport
(
match
,
editorCommon
.
ScrollType
.
Smooth
);
}
private
_moveToPrevMatch
(
before
:
Position
,
isRecursed
:
boolean
=
false
):
void
{
...
...
src/vs/editor/contrib/folding/browser/folding.ts
浏览文件 @
e070afce
...
...
@@ -400,7 +400,7 @@ export class FoldingController implements IFoldingController {
}
this
.
editor
.
setHiddenAreas
(
hiddenAreas
);
if
(
focusLine
)
{
this
.
editor
.
revealPositionInCenterIfOutsideViewport
({
lineNumber
:
focusLine
,
column
:
1
});
this
.
editor
.
revealPositionInCenterIfOutsideViewport
({
lineNumber
:
focusLine
,
column
:
1
}
,
editorCommon
.
ScrollType
.
Smooth
);
}
}
...
...
src/vs/editor/contrib/goToDeclaration/browser/messageController.ts
浏览文件 @
e070afce
...
...
@@ -133,7 +133,7 @@ class MessageWidget implements IContentWidget {
constructor
(
editor
:
ICodeEditor
,
{
lineNumber
,
column
}:
IPosition
,
text
:
string
)
{
this
.
_editor
=
editor
;
this
.
_editor
.
revealLinesInCenterIfOutsideViewport
(
lineNumber
,
lineNumber
);
this
.
_editor
.
revealLinesInCenterIfOutsideViewport
(
lineNumber
,
lineNumber
,
editorCommon
.
ScrollType
.
Smooth
);
this
.
_position
=
{
lineNumber
,
column
:
1
};
this
.
_domNode
=
document
.
createElement
(
'
div
'
);
...
...
src/vs/editor/contrib/gotoError/browser/gotoError.ts
浏览文件 @
e070afce
...
...
@@ -177,7 +177,7 @@ class MarkerModel {
this
.
withoutWatchingEditorPosition
(()
=>
{
const
pos
=
new
Position
(
this
.
_markers
[
this
.
_nextIdx
].
startLineNumber
,
this
.
_markers
[
this
.
_nextIdx
].
startColumn
);
this
.
_editor
.
setPosition
(
pos
);
this
.
_editor
.
revealPositionInCenter
(
pos
);
this
.
_editor
.
revealPositionInCenter
(
pos
,
editorCommon
.
ScrollType
.
Smooth
);
});
}
...
...
src/vs/editor/contrib/multicursor/common/multicursor.ts
浏览文件 @
e070afce
...
...
@@ -6,7 +6,7 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
KeyCode
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommonCodeEditor
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
editorAction
,
ServicesAccessor
,
EditorAction
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
...
...
@@ -50,7 +50,7 @@ export class InsertCursorAbove extends EditorAction {
CursorMoveCommands
.
addCursorUp
(
context
,
cursors
.
getAll
())
)
);
cursors
.
reveal
(
true
,
RevealTarget
.
TopMost
);
cursors
.
reveal
(
true
,
RevealTarget
.
TopMost
,
ScrollType
.
Smooth
);
}
}
...
...
@@ -90,7 +90,7 @@ export class InsertCursorBelow extends EditorAction {
CursorMoveCommands
.
addCursorDown
(
context
,
cursors
.
getAll
())
)
);
cursors
.
reveal
(
true
,
RevealTarget
.
BottomMost
);
cursors
.
reveal
(
true
,
RevealTarget
.
BottomMost
,
ScrollType
.
Smooth
);
}
}
...
...
src/vs/editor/contrib/quickFix/browser/quickFixWidget.ts
浏览文件 @
e070afce
...
...
@@ -15,6 +15,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
export
class
QuickFixContextMenu
{
...
...
@@ -63,7 +64,7 @@ export class QuickFixContextMenu {
private
_toCoords
(
position
:
Position
):
{
x
:
number
,
y
:
number
}
{
this
.
_editor
.
revealPosition
(
position
);
this
.
_editor
.
revealPosition
(
position
,
ScrollType
.
Immediate
);
this
.
_editor
.
render
();
// Translate to absolute editor position
...
...
src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts
浏览文件 @
e070afce
...
...
@@ -612,7 +612,7 @@ export class ReferenceWidget extends PeekViewWidget {
}
show
(
where
:
IRange
)
{
this
.
editor
.
revealRangeInCenterIfOutsideViewport
(
where
);
this
.
editor
.
revealRangeInCenterIfOutsideViewport
(
where
,
editorCommon
.
ScrollType
.
Smooth
);
super
.
show
(
where
,
this
.
layoutData
.
heightInLines
||
18
);
}
...
...
@@ -837,7 +837,7 @@ export class ReferenceWidget extends PeekViewWidget {
this
.
_preview
.
setModel
(
model
.
textEditorModel
);
var
sel
=
Range
.
lift
(
reference
.
range
).
collapseToStart
();
this
.
_preview
.
setSelection
(
sel
);
this
.
_preview
.
revealRangeInCenter
(
sel
);
this
.
_preview
.
revealRangeInCenter
(
sel
,
editorCommon
.
ScrollType
.
Smooth
);
}
else
{
this
.
_preview
.
setModel
(
this
.
_previewNotAvailableMessage
);
ref
.
dispose
();
...
...
src/vs/editor/contrib/rename/browser/renameInputField.ts
浏览文件 @
e070afce
...
...
@@ -15,6 +15,7 @@ import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentW
import
{
IThemeService
,
ITheme
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
inputBackground
,
inputBorder
,
inputForeground
,
widgetShadow
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
export
default
class
RenameInputField
implements
IContentWidget
,
IDisposable
{
...
...
@@ -181,7 +182,7 @@ export default class RenameInputField implements IContentWidget, IDisposable {
}
private
_show
():
void
{
this
.
_editor
.
revealLineInCenterIfOutsideViewport
(
this
.
_position
.
lineNumber
);
this
.
_editor
.
revealLineInCenterIfOutsideViewport
(
this
.
_position
.
lineNumber
,
ScrollType
.
Smooth
);
this
.
_visible
=
true
;
this
.
_editor
.
layoutContentWidget
(
this
);
...
...
src/vs/editor/contrib/suggest/browser/suggestController.ts
浏览文件 @
e070afce
...
...
@@ -13,7 +13,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ContextKeyExpr
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ICommonCodeEditor
,
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommonCodeEditor
,
IEditorContribution
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
editorAction
,
ServicesAccessor
,
EditorAction
,
EditorCommand
,
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
...
...
@@ -213,7 +213,7 @@ export class SuggestController implements IEditorContribution {
triggerSuggest
(
onlyFrom
?:
ISuggestSupport
[]):
void
{
this
.
_model
.
trigger
(
false
,
false
,
onlyFrom
);
this
.
_editor
.
revealLine
(
this
.
_editor
.
getPosition
().
lineNumber
);
this
.
_editor
.
revealLine
(
this
.
_editor
.
getPosition
().
lineNumber
,
ScrollType
.
Smooth
);
this
.
_editor
.
focus
();
}
...
...
src/vs/editor/contrib/wordOperations/common/wordOperations.ts
浏览文件 @
e070afce
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
{
KeyCode
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
ICommonCodeEditor
,
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommonCodeEditor
,
IModel
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
editorCommand
,
ServicesAccessor
,
EditorCommand
,
ICommandOptions
}
from
'
vs/editor/common/editorCommonExtensions
'
;
...
...
@@ -49,7 +49,7 @@ export abstract class MoveWordCommand extends EditorCommand {
editor
.
_getCursors
().
setStates
(
'
moveWordCommand
'
,
CursorChangeReason
.
NotSet
,
result
.
map
(
r
=>
CursorState
.
fromModelSelection
(
r
)));
if
(
result
.
length
===
1
)
{
const
pos
=
new
Position
(
result
[
0
].
positionLineNumber
,
result
[
0
].
positionColumn
);
editor
.
revealPosition
(
pos
,
false
,
true
);
editor
.
revealPosition
(
pos
,
ScrollType
.
Smooth
);
}
}
...
...
src/vs/editor/contrib/zoneWidget/browser/zoneWidget.ts
浏览文件 @
e070afce
...
...
@@ -18,6 +18,7 @@ import { EditorLayoutInfo } from 'vs/editor/common/config/editorOptions';
import
{
Position
,
IPosition
}
from
'
vs/editor/common/core/position
'
;
import
{
ModelDecorationOptions
}
from
'
vs/editor/common/model/textModelWithDecorations
'
;
import
{
IdGenerator
}
from
'
vs/base/common/idGenerator
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
export
interface
IOptions
{
showFrame
?:
boolean
;
...
...
@@ -396,7 +397,7 @@ export abstract class ZoneWidget extends Widget implements IHorizontalSashLayout
// Reveal the line above or below the zone widget, to get the zone widget in the viewport
const
revealLineNumber
=
Math
.
min
(
this
.
editor
.
getModel
().
getLineCount
(),
Math
.
max
(
1
,
where
.
endLineNumber
+
1
));
this
.
editor
.
revealLine
(
revealLineNumber
);
this
.
editor
.
revealLine
(
revealLineNumber
,
ScrollType
.
Smooth
);
}
protected
setCssClass
(
className
:
string
,
classToReplace
?:
string
):
void
{
...
...
src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts
浏览文件 @
e070afce
...
...
@@ -66,7 +66,7 @@ export class QuickOpenController implements editorCommon.IEditorContribution {
// Restore selection if canceled
if
(
canceled
&&
this
.
lastKnownEditorSelection
)
{
this
.
editor
.
setSelection
(
this
.
lastKnownEditorSelection
);
this
.
editor
.
revealRangeInCenterIfOutsideViewport
(
this
.
lastKnownEditorSelection
);
this
.
editor
.
revealRangeInCenterIfOutsideViewport
(
this
.
lastKnownEditorSelection
,
editorCommon
.
ScrollType
.
Smooth
);
}
this
.
lastKnownEditorSelection
=
null
;
...
...
src/vs/editor/standalone/browser/quickOpen/gotoLine.ts
浏览文件 @
e070afce
...
...
@@ -107,7 +107,7 @@ export class GotoLineEntry extends QuickOpenEntry {
// Apply selection and focus
let
range
=
this
.
toSelection
();
(
<
ICodeEditor
>
this
.
editor
).
setSelection
(
range
);
(
<
ICodeEditor
>
this
.
editor
).
revealRangeInCenter
(
range
);
(
<
ICodeEditor
>
this
.
editor
).
revealRangeInCenter
(
range
,
editorCommon
.
ScrollType
.
Smooth
);
this
.
editor
.
focus
();
return
true
;
...
...
@@ -123,7 +123,7 @@ export class GotoLineEntry extends QuickOpenEntry {
// Select Line Position
let
range
=
this
.
toSelection
();
this
.
editor
.
revealRangeInCenter
(
range
);
this
.
editor
.
revealRangeInCenter
(
range
,
editorCommon
.
ScrollType
.
Smooth
);
// Decorate if possible
this
.
decorator
.
decorateLine
(
range
,
this
.
editor
);
...
...
src/vs/editor/standalone/browser/quickOpen/quickOutline.ts
浏览文件 @
e070afce
...
...
@@ -13,7 +13,7 @@ import * as strings from 'vs/base/common/strings';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IContext
,
IHighlight
,
QuickOpenEntryGroup
,
QuickOpenModel
}
from
'
vs/base/parts/quickopen/browser/quickOpenModel
'
;
import
{
IAutoFocus
,
Mode
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommonCodeEditor
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
SymbolInformation
,
DocumentSymbolProviderRegistry
,
symbolKindToCssClass
,
IOutline
}
from
'
vs/editor/common/modes
'
;
import
{
BaseEditorQuickOpenAction
,
IDecorator
}
from
'
./editorQuickOpen
'
;
...
...
@@ -81,7 +81,7 @@ class SymbolEntry extends QuickOpenEntryGroup {
// Apply selection and focus
let
range
=
this
.
toSelection
();
this
.
editor
.
setSelection
(
range
);
this
.
editor
.
revealRangeInCenter
(
range
);
this
.
editor
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
this
.
editor
.
focus
();
return
true
;
...
...
@@ -91,7 +91,7 @@ class SymbolEntry extends QuickOpenEntryGroup {
// Select Outline Position
let
range
=
this
.
toSelection
();
this
.
editor
.
revealRangeInCenter
(
range
);
this
.
editor
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
// Decorate if possible
this
.
decorator
.
decorateLine
(
this
.
range
,
this
.
editor
);
...
...
src/vs/editor/standalone/browser/simpleServices.ts
浏览文件 @
e070afce
...
...
@@ -150,14 +150,14 @@ export class SimpleEditorService implements IEditorService {
if
(
selection
)
{
if
(
typeof
selection
.
endLineNumber
===
'
number
'
&&
typeof
selection
.
endColumn
===
'
number
'
)
{
editor
.
setSelection
(
selection
);
editor
.
revealRangeInCenter
(
selection
);
editor
.
revealRangeInCenter
(
selection
,
editorCommon
.
ScrollType
.
Immediate
);
}
else
{
let
pos
=
{
lineNumber
:
selection
.
startLineNumber
,
column
:
selection
.
startColumn
};
editor
.
setPosition
(
pos
);
editor
.
revealPositionInCenter
(
pos
);
editor
.
revealPositionInCenter
(
pos
,
editorCommon
.
ScrollType
.
Immediate
);
}
}
...
...
src/vs/editor/standalone/browser/standaloneEditor.ts
浏览文件 @
e070afce
...
...
@@ -326,6 +326,18 @@ export function setTheme(themeName: string): void {
StaticServices
.
standaloneThemeService
.
get
().
setTheme
(
themeName
);
}
/**
* @internal
* --------------------------------------------
* This is repeated here so it can be exported
* because TS inlines const enums
* --------------------------------------------
*/
enum
ScrollType
{
Smooth
=
0
,
Immediate
=
1
,
}
/**
* @internal
*/
...
...
@@ -371,6 +383,7 @@ export function createMonacoEditorAPI(): typeof monaco.editor {
ContentWidgetPositionPreference
:
ContentWidgetPositionPreference
,
OverlayWidgetPositionPreference
:
OverlayWidgetPositionPreference
,
RenderMinimap
:
editorOptions
.
RenderMinimap
,
ScrollType
:
<
any
>
ScrollType
,
// classes
InternalEditorOptions
:
<
any
>
editorOptions
.
InternalEditorOptions
,
...
...
src/vs/monaco.d.ts
浏览文件 @
e070afce
...
...
@@ -1972,6 +1972,11 @@ declare module monaco.editor {
*/
export
type
IEditorViewState
=
ICodeEditorViewState
|
IDiffEditorViewState
;
export
const
enum
ScrollType
{
Smooth
=
0
,
Immediate
=
1
,
}
/**
* An editor.
*/
...
...
@@ -2043,27 +2048,27 @@ declare module monaco.editor {
/**
* Scroll vertically as necessary and reveal a line.
*/
revealLine
(
lineNumber
:
number
):
void
;
revealLine
(
lineNumber
:
number
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically as necessary and reveal a line centered vertically.
*/
revealLineInCenter
(
lineNumber
:
number
):
void
;
revealLineInCenter
(
lineNumber
:
number
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport.
*/
revealLineInCenterIfOutsideViewport
(
lineNumber
:
number
):
void
;
revealLineInCenterIfOutsideViewport
(
lineNumber
:
number
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a position.
*/
revealPosition
(
position
:
IPosition
,
revealVerticalInCenter
?:
boolean
,
revealHorizontal
?:
boolean
):
void
;
revealPosition
(
position
:
IPosition
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a position centered vertically.
*/
revealPositionInCenter
(
position
:
IPosition
):
void
;
revealPositionInCenter
(
position
:
IPosition
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport.
*/
revealPositionInCenterIfOutsideViewport
(
position
:
IPosition
):
void
;
revealPositionInCenterIfOutsideViewport
(
position
:
IPosition
,
scrollType
?:
ScrollType
):
void
;
/**
* Returns the primary selection of the editor.
*/
...
...
@@ -2100,31 +2105,31 @@ declare module monaco.editor {
/**
* Scroll vertically as necessary and reveal lines.
*/
revealLines
(
startLineNumber
:
number
,
endLineNumber
:
number
):
void
;
revealLines
(
startLineNumber
:
number
,
endLineNumber
:
number
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically as necessary and reveal lines centered vertically.
*/
revealLinesInCenter
(
lineNumber
:
number
,
endLineNumber
:
number
):
void
;
revealLinesInCenter
(
lineNumber
:
number
,
endLineNumber
:
number
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport.
*/
revealLinesInCenterIfOutsideViewport
(
lineNumber
:
number
,
endLineNumber
:
number
):
void
;
revealLinesInCenterIfOutsideViewport
(
lineNumber
:
number
,
endLineNumber
:
number
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a range.
*/
revealRange
(
range
:
IRange
):
void
;
revealRange
(
range
:
IRange
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a range centered vertically.
*/
revealRangeInCenter
(
range
:
IRange
):
void
;
revealRangeInCenter
(
range
:
IRange
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a range at the top of the viewport.
*/
revealRangeAtTop
(
range
:
IRange
):
void
;
revealRangeAtTop
(
range
:
IRange
,
scrollType
?:
ScrollType
):
void
;
/**
* Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.
*/
revealRangeInCenterIfOutsideViewport
(
range
:
IRange
):
void
;
revealRangeInCenterIfOutsideViewport
(
range
:
IRange
,
scrollType
?:
ScrollType
):
void
;
/**
* Directly trigger a handler or an editor action.
* @param source The source of the call.
...
...
src/vs/workbench/api/electron-browser/mainThreadEditor.ts
浏览文件 @
e070afce
...
...
@@ -250,16 +250,16 @@ export class MainThreadTextEditor {
}
switch
(
revealType
)
{
case
TextEditorRevealType
.
Default
:
this
.
_codeEditor
.
revealRange
(
range
);
this
.
_codeEditor
.
revealRange
(
range
,
EditorCommon
.
ScrollType
.
Smooth
);
break
;
case
TextEditorRevealType
.
InCenter
:
this
.
_codeEditor
.
revealRangeInCenter
(
range
);
this
.
_codeEditor
.
revealRangeInCenter
(
range
,
EditorCommon
.
ScrollType
.
Smooth
);
break
;
case
TextEditorRevealType
.
InCenterIfOutsideViewport
:
this
.
_codeEditor
.
revealRangeInCenterIfOutsideViewport
(
range
);
this
.
_codeEditor
.
revealRangeInCenterIfOutsideViewport
(
range
,
EditorCommon
.
ScrollType
.
Smooth
);
break
;
case
TextEditorRevealType
.
AtTop
:
this
.
_codeEditor
.
revealRangeAtTop
(
range
);
this
.
_codeEditor
.
revealRangeAtTop
(
range
,
EditorCommon
.
ScrollType
.
Smooth
);
break
;
default
:
console
.
warn
(
`Unknown revealType:
${
revealType
}
`
);
...
...
src/vs/workbench/browser/parts/editor/textResourceEditor.ts
浏览文件 @
e070afce
...
...
@@ -23,6 +23,7 @@ import { IEditorGroupService } from 'vs/workbench/services/group/common/groupSer
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
once
}
from
'
vs/base/common/event
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
/**
* An editor implementation that is capable of showing the contents of resource inputs. Uses
...
...
@@ -150,7 +151,7 @@ export class TextResourceEditor extends BaseTextEditor {
if
(
model
)
{
const
lastLine
=
model
.
getLineCount
();
codeEditor
.
revealPosition
({
lineNumber
:
lastLine
,
column
:
model
.
getLineMaxColumn
(
lastLine
)
});
codeEditor
.
revealPosition
({
lineNumber
:
lastLine
,
column
:
model
.
getLineMaxColumn
(
lastLine
)
}
,
ScrollType
.
Smooth
);
}
}
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
e070afce
...
...
@@ -10,7 +10,7 @@ import * as objects from 'vs/base/common/objects';
import
types
=
require
(
'
vs/base/common/types
'
);
import
URI
from
'
vs/base/common/uri
'
;
import
{
IDisposable
,
dispose
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IEditor
,
IEditorViewState
,
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditor
,
IEditorViewState
,
IModel
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorInput
,
IEditorModel
,
IEditorOptions
,
ITextEditorOptions
,
IBaseResourceInput
,
Position
,
Verbosity
}
from
'
vs/platform/editor/common/editor
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
IInstantiationService
,
IConstructorSignature0
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -694,9 +694,9 @@ export class TextEditorOptions extends EditorOptions {
};
editor
.
setSelection
(
range
);
if
(
this
.
revealInCenterIfOutsideViewport
)
{
editor
.
revealRangeInCenterIfOutsideViewport
(
range
);
editor
.
revealRangeInCenterIfOutsideViewport
(
range
,
ScrollType
.
Immediate
);
}
else
{
editor
.
revealRangeInCenter
(
range
);
editor
.
revealRangeInCenter
(
range
,
ScrollType
.
Immediate
);
}
}
...
...
@@ -708,9 +708,9 @@ export class TextEditorOptions extends EditorOptions {
};
editor
.
setPosition
(
pos
);
if
(
this
.
revealInCenterIfOutsideViewport
)
{
editor
.
revealPositionInCenterIfOutsideViewport
(
pos
);
editor
.
revealPositionInCenterIfOutsideViewport
(
pos
,
ScrollType
.
Immediate
);
}
else
{
editor
.
revealPositionInCenter
(
pos
);
editor
.
revealPositionInCenter
(
pos
,
ScrollType
.
Immediate
);
}
}
...
...
src/vs/workbench/parts/preferences/browser/keybindingWidgets.ts
浏览文件 @
e070afce
...
...
@@ -24,6 +24,7 @@ import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition } from 'vs/editor/b
import
{
attachInputBoxStyler
,
attachStylerCallback
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
editorWidgetBackground
,
widgetShadow
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
class
KeybindingInputWidget
extends
Widget
{
...
...
@@ -289,7 +290,7 @@ export class DefineKeybindingOverlayWidget extends Disposable implements IOverla
}
public
start
():
TPromise
<
string
>
{
this
.
_editor
.
revealPositionInCenterIfOutsideViewport
(
this
.
_editor
.
getPosition
());
this
.
_editor
.
revealPositionInCenterIfOutsideViewport
(
this
.
_editor
.
getPosition
()
,
ScrollType
.
Smooth
);
const
layoutInfo
=
this
.
_editor
.
getLayoutInfo
();
this
.
_widget
.
layout
(
new
Dimension
(
layoutInfo
.
width
,
layoutInfo
.
height
));
return
this
.
_widget
.
define
();
...
...
src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts
浏览文件 @
e070afce
...
...
@@ -932,7 +932,7 @@ class SettingHighlighter extends Disposable {
resource
:
this
.
editor
.
getModel
().
uri
},
this
.
editor
);
this
.
editor
.
revealLinesInCenterIfOutsideViewport
(
setting
.
valueRange
.
startLineNumber
,
setting
.
valueRange
.
endLineNumber
-
1
);
this
.
editor
.
revealLinesInCenterIfOutsideViewport
(
setting
.
valueRange
.
startLineNumber
,
setting
.
valueRange
.
endLineNumber
-
1
,
editorCommon
.
ScrollType
.
Smooth
);
this
.
focusEventEmitter
.
fire
(
setting
);
}
...
...
src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts
浏览文件 @
e070afce
...
...
@@ -12,7 +12,7 @@ import { IEntryRunContext, Mode, IAutoFocus } from 'vs/base/parts/quickopen/comm
import
{
QuickOpenModel
}
from
'
vs/base/parts/quickopen/browser/quickOpenModel
'
;
import
{
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
QuickOpenHandler
,
EditorQuickOpenEntry
,
QuickOpenAction
}
from
'
vs/workbench/browser/quickopen
'
;
import
{
IEditor
,
IModelDecorationsChangeAccessor
,
OverviewRulerLane
,
IModelDeltaDecoration
,
IEditorViewState
,
ITextModel
,
IDiffEditorModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditor
,
IModelDecorationsChangeAccessor
,
OverviewRulerLane
,
IModelDeltaDecoration
,
IEditorViewState
,
ITextModel
,
IDiffEditorModel
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
Position
,
IEditorInput
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
...
...
@@ -119,7 +119,7 @@ class GotoLineEntry extends EditorQuickOpenEntry {
if
(
activeEditor
)
{
const
editor
=
<
IEditor
>
activeEditor
.
getControl
();
editor
.
setSelection
(
range
);
editor
.
revealRangeInCenter
(
range
);
editor
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
}
return
true
;
...
...
@@ -139,7 +139,7 @@ class GotoLineEntry extends EditorQuickOpenEntry {
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
)
{
const
editorControl
=
<
IEditor
>
activeEditor
.
getControl
();
editorControl
.
revealRangeInCenter
(
range
);
editorControl
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
// Decorate if possible
if
(
types
.
isFunction
(
editorControl
.
changeDecorations
))
{
...
...
src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts
浏览文件 @
e070afce
...
...
@@ -16,7 +16,7 @@ import { QuickOpenModel, IHighlight } from 'vs/base/parts/quickopen/browser/quic
import
{
QuickOpenHandler
,
EditorQuickOpenEntryGroup
,
QuickOpenAction
}
from
'
vs/workbench/browser/quickopen
'
;
import
filters
=
require
(
'
vs/base/common/filters
'
);
import
{
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
IEditor
,
IModelDecorationsChangeAccessor
,
OverviewRulerLane
,
IModelDeltaDecoration
,
IModel
,
ITokenizedModel
,
IDiffEditorModel
,
IEditorViewState
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditor
,
IModelDecorationsChangeAccessor
,
OverviewRulerLane
,
IModelDeltaDecoration
,
IModel
,
ITokenizedModel
,
IDiffEditorModel
,
IEditorViewState
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
{
Position
,
IEditorInput
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
...
...
@@ -323,7 +323,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
if
(
activeEditor
)
{
const
editor
=
<
IEditor
>
activeEditor
.
getControl
();
editor
.
setSelection
(
range
);
editor
.
revealRangeInCenter
(
range
);
editor
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
}
}
...
...
@@ -337,7 +337,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
)
{
const
editorControl
=
<
IEditor
>
activeEditor
.
getControl
();
editorControl
.
revealRangeInCenter
(
range
);
editorControl
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
// Decorate if possible
if
(
types
.
isFunction
(
editorControl
.
changeDecorations
))
{
...
...
src/vs/workbench/parts/search/browser/replaceService.ts
浏览文件 @
e070afce
...
...
@@ -21,7 +21,7 @@ import { IDiffEditor } from 'vs/editor/browser/editorBrowser';
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITextModelService
,
ITextModelContentProvider
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
...
...
@@ -153,7 +153,7 @@ export class ReplaceService implements IReplaceService {
this
.
updateReplacePreview
(
fileMatch
).
then
(()
=>
{
let
editorControl
=
(
<
IDiffEditor
>
editor
.
getControl
());
if
(
element
instanceof
Match
)
{
editorControl
.
revealLineInCenter
(
element
.
range
().
startLineNumber
);
editorControl
.
revealLineInCenter
(
element
.
range
().
startLineNumber
,
ScrollType
.
Immediate
);
}
});
},
errors
.
onUnexpectedError
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录