Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e02d85d8
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,发现更多精彩内容 >>
提交
e02d85d8
编写于
6月 26, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Have the diff review pane follow the modified editor selection
上级
879a30a4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
23 deletion
+32
-23
src/vs/editor/browser/widget/diffEditorWidget.ts
src/vs/editor/browser/widget/diffEditorWidget.ts
+4
-4
src/vs/editor/browser/widget/diffReview.ts
src/vs/editor/browser/widget/diffReview.ts
+28
-19
未找到文件。
src/vs/editor/browser/widget/diffEditorWidget.ts
浏览文件 @
e02d85d8
...
...
@@ -260,10 +260,6 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this
.
_createLeftHandSide
();
this
.
_createRightHandSide
();
this
.
_reviewPane
=
new
DiffReview
(
this
);
this
.
_containerDomElement
.
appendChild
(
this
.
_reviewPane
.
domNode
.
domNode
);
this
.
_containerDomElement
.
appendChild
(
this
.
_reviewPane
.
shadow
.
domNode
);
this
.
_beginUpdateDecorationsTimeout
=
-
1
;
this
.
_currentlyChangingViewZones
=
false
;
this
.
_diffComputationToken
=
0
;
...
...
@@ -288,6 +284,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this
.
_createLeftHandSideEditor
(
options
,
scopedInstantiationService
);
this
.
_createRightHandSideEditor
(
options
,
scopedInstantiationService
);
this
.
_reviewPane
=
new
DiffReview
(
this
);
this
.
_containerDomElement
.
appendChild
(
this
.
_reviewPane
.
domNode
.
domNode
);
this
.
_containerDomElement
.
appendChild
(
this
.
_reviewPane
.
shadow
.
domNode
);
if
(
options
.
automaticLayout
)
{
this
.
_measureDomElementToken
=
window
.
setInterval
(()
=>
this
.
_measureDomElement
(
false
),
100
);
}
...
...
src/vs/editor/browser/widget/diffReview.ts
浏览文件 @
e02d85d8
...
...
@@ -72,6 +72,7 @@ export class DiffReview extends Disposable {
private
readonly
_content
:
FastDomNode
<
HTMLElement
>
;
private
readonly
scrollbar
:
DomScrollableElement
;
private
_diffs
:
Diff
[];
private
_currentDiff
:
Diff
;
constructor
(
diffEditor
:
DiffEditorWidget
)
{
super
();
...
...
@@ -95,6 +96,12 @@ export class DiffReview extends Disposable {
this
.
_diffs
=
this
.
_compute
();
this
.
_render
();
}));
this
.
_register
(
diffEditor
.
getModifiedEditor
().
onDidChangeCursorPosition
(()
=>
{
if
(
!
this
.
_isVisible
)
{
return
;
}
this
.
_render
();
}));
this
.
_register
(
dom
.
addStandardDisposableListener
(
this
.
domNode
.
domNode
,
'
click
'
,
(
e
)
=>
{
e
.
preventDefault
();
...
...
@@ -123,6 +130,7 @@ export class DiffReview extends Disposable {
}
}));
this
.
_diffs
=
[];
this
.
_currentDiff
=
null
;
}
private
_getPrevRow
():
HTMLElement
{
...
...
@@ -354,16 +362,6 @@ export class DiffReview extends Disposable {
return
r
;
}
private
_render
():
void
{
const
pos
=
this
.
_diffEditor
.
getPosition
();
if
(
!
pos
)
{
return
;
}
this
.
_doRender2
(
this
.
_findDiffIndex
(
pos
));
return
;
}
private
_findDiffIndex
(
pos
:
Position
):
number
{
const
lineNumber
=
pos
.
lineNumber
;
for
(
let
i
=
0
,
len
=
this
.
_diffs
.
length
;
i
<
len
;
i
++
)
{
...
...
@@ -376,21 +374,32 @@ export class DiffReview extends Disposable {
return
0
;
}
private
_doRender2
(
index
:
number
):
void
{
const
lines
=
this
.
_diffs
[
index
].
entries
;
const
originalModel
=
this
.
_diffEditor
.
getOriginalEditor
().
getModel
();
const
modifiedModel
=
this
.
_diffEditor
.
getModifiedEditor
().
getModel
();
this
.
_doRender3
(
lines
,
originalModel
,
modifiedModel
);
}
private
_render
():
void
{
private
_doRender3
(
diffs
:
DiffEntry
[],
originalModel
:
editorCommon
.
IModel
,
modifiedModel
:
editorCommon
.
IModel
):
void
{
const
originalOpts
=
this
.
_diffEditor
.
getOriginalEditor
().
getConfiguration
();
const
modifiedOpts
=
this
.
_diffEditor
.
getModifiedEditor
().
getConfiguration
();
const
originalModel
=
this
.
_diffEditor
.
getOriginalEditor
().
getModel
();
const
modifiedModel
=
this
.
_diffEditor
.
getModifiedEditor
().
getModel
();
const
originalModelOpts
=
originalModel
.
getOptions
();
const
modifiedModelOpts
=
modifiedModel
.
getOptions
();
if
(
!
originalModel
||
!
modifiedModel
)
{
dom
.
clearNode
(
this
.
_content
.
domNode
);
this
.
_currentDiff
=
null
;
return
;
}
const
pos
=
this
.
_diffEditor
.
getPosition
();
const
diffIndex
=
this
.
_findDiffIndex
(
pos
);
if
(
this
.
_diffs
[
diffIndex
]
===
this
.
_currentDiff
)
{
return
;
}
this
.
_currentDiff
=
this
.
_diffs
[
diffIndex
];
const
diffs
=
this
.
_diffs
[
diffIndex
].
entries
;
let
container
=
document
.
createElement
(
'
div
'
);
container
.
className
=
'
diff-review-table
'
;
container
.
setAttribute
(
'
role
'
,
'
list
'
);
...
...
@@ -424,7 +433,7 @@ export class DiffReview extends Disposable {
let
header
=
document
.
createElement
(
'
div
'
);
header
.
className
=
'
diff-review-row
'
;
// @@ -504,7 +517,7 @@
header
.
appendChild
(
document
.
createTextNode
(
`@@ -
${
minOriginalLine
}
,
${
maxOriginalLine
-
minOriginalLine
+
1
}
+
${
minModifiedLine
}
,
${
maxModifiedLine
-
minModifiedLine
+
1
}
@@`
));
header
.
appendChild
(
document
.
createTextNode
(
`
${
diffIndex
+
1
}
/
${
this
.
_diffs
.
length
}
:
@@ -
${
minOriginalLine
}
,
${
maxOriginalLine
-
minOriginalLine
+
1
}
+
${
minModifiedLine
}
,
${
maxModifiedLine
-
minModifiedLine
+
1
}
@@`
));
header
.
setAttribute
(
'
role
'
,
'
listitem
'
);
container
.
appendChild
(
header
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录