Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f82aaac1
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,发现更多精彩内容 >>
提交
f82aaac1
编写于
7月 03, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow pickers to provide an action to show in the pick list (fixes #29716)
上级
648bcfb4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
2 deletion
+34
-2
src/vs/platform/quickOpen/common/quickOpen.ts
src/vs/platform/quickOpen/common/quickOpen.ts
+2
-0
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
.../workbench/browser/parts/quickopen/quickOpenController.ts
+32
-2
未找到文件。
src/vs/platform/quickOpen/common/quickOpen.ts
浏览文件 @
f82aaac1
...
@@ -10,6 +10,7 @@ import Event from 'vs/base/common/event';
...
@@ -10,6 +10,7 @@ import Event from 'vs/base/common/event';
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
IQuickNavigateConfiguration
,
IAutoFocus
,
IEntryRunContext
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
IQuickNavigateConfiguration
,
IAutoFocus
,
IEntryRunContext
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IAction
}
from
"
vs/base/common/actions
"
;
export
interface
IFilePickOpenEntry
extends
IPickOpenEntry
{
export
interface
IFilePickOpenEntry
extends
IPickOpenEntry
{
resource
:
uri
;
resource
:
uri
;
...
@@ -24,6 +25,7 @@ export interface IPickOpenEntry {
...
@@ -24,6 +25,7 @@ export interface IPickOpenEntry {
separator
?:
ISeparator
;
separator
?:
ISeparator
;
alwaysShow
?:
boolean
;
alwaysShow
?:
boolean
;
run
?:
(
context
:
IEntryRunContext
)
=>
void
;
run
?:
(
context
:
IEntryRunContext
)
=>
void
;
action
?:
IAction
;
}
}
export
interface
ISeparator
{
export
interface
ISeparator
{
...
...
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
浏览文件 @
f82aaac1
...
@@ -16,7 +16,7 @@ import DOM = require('vs/base/browser/dom');
...
@@ -16,7 +16,7 @@ import DOM = require('vs/base/browser/dom');
import
URI
from
'
vs/base/common/uri
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
defaultGenerator
}
from
'
vs/base/common/idGenerator
'
;
import
{
defaultGenerator
}
from
'
vs/base/common/idGenerator
'
;
import
types
=
require
(
'
vs/base/common/types
'
);
import
types
=
require
(
'
vs/base/common/types
'
);
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
Action
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
IIconLabelOptions
}
from
'
vs/base/browser/ui/iconLabel/iconLabel
'
;
import
{
IIconLabelOptions
}
from
'
vs/base/browser/ui/iconLabel/iconLabel
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
Mode
,
IEntryRunContext
,
IAutoFocus
,
IQuickNavigateConfiguration
,
IModel
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
Mode
,
IEntryRunContext
,
IAutoFocus
,
IQuickNavigateConfiguration
,
IModel
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
...
@@ -52,6 +52,8 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
...
@@ -52,6 +52,8 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import
{
SIDE_BAR_BACKGROUND
,
SIDE_BAR_FOREGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
SIDE_BAR_BACKGROUND
,
SIDE_BAR_FOREGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
attachQuickOpenStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
attachQuickOpenStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
ITree
,
IActionProvider
}
from
"
vs/base/parts/tree/browser/tree
"
;
import
{
BaseActionItem
}
from
"
vs/base/browser/ui/actionbar/actionbar
"
;
const
HELP_PREFIX
=
'
?
'
;
const
HELP_PREFIX
=
'
?
'
;
...
@@ -354,7 +356,7 @@ export class QuickOpenController extends Component implements IQuickOpenService
...
@@ -354,7 +356,7 @@ export class QuickOpenController extends Component implements IQuickOpenService
this
.
pickOpenWidget
.
getProgressBar
().
stop
().
getContainer
().
hide
();
this
.
pickOpenWidget
.
getProgressBar
().
stop
().
getContainer
().
hide
();
// Model
// Model
const
model
=
new
QuickOpenModel
();
const
model
=
new
QuickOpenModel
(
[],
new
PickOpenActionProvider
()
);
const
entries
=
picks
.
map
((
e
,
index
)
=>
this
.
instantiationService
.
createInstance
(
PickOpenEntry
,
e
,
index
,
()
=>
progress
(
e
)));
const
entries
=
picks
.
map
((
e
,
index
)
=>
this
.
instantiationService
.
createInstance
(
PickOpenEntry
,
e
,
index
,
()
=>
progress
(
e
)));
if
(
picks
.
length
===
0
)
{
if
(
picks
.
length
===
0
)
{
entries
.
push
(
this
.
instantiationService
.
createInstance
(
PickOpenEntry
,
{
label
:
nls
.
localize
(
'
emptyPicks
'
,
"
There are no entries to pick from
"
)
},
0
,
null
));
entries
.
push
(
this
.
instantiationService
.
createInstance
(
PickOpenEntry
,
{
label
:
nls
.
localize
(
'
emptyPicks
'
,
"
There are no entries to pick from
"
)
},
0
,
null
));
...
@@ -1065,6 +1067,7 @@ class PickOpenEntry extends PlaceholderQuickOpenEntry {
...
@@ -1065,6 +1067,7 @@ class PickOpenEntry extends PlaceholderQuickOpenEntry {
private
alwaysShow
:
boolean
;
private
alwaysShow
:
boolean
;
private
resource
:
URI
;
private
resource
:
URI
;
private
isFolder
:
boolean
;
private
isFolder
:
boolean
;
private
_action
:
IAction
;
constructor
(
constructor
(
item
:
IPickOpenEntry
,
item
:
IPickOpenEntry
,
...
@@ -1080,12 +1083,17 @@ class PickOpenEntry extends PlaceholderQuickOpenEntry {
...
@@ -1080,12 +1083,17 @@ class PickOpenEntry extends PlaceholderQuickOpenEntry {
this
.
hasSeparator
=
item
.
separator
&&
item
.
separator
.
border
;
this
.
hasSeparator
=
item
.
separator
&&
item
.
separator
.
border
;
this
.
separatorLabel
=
item
.
separator
&&
item
.
separator
.
label
;
this
.
separatorLabel
=
item
.
separator
&&
item
.
separator
.
label
;
this
.
alwaysShow
=
item
.
alwaysShow
;
this
.
alwaysShow
=
item
.
alwaysShow
;
this
.
_action
=
item
.
action
;
const
fileItem
=
<
IFilePickOpenEntry
>
item
;
const
fileItem
=
<
IFilePickOpenEntry
>
item
;
this
.
resource
=
fileItem
.
resource
;
this
.
resource
=
fileItem
.
resource
;
this
.
isFolder
=
fileItem
.
isFolder
;
this
.
isFolder
=
fileItem
.
isFolder
;
}
}
public
get
action
():
IAction
{
return
this
.
_action
;
}
public
get
index
():
number
{
public
get
index
():
number
{
return
this
.
_index
;
return
this
.
_index
;
}
}
...
@@ -1135,6 +1143,28 @@ class PickOpenEntry extends PlaceholderQuickOpenEntry {
...
@@ -1135,6 +1143,28 @@ class PickOpenEntry extends PlaceholderQuickOpenEntry {
}
}
}
}
class
PickOpenActionProvider
implements
IActionProvider
{
public
hasActions
(
tree
:
ITree
,
element
:
PickOpenEntry
):
boolean
{
return
!!
element
.
action
;
}
public
getActions
(
tree
:
ITree
,
element
:
PickOpenEntry
):
TPromise
<
IAction
[]
>
{
return
TPromise
.
as
(
element
.
action
?
[
element
.
action
]
:
[]);
}
public
hasSecondaryActions
(
tree
:
ITree
,
element
:
PickOpenEntry
):
boolean
{
return
false
;
}
public
getSecondaryActions
(
tree
:
ITree
,
element
:
PickOpenEntry
):
TPromise
<
IAction
[]
>
{
return
TPromise
.
as
([]);
}
public
getActionItem
(
tree
:
ITree
,
element
:
PickOpenEntry
,
action
:
Action
):
BaseActionItem
{
return
null
;
}
}
export
class
EditorHistoryEntryGroup
extends
QuickOpenEntryGroup
{
export
class
EditorHistoryEntryGroup
extends
QuickOpenEntryGroup
{
// Marker class
// Marker class
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录