Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0e0bc4d2
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0e0bc4d2
编写于
8月 10, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'eamodio-feature-git'
上级
38558282
2e35b736
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
61 addition
and
33 deletion
+61
-33
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+61
-33
未找到文件。
extensions/git/src/commands.ts
浏览文件 @
0e0bc4d2
...
...
@@ -156,7 +156,7 @@ export class CommandCenter {
await
this
.
_openResource
(
resource
);
}
private
async
_openResource
(
resource
:
Resource
):
Promise
<
void
>
{
private
async
_openResource
(
resource
:
Resource
,
preview
?:
boolean
):
Promise
<
void
>
{
const
left
=
this
.
getLeftResource
(
resource
);
const
right
=
this
.
getRightResource
(
resource
);
const
title
=
this
.
getTitle
(
resource
);
...
...
@@ -167,14 +167,10 @@ export class CommandCenter {
return
;
}
const
viewColumn
=
window
.
activeTextEditor
&&
window
.
activeTextEditor
.
viewColumn
||
ViewColumn
.
One
;
if
(
!
left
)
{
return
await
commands
.
executeCommand
<
void
>
(
'
vscode.open
'
,
right
,
viewColumn
);
}
const
opts
:
TextDocumentShowOptions
=
{
viewColumn
preserveFocus
:
true
,
preview
:
preview
,
viewColumn
:
window
.
activeTextEditor
&&
window
.
activeTextEditor
.
viewColumn
||
ViewColumn
.
One
};
const
activeTextEditor
=
window
.
activeTextEditor
;
...
...
@@ -183,6 +179,12 @@ export class CommandCenter {
opts
.
selection
=
activeTextEditor
.
selection
;
}
if
(
!
left
)
{
const
document
=
await
workspace
.
openTextDocument
(
right
);
await
window
.
showTextDocument
(
document
,
opts
);
return
;
}
return
await
commands
.
executeCommand
<
void
>
(
'
vscode.diff
'
,
left
,
right
,
title
,
opts
);
}
...
...
@@ -297,14 +299,14 @@ export class CommandCenter {
}
@
command
(
'
git.openFile
'
)
async
openFile
(
arg
?:
Resource
|
Uri
):
Promise
<
void
>
{
let
uri
:
Uri
|
undefined
;
async
openFile
(
arg
?:
Resource
|
Uri
,
...
resourceStates
:
SourceControlResourceState
[]
):
Promise
<
void
>
{
let
uri
s
:
Uri
[]
|
undefined
;
if
(
arg
instanceof
Uri
)
{
if
(
arg
.
scheme
===
'
git
'
)
{
uri
=
Uri
.
file
(
fromGitUri
(
arg
).
path
)
;
uri
s
=
[
Uri
.
file
(
fromGitUri
(
arg
).
path
)]
;
}
else
if
(
arg
.
scheme
===
'
file
'
)
{
uri
=
arg
;
uri
s
=
[
arg
]
;
}
}
else
{
let
resource
=
arg
;
...
...
@@ -315,23 +317,34 @@ export class CommandCenter {
}
if
(
resource
)
{
uri
=
resource
.
resourceUri
;
uri
s
=
[...
resourceStates
.
map
(
r
=>
r
.
resourceUri
),
resource
.
resourceUri
]
;
}
}
if
(
!
uri
)
{
if
(
!
uri
s
)
{
return
;
}
const
activeTextEditor
=
window
.
activeTextEditor
&&
window
.
activeTextEditor
;
const
isSameUri
=
activeTextEditor
&&
activeTextEditor
.
document
.
uri
.
toString
()
===
uri
.
toString
();
const
selections
=
activeTextEditor
&&
activeTextEditor
.
selections
;
const
viewColumn
=
activeTextEditor
&&
activeTextEditor
.
viewColumn
||
ViewColumn
.
One
;
await
commands
.
executeCommand
<
void
>
(
'
vscode.open
'
,
uri
,
viewColumn
);
if
(
isSameUri
&&
selections
&&
window
.
activeTextEditor
)
{
window
.
activeTextEditor
.
selections
=
selections
;
const
preview
=
uris
.
length
===
1
?
true
:
false
;
const
activeTextEditor
=
window
.
activeTextEditor
;
for
(
const
uri
of
uris
)
{
// If the active editor matches the current uri, get its selection
const
selections
=
activeTextEditor
&&
activeTextEditor
.
document
.
uri
.
toString
()
===
uri
.
toString
()
?
activeTextEditor
.
selections
:
undefined
;
const
opts
:
TextDocumentShowOptions
=
{
preserveFocus
:
true
,
preview
:
preview
,
viewColumn
:
activeTextEditor
&&
activeTextEditor
.
viewColumn
||
ViewColumn
.
One
};
const
document
=
await
workspace
.
openTextDocument
(
uri
);
await
window
.
showTextDocument
(
document
,
opts
);
if
(
selections
&&
window
.
activeTextEditor
)
{
window
.
activeTextEditor
.
selections
=
selections
;
}
}
}
...
...
@@ -362,22 +375,37 @@ export class CommandCenter {
}
@
command
(
'
git.openChange
'
)
async
openChange
(
arg
?:
Resource
|
Uri
):
Promise
<
void
>
{
let
resource
:
Resource
|
undefined
=
undefined
;
async
openChange
(
arg
?:
Resource
|
Uri
,
...
resourceStates
:
SourceControlResourceState
[]
):
Promise
<
void
>
{
let
resource
s
:
Resource
[]
|
undefined
=
undefined
;
if
(
arg
instanceof
Resource
)
{
resource
=
arg
;
}
else
if
(
arg
instanceof
Uri
)
{
resource
=
this
.
getSCMResource
(
arg
);
}
else
{
resource
=
this
.
getSCMResource
();
if
(
arg
instanceof
Uri
)
{
const
resource
=
this
.
getSCMResource
(
arg
);
if
(
resource
!==
undefined
)
{
resources
=
[
resource
];
}
}
else
{
let
resource
:
Resource
|
undefined
=
undefined
;
if
(
!
resource
)
{
if
(
arg
instanceof
Resource
)
{
resource
=
arg
;
}
else
{
resource
=
this
.
getSCMResource
();
}
if
(
resource
)
{
resources
=
[...
resourceStates
as
Resource
[],
resource
];
}
}
if
(
!
resources
)
{
return
;
}
return
await
this
.
_openResource
(
resource
);
const
preview
=
resources
.
length
===
1
?
undefined
:
false
;
for
(
const
resource
of
resources
)
{
await
this
.
_openResource
(
resource
,
preview
);
}
}
@
command
(
'
git.stage
'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录