Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
ecf180ea
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
ecf180ea
编写于
6月 01, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
simplify diffEditorInput
上级
5ef42ec5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
19 addition
and
30 deletion
+19
-30
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
+4
-4
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+2
-10
src/vs/workbench/common/editor/editorStacksModel.ts
src/vs/workbench/common/editor/editorStacksModel.ts
+1
-1
src/vs/workbench/parts/files/browser/fileTracker.ts
src/vs/workbench/parts/files/browser/fileTracker.ts
+4
-5
src/vs/workbench/parts/git/browser/gitEditorInputs.ts
src/vs/workbench/parts/git/browser/gitEditorInputs.ts
+2
-2
src/vs/workbench/services/editor/browser/editorService.ts
src/vs/workbench/services/editor/browser/editorService.ts
+4
-6
src/vs/workbench/test/common/editor/editorInput.test.ts
src/vs/workbench/test/common/editor/editorInput.test.ts
+2
-2
未找到文件。
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
浏览文件 @
ecf180ea
...
...
@@ -93,12 +93,12 @@ export class TextDiffEditor extends BaseTextEditor {
if
(
input
&&
options
&&
activeDiffInput
)
{
// Input matches modified side of the diff editor: perform the action on modified side
if
(
input
.
matches
(
activeDiffInput
.
getModifiedInput
()
))
{
if
(
input
.
matches
(
activeDiffInput
.
modifiedInput
))
{
return
this
.
setInput
(
this
.
getInput
(),
options
).
then
(()
=>
true
);
}
// Input matches original side of the diff editor: perform the action on original side
else
if
(
input
.
matches
(
activeDiffInput
.
getOriginalInput
()
))
{
else
if
(
input
.
matches
(
activeDiffInput
.
originalInput
))
{
let
originalEditor
=
this
.
getControl
().
getOriginalEditor
();
if
(
options
instanceof
TextEditorOptions
)
{
(
<
TextEditorOptions
>
options
).
apply
(
originalEditor
);
...
...
@@ -213,8 +213,8 @@ export class TextDiffEditor extends BaseTextEditor {
let
options
:
IDiffEditorOptions
=
super
.
getCodeEditorOptions
();
let
input
=
this
.
input
;
if
(
input
&&
types
.
isFunction
((
<
DiffEditorInput
>
input
).
getModifiedInput
)
)
{
let
modifiedInput
=
(
<
DiffEditorInput
>
input
).
getModifiedInput
()
;
if
(
input
instanceof
DiffEditorInput
)
{
let
modifiedInput
=
input
.
modifiedInput
;
let
readOnly
=
modifiedInput
instanceof
StringEditorInput
||
modifiedInput
instanceof
ResourceEditorInput
;
options
.
readOnly
=
readOnly
;
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
ecf180ea
...
...
@@ -244,14 +244,6 @@ export abstract class BaseDiffEditorInput extends EditorInput {
return
this
.
_modifiedInput
;
}
public
getOriginalInput
():
EditorInput
{
return
this
.
originalInput
;
}
public
getModifiedInput
():
EditorInput
{
return
this
.
modifiedInput
;
}
public
isDirty
():
boolean
{
return
this
.
_modifiedInput
.
isDirty
();
}
...
...
@@ -568,8 +560,8 @@ export function asFileEditorInput(obj: any, supportDiff?: boolean): IFileEditorI
}
// Check for diff if we are asked to
if
(
supportDiff
&&
types
.
isFunction
((
<
BaseDiffEditorInput
>
obj
).
getModifiedInput
)
)
{
obj
=
(
<
BaseDiffEditorInput
>
obj
).
getModifiedInput
()
;
if
(
supportDiff
&&
obj
instanceof
BaseDiffEditorInput
)
{
obj
=
(
<
BaseDiffEditorInput
>
obj
).
modifiedInput
;
}
let
i
=
<
IFileEditorInput
>
obj
;
...
...
src/vs/workbench/common/editor/editorStacksModel.ts
浏览文件 @
ecf180ea
...
...
@@ -1140,7 +1140,7 @@ export class EditorStacksModel implements IEditorStacksModel {
// Also take care of diff editor inputs that wrap around 2 editors
if
(
editor
instanceof
DiffEditorInput
)
{
[
editor
.
getOriginalInput
(),
editor
.
getModifiedInput
()
].
forEach
(
editor
=>
{
[
editor
.
originalInput
,
editor
.
modifiedInput
].
forEach
(
editor
=>
{
if
(
!
this
.
isOpen
(
editor
))
{
editor
.
close
();
}
...
...
src/vs/workbench/parts/files/browser/fileTracker.ts
浏览文件 @
ecf180ea
...
...
@@ -248,7 +248,7 @@ export class FileTracker implements IWorkbenchContribution {
// Support diff editor input too
if
(
input
instanceof
DiffEditorInput
)
{
input
=
(
<
DiffEditorInput
>
input
).
getModifiedInput
()
;
input
=
(
<
DiffEditorInput
>
input
).
modifiedInput
;
}
return
input
instanceof
FileEditorInput
&&
(
<
FileEditorInput
>
input
).
getResource
().
toString
()
===
resource
.
toString
();
...
...
@@ -261,7 +261,7 @@ export class FileTracker implements IWorkbenchContribution {
let
group
=
stacks
.
groupAt
(
editor
.
position
);
let
input
=
editor
.
input
;
if
(
input
instanceof
DiffEditorInput
)
{
input
=
(
<
DiffEditorInput
>
input
).
getModifiedInput
()
;
input
=
(
<
DiffEditorInput
>
input
).
modifiedInput
;
}
let
inputResource
:
URI
;
...
...
@@ -322,15 +322,14 @@ export class FileTracker implements IWorkbenchContribution {
private
getMatchingFileEditorInputFromDiff
(
input
:
DiffEditorInput
,
arg
:
any
):
FileEditorInput
{
// First try modifiedInput
let
modifiedInput
=
input
.
getModifiedInput
()
;
let
modifiedInput
=
input
.
modifiedInput
;
let
res
=
this
.
getMatchingFileEditorInputFromInput
(
modifiedInput
,
arg
);
if
(
res
)
{
return
res
;
}
// Second try originalInput
let
originalInput
=
input
.
getOriginalInput
();
return
this
.
getMatchingFileEditorInputFromInput
(
originalInput
,
arg
);
return
this
.
getMatchingFileEditorInputFromInput
(
input
.
originalInput
,
arg
);
}
private
getMatchingFileEditorInputFromInput
(
input
:
EditorInput
,
deletedResource
:
URI
):
FileEditorInput
;
...
...
src/vs/workbench/parts/git/browser/gitEditorInputs.ts
浏览文件 @
ecf180ea
...
...
@@ -46,12 +46,12 @@ export class GitDiffEditorInput
return
true
;
}
var
originalInput
=
this
.
getOriginalInput
()
;
var
originalInput
=
this
.
originalInput
;
if
(
originalInput
&&
originalInput
.
matches
(
otherInput
))
{
return
true
;
}
var
modifiedInput
=
this
.
getModifiedInput
()
;
var
modifiedInput
=
this
.
modifiedInput
;
if
(
modifiedInput
&&
modifiedInput
.
matches
(
otherInput
))
{
return
true
;
}
...
...
src/vs/workbench/services/editor/browser/editorService.ts
浏览文件 @
ecf180ea
...
...
@@ -88,11 +88,9 @@ export class WorkbenchEditorService implements IWorkbenchEditorService {
return
true
;
}
if
(
includeDiff
)
{
if
(
includeDiff
&&
editor
.
input
instanceof
DiffEditorInput
)
{
let
diffInput
=
<
DiffEditorInput
>
editor
.
input
;
if
(
types
.
isFunction
(
diffInput
.
getOriginalInput
)
&&
types
.
isFunction
(
diffInput
.
getModifiedInput
))
{
return
input
.
matches
(
diffInput
.
getModifiedInput
())
||
input
.
matches
(
diffInput
.
getOriginalInput
());
}
return
input
.
matches
(
diffInput
.
modifiedInput
)
||
input
.
matches
(
diffInput
.
originalInput
);
}
return
false
;
...
...
@@ -270,12 +268,12 @@ export class WorkbenchEditorService implements IWorkbenchEditorService {
let
originalModel
=
this
.
findModel
(
diffCodeEditor
.
getOriginalEditor
(),
input
);
if
(
originalModel
)
{
return
TPromise
.
as
(
diffInput
.
getOriginalInput
()
);
return
TPromise
.
as
(
diffInput
.
originalInput
);
}
let
modifiedModel
=
this
.
findModel
(
diffCodeEditor
.
getModifiedEditor
(),
input
);
if
(
modifiedModel
)
{
return
TPromise
.
as
(
diffInput
.
getModifiedInput
()
);
return
TPromise
.
as
(
diffInput
.
modifiedInput
);
}
}
}
...
...
src/vs/workbench/test/common/editor/editorInput.test.ts
浏览文件 @
ecf180ea
...
...
@@ -60,8 +60,8 @@ suite('Workbench - EditorInput', () => {
let
diffInput
=
new
DiffEditorInput
(
'
name
'
,
'
description
'
,
input
,
otherInput
);
assert
.
equal
(
diffInput
.
getOriginalInput
()
,
input
);
assert
.
equal
(
diffInput
.
getModifiedInput
()
,
otherInput
);
assert
.
equal
(
diffInput
.
originalInput
,
input
);
assert
.
equal
(
diffInput
.
modifiedInput
,
otherInput
);
assert
(
diffInput
.
matches
(
diffInput
));
assert
(
!
diffInput
.
matches
(
otherInput
));
assert
(
!
diffInput
.
matches
(
null
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录