Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d16e5642
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,发现更多精彩内容 >>
提交
d16e5642
编写于
5月 30, 2016
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
introduce IEditorContext
fixes #6685
上级
9c6c0bfe
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
20 deletion
+26
-20
src/vs/workbench/browser/parts/editor/editorActions.ts
src/vs/workbench/browser/parts/editor/editorActions.ts
+21
-17
src/vs/workbench/parts/markdown/browser/markdownActions.ts
src/vs/workbench/parts/markdown/browser/markdownActions.ts
+5
-3
未找到文件。
src/vs/workbench/browser/parts/editor/editorActions.ts
浏览文件 @
d16e5642
...
...
@@ -404,8 +404,8 @@ export class CloseEditorAction extends Action {
super
(
id
,
label
,
'
close-editor-action
'
);
}
public
run
(
editorIdentifier
:
IEditorIdentifier
):
TPromise
<
any
>
{
let
position
=
editorIdentifier
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
editorIdentifier
.
group
)
:
null
;
public
run
(
context
:
IEditorContext
):
TPromise
<
any
>
{
let
position
=
context
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
context
.
group
)
:
null
;
// Close Active Editor
if
(
typeof
position
!==
'
number
'
)
{
...
...
@@ -415,7 +415,7 @@ export class CloseEditorAction extends Action {
}
}
let
input
=
editorIdentifier
?
editorIdentifier
.
editor
:
null
;
let
input
=
context
?
context
.
editor
:
null
;
if
(
!
input
)
{
// Get Top Editor at Position
...
...
@@ -442,8 +442,8 @@ export class CloseEditorsInGroupAction extends Action {
super
(
id
,
label
);
}
public
run
(
editorIdentifier
:
IEditorIdentifier
):
TPromise
<
any
>
{
let
position
=
editorIdentifier
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
editorIdentifier
.
group
)
:
null
;
public
run
(
context
:
IEditorContext
):
TPromise
<
any
>
{
let
position
=
context
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
context
.
group
)
:
null
;
if
(
typeof
position
!==
'
number
'
)
{
let
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
)
{
...
...
@@ -520,8 +520,8 @@ export class CloseEditorsInOtherGroupsAction extends Action {
super
(
id
,
label
);
}
public
run
(
editorIdentifier
:
IEditorIdentifier
):
TPromise
<
any
>
{
let
position
=
editorIdentifier
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
editorIdentifier
.
group
)
:
null
;
public
run
(
context
:
IEditorContext
):
TPromise
<
any
>
{
let
position
=
context
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
context
.
group
)
:
null
;
if
(
typeof
position
!==
'
number
'
)
{
let
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
)
{
...
...
@@ -546,9 +546,9 @@ export class CloseOtherEditorsInGroupAction extends Action {
super
(
id
,
label
);
}
public
run
(
editorIdentifier
:
IEditorIdentifier
):
TPromise
<
any
>
{
let
position
=
editorIdentifier
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
editorIdentifier
.
group
)
:
null
;
let
input
=
editorIdentifier
?
editorIdentifier
.
editor
:
null
;
public
run
(
context
:
IEditorContext
):
TPromise
<
any
>
{
let
position
=
context
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
context
.
group
)
:
null
;
let
input
=
context
?
context
.
editor
:
null
;
// If position or input are not passed in take the position and input of the active editor.
const
active
=
this
.
editorService
.
getActiveEditor
();
...
...
@@ -574,8 +574,8 @@ export class CloseAllEditorsInGroupAction extends Action {
super
(
id
,
label
,
'
action-close-all-files
'
);
}
public
run
(
editorIdentifier
:
IEditorIdentifier
):
TPromise
<
any
>
{
let
position
=
editorIdentifier
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
editorIdentifier
.
group
)
:
null
;
public
run
(
context
:
IEditorContext
):
TPromise
<
any
>
{
let
position
=
context
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
context
.
group
)
:
null
;
if
(
typeof
position
!==
'
number
'
)
{
let
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
)
{
...
...
@@ -598,8 +598,8 @@ export class MoveGroupLeftAction extends Action {
super
(
id
,
label
);
}
public
run
(
editorIdentifier
:
IEditorIdentifier
):
TPromise
<
any
>
{
let
position
=
editorIdentifier
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
editorIdentifier
.
group
)
:
null
;
public
run
(
context
:
IEditorContext
):
TPromise
<
any
>
{
let
position
=
context
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
context
.
group
)
:
null
;
if
(
typeof
position
!==
'
number
'
)
{
let
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
&&
(
activeEditor
.
position
===
Position
.
CENTER
||
activeEditor
.
position
===
Position
.
RIGHT
))
{
...
...
@@ -627,8 +627,8 @@ export class MoveGroupRightAction extends Action {
super
(
id
,
label
);
}
public
run
(
editorIdentifier
:
IEditorIdentifier
):
TPromise
<
any
>
{
let
position
=
editorIdentifier
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
editorIdentifier
.
group
)
:
null
;
public
run
(
context
:
IEditorContext
):
TPromise
<
any
>
{
let
position
=
context
?
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
context
.
group
)
:
null
;
if
(
typeof
position
!==
'
number
'
)
{
let
activeEditor
=
this
.
editorService
.
getActiveEditor
();
let
editors
=
this
.
editorService
.
getVisibleEditors
();
...
...
@@ -1097,4 +1097,8 @@ export class QuickOpenNavigatePreviousAction extends BaseQuickOpenNavigateAction
interface
IEditorPickOpenEntry
extends
IPickOpenEntry
{
identifier
:
IEditorIdentifier
;
}
\ No newline at end of file
}
export
interface
IEditorContext
extends
IEditorIdentifier
{
event
:
any
;
}
src/vs/workbench/parts/markdown/browser/markdownActions.ts
浏览文件 @
d16e5642
...
...
@@ -18,6 +18,7 @@ import {MarkdownEditorInput} from 'vs/workbench/parts/markdown/common/markdownEd
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
IEditorContext
}
from
'
vs/workbench/browser/parts/editor/editorActions
'
;
export
class
GlobalTogglePreviewMarkdownAction
extends
Action
{
...
...
@@ -81,7 +82,7 @@ export class OpenPreviewToSideAction extends Action {
super
(
id
,
label
);
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
public
run
(
context
?:
IEditorContext
):
TPromise
<
any
>
{
let
activeInput
=
this
.
editorService
.
getActiveEditorInput
();
// Do nothing if already in markdown preview
...
...
@@ -125,7 +126,7 @@ export class PreviewMarkdownAction extends Action {
this
.
markdownResource
=
markdownResource
;
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
public
run
(
context
?:
IEditorContext
):
TPromise
<
any
>
{
let
input
=
this
.
instantiationService
.
createInstance
(
MarkdownEditorInput
,
this
.
markdownResource
,
void
0
,
void
0
);
return
this
.
editorService
.
openEditor
(
input
);
...
...
@@ -144,8 +145,9 @@ export class PreviewMarkdownEditorInputAction extends EditorInputAction {
this
.
order
=
100
;
// far end
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
public
run
(
context
:
IEditorContext
):
TPromise
<
any
>
{
let
input
=
<
FileEditorInput
>
this
.
input
;
const
event
=
context
?
context
.
event
:
null
;
let
sideBySide
=
!!
(
event
&&
(
event
.
ctrlKey
||
event
.
metaKey
));
let
markdownInput
=
this
.
instantiationService
.
createInstance
(
MarkdownEditorInput
,
input
.
getResource
(),
void
0
,
void
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录