Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a890e1c8
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,发现更多精彩内容 >>
提交
a890e1c8
编写于
2月 23, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
viewlet, panel: remove notion of search.location, instead add api to enableViewlet enablePanel
上级
83d921a9
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
80 addition
and
39 deletion
+80
-39
src/vs/workbench/browser/composite.ts
src/vs/workbench/browser/composite.ts
+2
-0
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
...vs/workbench/browser/parts/activitybar/activitybarPart.ts
+6
-13
src/vs/workbench/browser/parts/panel/panelPart.ts
src/vs/workbench/browser/parts/panel/panelPart.ts
+14
-17
src/vs/workbench/parts/search/browser/replaceService.ts
src/vs/workbench/parts/search/browser/replaceService.ts
+27
-1
src/vs/workbench/services/panel/common/panelService.ts
src/vs/workbench/services/panel/common/panelService.ts
+6
-0
src/vs/workbench/services/progress/test/progressService.test.ts
.../workbench/services/progress/test/progressService.test.ts
+5
-0
src/vs/workbench/services/viewlet/browser/viewlet.ts
src/vs/workbench/services/viewlet/browser/viewlet.ts
+7
-0
src/vs/workbench/services/viewlet/browser/viewletService.ts
src/vs/workbench/services/viewlet/browser/viewletService.ts
+13
-8
未找到文件。
src/vs/workbench/browser/composite.ts
浏览文件 @
a890e1c8
...
...
@@ -203,6 +203,7 @@ export abstract class CompositeDescriptor<T extends Composite> {
public
cssClass
:
string
;
public
order
:
number
;
public
keybindingId
:
string
;
public
enabled
:
boolean
;
private
ctor
:
IConstructorSignature0
<
T
>
;
...
...
@@ -212,6 +213,7 @@ export abstract class CompositeDescriptor<T extends Composite> {
this
.
name
=
name
;
this
.
cssClass
=
cssClass
;
this
.
order
=
order
;
this
.
enabled
=
true
;
this
.
keybindingId
=
keybindingId
;
}
...
...
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
浏览文件 @
a890e1c8
...
...
@@ -29,8 +29,6 @@ import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND,
import
{
contrastBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
CompositeBar
}
from
'
vs/workbench/browser/parts/compositebar/compositeBar
'
;
import
{
ToggleCompositePinnedAction
}
from
'
vs/workbench/browser/parts/compositebar/compositeBarActions
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ISearchConfiguration
,
VIEW_ID
as
SEARCH_VIEW_ID
}
from
'
vs/platform/search/common/search
'
;
export
class
ActivitybarPart
extends
Part
{
...
...
@@ -58,8 +56,7 @@ export class ActivitybarPart extends Part {
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IPartService
private
partService
:
IPartService
,
@
IThemeService
themeService
:
IThemeService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
@
IThemeService
themeService
:
IThemeService
)
{
super
(
id
,
{
hasTitle
:
false
},
themeService
);
...
...
@@ -89,15 +86,11 @@ export class ActivitybarPart extends Part {
// Deactivate viewlet action on close
this
.
toUnbind
.
push
(
this
.
viewletService
.
onDidViewletClose
(
viewlet
=>
this
.
compositeBar
.
deactivateComposite
(
viewlet
.
getId
())));
this
.
toUnbind
.
push
(
this
.
compositeBar
.
onDidContextMenu
(
e
=>
this
.
showContextMenu
(
e
)));
this
.
toUnbind
.
push
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
{
if
(
e
.
affectsConfiguration
(
'
search.location
'
))
{
const
location
=
this
.
configurationService
.
getValue
<
ISearchConfiguration
>
().
search
.
location
;
if
(
location
===
'
sidebar
'
)
{
this
.
compositeBar
.
addComposite
(
this
.
viewletService
.
getViewlet
(
SEARCH_VIEW_ID
));
this
.
toUnbind
.
push
(
this
.
viewletService
.
onDidViewletEnable
(({
id
,
enabled
})
=>
{
if
(
enabled
)
{
this
.
compositeBar
.
addComposite
(
this
.
viewletService
.
getViewlet
(
id
));
}
else
{
this
.
compositeBar
.
removeComposite
(
SEARCH_VIEW_ID
);
}
this
.
compositeBar
.
removeComposite
(
id
);
}
}));
}
...
...
src/vs/workbench/browser/parts/panel/panelPart.ts
浏览文件 @
a890e1c8
...
...
@@ -30,8 +30,6 @@ import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ISearchConfiguration
,
VIEW_ID
as
SEARCH_VIEW_ID
}
from
'
vs/platform/search/common/search
'
;
export
class
PanelPart
extends
CompositePart
<
Panel
>
implements
IPanelService
{
...
...
@@ -55,8 +53,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
@
IPartService
partService
:
IPartService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IThemeService
themeService
:
IThemeService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
@
IThemeService
themeService
:
IThemeService
)
{
super
(
notificationService
,
...
...
@@ -113,16 +110,6 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
// Deactivate panel action on close
this
.
toUnbind
.
push
(
this
.
onDidPanelClose
(
panel
=>
this
.
compositeBar
.
deactivateComposite
(
panel
.
getId
())));
this
.
toUnbind
.
push
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
{
if
(
e
.
affectsConfiguration
(
'
search.location
'
))
{
const
location
=
this
.
configurationService
.
getValue
<
ISearchConfiguration
>
().
search
.
location
;
if
(
location
===
'
panel
'
)
{
this
.
compositeBar
.
addComposite
(
this
.
getPanel
(
SEARCH_VIEW_ID
));
}
else
{
this
.
compositeBar
.
removeComposite
(
SEARCH_VIEW_ID
);
}
}
}));
}
public
get
onDidPanelOpen
():
Event
<
IPanel
>
{
...
...
@@ -183,13 +170,23 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
}
public
getPanels
():
IPanelIdentifier
[]
{
const
searchConfig
=
this
.
configurationService
.
getValue
<
ISearchConfiguration
>
();
const
excludeSearch
=
searchConfig
.
search
.
location
!==
'
panel
'
;
return
Registry
.
as
<
PanelRegistry
>
(
PanelExtensions
.
Panels
).
getPanels
()
.
filter
(
p
=>
!
(
p
.
id
===
SEARCH_VIEW_ID
&&
excludeSearch
)
)
.
filter
(
p
=>
p
.
enabled
)
.
sort
((
v1
,
v2
)
=>
v1
.
order
-
v2
.
order
);
}
public
enablePanel
(
id
:
string
,
enabled
:
boolean
):
void
{
const
descriptor
=
Registry
.
as
<
PanelRegistry
>
(
PanelExtensions
.
Panels
).
getPanels
().
filter
(
p
=>
p
.
id
===
id
).
pop
();
if
(
descriptor
&&
descriptor
.
enabled
!==
enabled
)
{
descriptor
.
enabled
=
enabled
;
if
(
enabled
)
{
this
.
compositeBar
.
addComposite
(
descriptor
);
}
else
{
this
.
compositeBar
.
removeComposite
(
id
);
}
}
}
protected
getActions
():
IAction
[]
{
return
[
this
.
instantiationService
.
createInstance
(
ToggleMaximizedPanelAction
,
ToggleMaximizedPanelAction
.
ID
,
ToggleMaximizedPanelAction
.
LABEL
),
...
...
src/vs/workbench/parts/search/browser/replaceService.ts
浏览文件 @
a890e1c8
...
...
@@ -26,6 +26,10 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
ResourceTextEdit
}
from
'
vs/editor/common/modes
'
;
import
{
createTextBufferFactoryFromSnapshot
}
from
'
vs/editor/common/model/textModel
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ISearchConfiguration
,
VIEW_ID
}
from
'
vs/platform/search/common/search
'
;
const
REPLACE_PREVIEW
=
'
replacePreview
'
;
...
...
@@ -96,8 +100,30 @@ export class ReplaceService implements IReplaceService {
constructor
(
@
IFileService
private
fileService
:
IFileService
,
@
IEditorService
private
editorService
:
IWorkbenchEditorService
,
@
ITextModelService
private
textModelResolverService
:
ITextModelService
@
ITextModelService
private
textModelResolverService
:
ITextModelService
,
@
IViewletService
viewletService
:
IViewletService
,
@
IPanelService
panelService
:
IPanelService
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
const
updateSearchViewLocation
=
()
=>
{
const
config
=
configurationService
.
getValue
<
ISearchConfiguration
>
();
if
(
config
.
search
.
location
===
'
panel
'
)
{
viewletService
.
enableViewlet
(
VIEW_ID
,
false
);
panelService
.
enablePanel
(
VIEW_ID
,
true
);
}
if
(
config
.
search
.
location
===
'
sidebar
'
)
{
panelService
.
enablePanel
(
VIEW_ID
,
false
);
viewletService
.
enableViewlet
(
VIEW_ID
,
true
);
}
};
configurationService
.
onDidChangeConfiguration
(
e
=>
{
if
(
e
.
affectsConfiguration
(
'
search.location
'
))
{
updateSearchViewLocation
();
}
});
updateSearchViewLocation
();
}
public
replace
(
match
:
Match
):
TPromise
<
any
>
;
...
...
src/vs/workbench/services/panel/common/panelService.ts
浏览文件 @
a890e1c8
...
...
@@ -37,4 +37,10 @@ export interface IPanelService {
* Returns all enabled panels
*/
getPanels
():
IPanelIdentifier
[];
/**
* Enables or disables a panel. Disabled panels are completly hidden from UI.
* By default all panels are enabled.
*/
enablePanel
(
id
:
string
,
enabled
:
boolean
):
void
;
}
src/vs/workbench/services/progress/test/progressService.test.ts
浏览文件 @
a890e1c8
...
...
@@ -24,9 +24,11 @@ class TestViewletService implements IViewletService {
onDidViewletOpenEmitter
=
new
Emitter
<
IViewlet
>
();
onDidViewletCloseEmitter
=
new
Emitter
<
IViewlet
>
();
onDidViewletEnableEmitter
=
new
Emitter
<
{
id
:
string
,
enabled
:
boolean
}
>
();
onDidViewletOpen
=
this
.
onDidViewletOpenEmitter
.
event
;
onDidViewletClose
=
this
.
onDidViewletCloseEmitter
.
event
;
onDidViewletEnable
=
this
.
onDidViewletEnableEmitter
.
event
;
public
openViewlet
(
id
:
string
,
focus
?:
boolean
):
TPromise
<
IViewlet
>
{
return
TPromise
.
as
(
null
);
...
...
@@ -39,6 +41,7 @@ class TestViewletService implements IViewletService {
public
getActiveViewlet
():
IViewlet
{
return
activeViewlet
;
}
public
enableViewlet
(
id
:
string
,
enabled
:
boolean
):
void
{
}
public
dispose
()
{
}
...
...
@@ -74,6 +77,8 @@ class TestPanelService implements IPanelService {
return
activeViewlet
;
}
public
enablePanel
(
id
:
string
,
enabled
:
boolean
):
void
{
}
public
dispose
()
{
}
}
...
...
src/vs/workbench/services/viewlet/browser/viewlet.ts
浏览文件 @
a890e1c8
...
...
@@ -18,6 +18,7 @@ export interface IViewletService {
onDidViewletOpen
:
Event
<
IViewlet
>
;
onDidViewletClose
:
Event
<
IViewlet
>
;
onDidViewletEnable
:
Event
<
{
id
:
string
,
enabled
:
boolean
}
>
;
/**
* Opens a viewlet with the given identifier and pass keyboard focus to it if specified.
...
...
@@ -44,6 +45,12 @@ export interface IViewletService {
*/
getViewlets
():
ViewletDescriptor
[];
/**
* Enables or disables a viewlet. Disabled viewlets are completly hidden from UI.
* By default all viewlets are enabled.
*/
enableViewlet
(
id
:
string
,
enabled
:
boolean
):
void
;
/**
*
*/
...
...
src/vs/workbench/services/viewlet/browser/viewletService.ts
浏览文件 @
a890e1c8
...
...
@@ -7,7 +7,7 @@
import
{
TPromise
,
ValueCallback
}
from
'
vs/base/common/winjs.base
'
;
import
{
IViewlet
}
from
'
vs/workbench/common/viewlet
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
Event
from
'
vs/base/common/event
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
SidebarPart
}
from
'
vs/workbench/browser/parts/sidebar/sidebarPart
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
ViewletDescriptor
,
ViewletRegistry
,
Extensions
as
ViewletExtensions
}
from
'
vs/workbench/browser/viewlet
'
;
...
...
@@ -15,8 +15,6 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
import
{
IProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IContextKeyService
,
RawContextKey
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ISearchConfiguration
,
VIEW_ID
as
SEARCH_VIEW_ID
}
from
'
vs/platform/search/common/search
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
const
ActiveViewletContextId
=
'
activeViewlet
'
;
export
const
ActiveViewletContext
=
new
RawContextKey
<
string
>
(
ActiveViewletContextId
,
''
);
...
...
@@ -32,16 +30,17 @@ export class ViewletService implements IViewletService {
private
extensionViewletsLoaded
:
TPromise
<
void
>
;
private
extensionViewletsLoadedPromiseComplete
:
ValueCallback
;
private
activeViewletContextKey
:
IContextKey
<
string
>
;
private
_onDidViewletEnable
=
new
Emitter
<
{
id
:
string
,
enabled
:
boolean
}
>
();
private
disposables
:
IDisposable
[]
=
[];
public
get
onDidViewletOpen
():
Event
<
IViewlet
>
{
return
this
.
sidebarPart
.
onDidViewletOpen
;
}
public
get
onDidViewletClose
():
Event
<
IViewlet
>
{
return
this
.
sidebarPart
.
onDidViewletClose
;
}
public
get
onDidViewletEnable
():
Event
<
{
id
:
string
,
enabled
:
boolean
}
>
{
return
this
.
_onDidViewletEnable
.
event
;
}
constructor
(
sidebarPart
:
SidebarPart
,
@
IExtensionService
private
extensionService
:
IExtensionService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
@
IContextKeyService
contextKeyService
:
IContextKeyService
)
{
this
.
sidebarPart
=
sidebarPart
;
this
.
viewletRegistry
=
Registry
.
as
<
ViewletRegistry
>
(
ViewletExtensions
.
Viewlets
);
...
...
@@ -85,6 +84,14 @@ export class ViewletService implements IViewletService {
});
}
public
enableViewlet
(
id
:
string
,
enabled
:
boolean
):
void
{
const
descriptor
=
this
.
getBuiltInViewlets
().
filter
(
desc
=>
desc
.
id
===
id
).
pop
();
if
(
descriptor
&&
descriptor
.
enabled
!==
enabled
)
{
descriptor
.
enabled
=
enabled
;
this
.
_onDidViewletEnable
.
fire
({
id
,
enabled
});
}
}
public
openViewlet
(
id
:
string
,
focus
?:
boolean
):
TPromise
<
IViewlet
>
{
// Built in viewlets do not need to wait for extensions to be loaded
...
...
@@ -112,10 +119,8 @@ export class ViewletService implements IViewletService {
public
getViewlets
():
ViewletDescriptor
[]
{
const
builtInViewlets
=
this
.
getBuiltInViewlets
();
const
viewlets
=
builtInViewlets
.
concat
(
this
.
extensionViewlets
);
const
searchConfig
=
this
.
configurationService
.
getValue
<
ISearchConfiguration
>
();
const
excludeSearch
=
searchConfig
.
search
.
location
!==
'
sidebar
'
;
return
viewlets
.
filter
(
v
=>
!
(
v
.
id
===
SEARCH_VIEW_ID
&&
excludeSearch
)
);
return
viewlets
.
filter
(
v
=>
v
.
enabled
);
}
private
getBuiltInViewlets
():
ViewletDescriptor
[]
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录