Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
dd1c9908
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,发现更多精彩内容 >>
提交
dd1c9908
编写于
9月 18, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
resourceScheme context does not work in in menu.commandPalette contribution (fixes #28211)
上级
7b812736
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
8 deletion
+31
-8
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+16
-1
src/vs/workbench/parts/quickopen/browser/commandsHandler.ts
src/vs/workbench/parts/quickopen/browser/commandsHandler.ts
+4
-5
src/vs/workbench/services/group/common/groupService.ts
src/vs/workbench/services/group/common/groupService.ts
+6
-1
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+5
-1
未找到文件。
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
dd1c9908
...
...
@@ -30,7 +30,7 @@ import { IEditorPart } from 'vs/workbench/services/editor/browser/editorService'
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
Position
,
POSITIONS
,
Direction
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
IMessageService
,
IMessageWithAction
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
...
...
@@ -44,6 +44,7 @@ import { EDITOR_GROUP_BACKGROUND } from 'vs/workbench/common/theme';
import
{
createCSSRule
}
from
'
vs/base/browser/dom
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
join
}
from
'
vs/base/common/paths
'
;
import
{
isCommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
class
ProgressMonitor
{
...
...
@@ -1298,6 +1299,20 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
}
public
invokeWithinEditorContext
<
T
>
(
fn
:
(
accessor
:
ServicesAccessor
)
=>
T
):
T
{
const
activeEditor
=
this
.
getActiveEditor
();
if
(
activeEditor
)
{
const
activeEditorControl
=
activeEditor
.
getControl
();
if
(
isCommonCodeEditor
(
activeEditorControl
))
{
return
activeEditorControl
.
invokeWithinContext
(
fn
);
}
return
this
.
editorGroupsControl
.
getInstantiationService
(
activeEditor
.
position
).
invokeFunction
(
fn
);
}
return
this
.
instantiationService
.
invokeFunction
(
fn
);
}
public
layout
(
dimension
:
Dimension
):
Dimension
[]
{
// Pass to super
...
...
src/vs/workbench/parts/quickopen/browser/commandsHandler.ts
浏览文件 @
dd1c9908
...
...
@@ -19,7 +19,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
QuickOpenHandler
,
IWorkbenchQuickOpenConfiguration
}
from
'
vs/workbench/browser/quickopen
'
;
import
{
IEditorAction
,
IEditor
,
isCommonCodeEditor
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorAction
,
IEditor
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
matchesWords
,
matchesPrefix
,
matchesContiguousSubString
,
or
}
from
'
vs/base/common/filters
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -34,6 +34,7 @@ import { once } from 'vs/base/common/event';
import
{
BoundedMap
,
ISerializedBoundedLinkedMap
}
from
'
vs/base/common/map
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ResolvedKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
export
const
ALL_COMMANDS_PREFIX
=
'
>
'
;
...
...
@@ -385,6 +386,7 @@ export class CommandsHandler extends QuickOpenHandler {
constructor
(
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IKeybindingService
private
keybindingService
:
IKeybindingService
,
@
IMenuService
private
menuService
:
IMenuService
,
...
...
@@ -427,10 +429,7 @@ export class CommandsHandler extends QuickOpenHandler {
const
editorEntries
=
this
.
editorActionsToEntries
(
editorActions
,
searchValue
);
// Other Actions
const
menu
=
isCommonCodeEditor
(
activeEditorControl
)
?
activeEditorControl
.
invokeWithinContext
(
accessor
=>
this
.
menuService
.
createMenu
(
MenuId
.
CommandPalette
,
accessor
.
get
(
IContextKeyService
)))
:
this
.
menuService
.
createMenu
(
MenuId
.
CommandPalette
,
this
.
contextKeyService
);
const
menu
=
this
.
editorGroupService
.
invokeWithinEditorContext
(
accessor
=>
this
.
menuService
.
createMenu
(
MenuId
.
CommandPalette
,
accessor
.
get
(
IContextKeyService
)));
const
menuActions
=
menu
.
getActions
().
reduce
((
r
,
[,
actions
])
=>
[...
r
,
...
actions
],
<
MenuItemAction
[]
>
[]);
const
commandEntries
=
this
.
menuItemActionsToEntries
(
menuActions
,
searchValue
);
...
...
src/vs/workbench/services/group/common/groupService.ts
浏览文件 @
dd1c9908
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
createDecorator
,
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
createDecorator
,
ServiceIdentifier
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Position
,
IEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEditorStacksModel
,
IEditorGroup
}
from
'
vs/workbench/common/editor
'
;
import
Event
from
'
vs/base/common/event
'
;
...
...
@@ -132,4 +132,9 @@ export interface IEditorGroupService {
* Returns tab options.
*/
getTabOptions
():
IEditorTabOptions
;
/**
* Invoke a function in the context of the active editor.
*/
invokeWithinEditorContext
<
T
>
(
fn
:
(
accessor
:
ServicesAccessor
)
=>
T
):
T
;
}
\ No newline at end of file
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
dd1c9908
...
...
@@ -44,7 +44,7 @@ import { EnvironmentService } from 'vs/platform/environment/node/environmentServ
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
IWindowsService
,
IWindowService
,
INativeOpenDialogOptions
}
from
'
vs/platform/windows/common/windows
'
;
import
{
TestWorkspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
...
...
@@ -556,6 +556,10 @@ export class TestEditorGroupService implements IEditorGroupService {
public
getTabOptions
():
IEditorTabOptions
{
return
{};
}
public
invokeWithinEditorContext
<
T
>
(
fn
:
(
accessor
:
ServicesAccessor
)
=>
T
):
T
{
return
fn
(
null
);
}
}
export
class
TestEditorService
implements
IWorkbenchEditorService
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录