Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6294fa20
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,发现更多精彩内容 >>
提交
6294fa20
编写于
3月 22, 2018
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PR feedback
上级
e42c6630
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
75 deletion
+53
-75
src/vs/workbench/parts/search/browser/searchResultsView.ts
src/vs/workbench/parts/search/browser/searchResultsView.ts
+12
-38
src/vs/workbench/parts/search/browser/searchView.ts
src/vs/workbench/parts/search/browser/searchView.ts
+1
-1
src/vs/workbench/parts/search/electron-browser/search.contribution.ts
...ench/parts/search/electron-browser/search.contribution.ts
+40
-36
未找到文件。
src/vs/workbench/parts/search/browser/searchResultsView.ts
浏览文件 @
6294fa20
...
...
@@ -9,7 +9,7 @@ import * as DOM from 'vs/base/browser/dom';
import
{
Disposable
,
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IAction
,
IActionRunner
}
from
'
vs/base/common/actions
'
;
import
{
ActionBar
,
ActionItem
,
Separator
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
ActionBar
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
CountBadge
}
from
'
vs/base/browser/ui/countBadge/countBadge
'
;
import
{
FileLabel
}
from
'
vs/workbench/browser/labels
'
;
import
{
ITree
,
IDataSource
,
ISorter
,
IAccessibilityProvider
,
IFilter
,
IRenderer
,
ContextMenuEvent
}
from
'
vs/base/parts/tree/browser/tree
'
;
...
...
@@ -25,9 +25,9 @@ import { getPathLabel } from 'vs/base/common/labels';
import
{
FileKind
}
from
'
vs/platform/files/common/files
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IMenuService
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IMenuService
,
MenuId
,
IMenu
}
from
'
vs/platform/actions/common/actions
'
;
import
{
WorkbenchTreeController
,
WorkbenchTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
fillInActions
}
from
'
vs/platform/actions/browser/menuItemActionItem
'
;
export
class
SearchDataSource
implements
IDataSource
{
...
...
@@ -361,61 +361,35 @@ export class SearchFilter implements IFilter {
}
export
class
SearchTreeController
extends
WorkbenchTreeController
{
private
contextMenu
:
IMenu
;
constructor
(
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
,
@
IMenuService
private
menuService
:
IMenuService
,
@
IKeybindingService
private
readonly
_keybindingService
:
IKeybindingService
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
({},
configurationService
);
}
public
onContextMenu
(
tree
:
WorkbenchTree
,
element
:
any
,
event
:
ContextMenuEvent
):
boolean
{
tree
.
setFocus
(
element
);
const
actions
=
this
.
_getMenuActions
(
tree
);
if
(
!
actions
.
length
)
{
return
true
;
if
(
!
this
.
contextMenu
)
{
this
.
contextMenu
=
this
.
menuService
.
createMenu
(
MenuId
.
SearchContext
,
tree
.
contextKeyService
);
}
tree
.
setFocus
(
element
);
const
anchor
=
{
x
:
event
.
posx
,
y
:
event
.
posy
};
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
anchor
,
getActions
:
()
=>
{
const
actions
:
IAction
[]
=
[];
fillInActions
(
this
.
contextMenu
,
{
shouldForwardArgs
:
true
},
actions
,
this
.
contextMenuService
);
return
TPromise
.
as
(
actions
);
},
getActionItem
:
(
action
)
=>
{
const
keybinding
=
this
.
_keybindingService
.
lookupKeybinding
(
action
.
id
);
if
(
keybinding
)
{
return
new
ActionItem
(
action
,
action
,
{
label
:
true
,
keybinding
:
keybinding
.
getLabel
()
});
}
return
null
;
},
onHide
:
(
wasCancelled
?:
boolean
)
=>
{
if
(
wasCancelled
)
{
tree
.
domFocus
();
}
}
// getActionsContext: () => element instanceof OpenEditor ? { groupId: element.group.id, editorIndex: element.editorIndex } : { groupId: element.id }
});
return
true
;
}
private
_getMenuActions
(
tree
:
WorkbenchTree
):
IAction
[]
{
const
result
:
IAction
[]
=
[];
const
menu
=
this
.
menuService
.
createMenu
(
MenuId
.
SearchContext
,
tree
.
contextKeyService
);
const
groups
=
menu
.
getActions
();
menu
.
dispose
();
for
(
let
group
of
groups
)
{
const
[,
actions
]
=
group
;
result
.
push
(...
actions
);
result
.
push
(
new
Separator
());
}
result
.
pop
();
// remove last separator
return
result
;
}
}
src/vs/workbench/parts/search/browser/searchView.ts
浏览文件 @
6294fa20
...
...
@@ -528,7 +528,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
if
(
treeHasFocus
)
{
const
focus
=
e
.
focus
;
this
.
firstMatchFocused
.
set
(
this
.
tree
.
getNavigator
().
first
()
===
focus
);
this
.
fileMatchOrMatchFocused
.
set
(
true
);
this
.
fileMatchOrMatchFocused
.
set
(
!!
focus
);
this
.
fileMatchFocused
.
set
(
focus
instanceof
FileMatch
);
this
.
folderMatchFocused
.
set
(
focus
instanceof
FolderMatch
);
this
.
matchFocused
.
set
(
focus
instanceof
Match
);
...
...
src/vs/workbench/parts/search/electron-browser/search.contribution.ts
浏览文件 @
6294fa20
...
...
@@ -126,15 +126,6 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
}
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
SearchContext
,
{
command
:
{
id
:
Constants
.
RemoveActionId
,
title
:
RemoveAction
.
LABEL
},
when
:
Constants
.
FileMatchOrMatchFocusKey
,
group
:
'
search
'
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
Constants
.
ReplaceActionId
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
...
...
@@ -148,15 +139,6 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
}
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
SearchContext
,
{
command
:
{
id
:
Constants
.
ReplaceActionId
,
title
:
ReplaceAction
.
LABEL
},
when
:
ContextKeyExpr
.
and
(
Constants
.
ReplaceActiveKey
,
Constants
.
MatchFocusKey
),
group
:
'
search
'
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
Constants
.
ReplaceAllInFileActionId
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
...
...
@@ -169,15 +151,6 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
}
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
SearchContext
,
{
command
:
{
id
:
Constants
.
ReplaceAllInFileActionId
,
title
:
ReplaceAllAction
.
LABEL
},
when
:
ContextKeyExpr
.
and
(
Constants
.
ReplaceActiveKey
,
Constants
.
FileFocusKey
),
group
:
'
search
'
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
Constants
.
ReplaceAllInFolderActionId
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
...
...
@@ -190,15 +163,6 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
}
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
SearchContext
,
{
command
:
{
id
:
Constants
.
ReplaceAllInFolderActionId
,
title
:
ReplaceAllInFolderAction
.
LABEL
},
when
:
ContextKeyExpr
.
and
(
Constants
.
ReplaceActiveKey
,
Constants
.
FolderFocusKey
),
group
:
'
search
'
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
Constants
.
CloseReplaceWidgetActionId
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
...
...
@@ -229,6 +193,46 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
}
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
SearchContext
,
{
command
:
{
id
:
Constants
.
ReplaceActionId
,
title
:
ReplaceAction
.
LABEL
},
when
:
ContextKeyExpr
.
and
(
Constants
.
ReplaceActiveKey
,
Constants
.
MatchFocusKey
),
group
:
'
search
'
,
order
:
1
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
SearchContext
,
{
command
:
{
id
:
Constants
.
ReplaceAllInFolderActionId
,
title
:
ReplaceAllInFolderAction
.
LABEL
},
when
:
ContextKeyExpr
.
and
(
Constants
.
ReplaceActiveKey
,
Constants
.
FolderFocusKey
),
group
:
'
search
'
,
order
:
1
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
SearchContext
,
{
command
:
{
id
:
Constants
.
ReplaceAllInFileActionId
,
title
:
ReplaceAllAction
.
LABEL
},
when
:
ContextKeyExpr
.
and
(
Constants
.
ReplaceActiveKey
,
Constants
.
FileFocusKey
),
group
:
'
search
'
,
order
:
1
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
SearchContext
,
{
command
:
{
id
:
Constants
.
RemoveActionId
,
title
:
RemoveAction
.
LABEL
},
when
:
Constants
.
FileMatchOrMatchFocusKey
,
group
:
'
search
'
,
order
:
2
});
const
FIND_IN_FOLDER_ID
=
'
filesExplorer.findInFolder
'
;
CommandsRegistry
.
registerCommand
({
id
:
FIND_IN_FOLDER_ID
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录