Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
cea54665
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,发现更多精彩内容 >>
提交
cea54665
编写于
7月 06, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
diff editor: do not auto reveal first change when selection or viewstate is provided
上级
3e34503a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
58 deletion
+14
-58
src/vs/platform/editor/common/editor.ts
src/vs/platform/editor/common/editor.ts
+0
-14
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
+10
-13
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+4
-31
未找到文件。
src/vs/platform/editor/common/editor.ts
浏览文件 @
cea54665
...
...
@@ -107,11 +107,6 @@ export interface IResourceDiffInput extends IBaseResourceInput {
* The right hand side URI to open inside a diff editor.
*/
rightResource
:
URI
;
/**
* Optional options to use when opening the text diff input.
*/
options
?:
ITextDiffEditorOptions
;
}
export
interface
IResourceSideBySideInput
extends
IBaseResourceInput
{
...
...
@@ -301,13 +296,4 @@ export interface ITextEditorOptions extends IEditorOptions {
* Option to scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.
*/
revealInCenterIfOutsideViewport
?:
boolean
;
}
export
interface
ITextDiffEditorOptions
extends
ITextEditorOptions
{
/**
* Whether to auto reveal the first change when the text editor is opened or not. By default
* the first change will not be revealed.
*/
autoRevealFirstChange
:
boolean
;
}
\ No newline at end of file
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
浏览文件 @
cea54665
...
...
@@ -16,7 +16,7 @@ import types = require('vs/base/common/types');
import
{
IDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IDiffEditorOptions
,
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
BaseTextEditor
,
IEditorConfiguration
}
from
'
vs/workbench/browser/parts/editor/textEditor
'
;
import
{
TextEditorOptions
,
TextDiffEditorOptions
,
EditorInput
,
EditorOptions
,
TEXT_DIFF_EDITOR_ID
,
IFileEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
TextEditorOptions
,
EditorInput
,
EditorOptions
,
TEXT_DIFF_EDITOR_ID
,
IFileEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
ResourceEditorInput
}
from
'
vs/workbench/common/editor/resourceEditorInput
'
;
import
{
DiffEditorInput
}
from
'
vs/workbench/common/editor/diffEditorInput
'
;
import
{
DiffNavigator
}
from
'
vs/editor/browser/widget/diffNavigator
'
;
...
...
@@ -151,26 +151,23 @@ export class TextDiffEditor extends BaseTextEditor {
const
diffEditor
=
<
IDiffEditor
>
this
.
getControl
();
diffEditor
.
setModel
((
<
TextDiffEditorModel
>
resolvedModel
).
textDiffEditorModel
);
// Respect text diff editor options
let
autoRevealFirstChange
=
true
;
if
(
options
instanceof
TextDiffEditorOptions
)
{
const
textDiffOptions
=
(
<
TextDiffEditorOptions
>
options
);
autoRevealFirstChange
=
!
types
.
isUndefinedOrNull
(
textDiffOptions
.
autoRevealFirstChange
)
?
textDiffOptions
.
autoRevealFirstChange
:
autoRevealFirstChange
;
// Handle TextOptions
let
alwaysRevealFirst
=
true
;
if
(
options
&&
types
.
isFunction
((
<
TextEditorOptions
>
options
).
apply
))
{
const
hadOptions
=
(
<
TextEditorOptions
>
options
).
apply
(
<
IDiffEditor
>
diffEditor
);
if
(
hadOptions
)
{
alwaysRevealFirst
=
false
;
// Do not reveal if we are instructed to open specific line/col
}
}
//
l
isten on diff updated changes to reveal the first change
//
L
isten on diff updated changes to reveal the first change
this
.
diffNavigator
=
new
DiffNavigator
(
diffEditor
,
{
alwaysRevealFirst
:
autoRevealFirstChange
alwaysRevealFirst
});
this
.
diffNavigator
.
addListener
(
DiffNavigator
.
Events
.
UPDATED
,
()
=>
{
this
.
nextDiffAction
.
updateEnablement
();
this
.
previousDiffAction
.
updateEnablement
();
});
// Handle TextOptions
if
(
options
&&
types
.
isFunction
((
<
TextEditorOptions
>
options
).
apply
))
{
(
<
TextEditorOptions
>
options
).
apply
(
<
IDiffEditor
>
diffEditor
);
}
},
error
=>
{
// In case we tried to open a file and the response indicates that this is not a text file, fallback to binary diff.
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
cea54665
...
...
@@ -11,7 +11,7 @@ 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
{
IEditorInput
,
IEditorModel
,
IEditorOptions
,
ITextEditorOptions
,
IBaseResourceInput
,
Position
,
Verbosity
,
ITextDiffEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
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
'
;
import
{
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -602,16 +602,9 @@ export class TextEditorOptions extends EditorOptions {
typeof
input
.
options
.
revealInCenterIfOutsideViewport
===
'
boolean
'
||
typeof
input
.
options
.
pinned
===
'
boolean
'
||
typeof
input
.
options
.
inactive
===
'
boolean
'
||
typeof
input
.
options
.
index
===
'
number
'
||
typeof
(
input
.
options
as
ITextDiffEditorOptions
).
autoRevealFirstChange
===
'
boolean
'
typeof
input
.
options
.
index
===
'
number
'
)
{
const
textDiffOptions
=
input
.
options
as
ITextDiffEditorOptions
;
if
(
typeof
textDiffOptions
.
autoRevealFirstChange
===
'
boolean
'
)
{
options
=
new
TextDiffEditorOptions
();
(
<
TextDiffEditorOptions
>
options
).
autoRevealFirstChange
=
textDiffOptions
.
autoRevealFirstChange
;
}
else
{
options
=
new
TextEditorOptions
();
}
options
=
new
TextEditorOptions
();
}
if
(
input
.
options
.
selection
)
{
...
...
@@ -662,15 +655,7 @@ export class TextEditorOptions extends EditorOptions {
* Helper to create TextEditorOptions inline.
*/
public
static
create
(
settings
:
ITextEditorOptions
=
Object
.
create
(
null
)):
TextEditorOptions
{
let
options
:
TextEditorOptions
;
const
textDiffOptions
=
settings
as
ITextDiffEditorOptions
;
if
(
typeof
textDiffOptions
.
autoRevealFirstChange
===
'
boolean
'
)
{
options
=
new
TextDiffEditorOptions
();
(
<
TextDiffEditorOptions
>
options
).
autoRevealFirstChange
=
textDiffOptions
.
autoRevealFirstChange
;
}
else
{
options
=
new
TextEditorOptions
();
}
const
options
=
new
TextEditorOptions
();
options
.
preserveFocus
=
settings
.
preserveFocus
;
options
.
forceOpen
=
settings
.
forceOpen
;
...
...
@@ -781,18 +766,6 @@ export class TextEditorOptions extends EditorOptions {
}
}
/**
* Base Text Diff Editor Options.
*/
export
class
TextDiffEditorOptions
extends
TextEditorOptions
{
/**
* Whether to auto reveal the first change when the text editor is opened or not. By default
* the first change will not be revealed.
*/
public
autoRevealFirstChange
:
boolean
;
}
export
interface
IStacksModelChangeEvent
{
group
:
IEditorGroup
;
editor
?:
IEditorInput
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录