Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d9246d98
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,发现更多精彩内容 >>
提交
d9246d98
编写于
9月 11, 2017
作者:
J
Joao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
IViewletView
上级
d0e342ae
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
44 addition
and
44 deletion
+44
-44
src/vs/workbench/browser/parts/views/views.ts
src/vs/workbench/browser/parts/views/views.ts
+37
-37
src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts
...ch/parts/extensions/electron-browser/extensionsViewlet.ts
+2
-2
src/vs/workbench/parts/files/browser/explorerViewlet.ts
src/vs/workbench/parts/files/browser/explorerViewlet.ts
+3
-3
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+2
-2
未找到文件。
src/vs/workbench/browser/parts/views/views.ts
浏览文件 @
d9246d98
...
...
@@ -42,10 +42,10 @@ export interface IViewOptions {
}
export
interface
IViewConstructorSignature
{
new
(
initialSize
:
number
,
options
:
IViewOptions
,
...
services
:
{
_serviceBrand
:
any
;
}[]):
IView
;
new
(
initialSize
:
number
,
options
:
IViewOptions
,
...
services
:
{
_serviceBrand
:
any
;
}[]):
IView
letView
;
}
export
interface
IView
extends
IBaseView
,
IThemable
{
export
interface
IView
letView
extends
IBaseView
,
IThemable
{
id
:
string
;
name
:
string
;
getHeaderElement
():
HTMLElement
;
...
...
@@ -72,7 +72,7 @@ export interface ICollapsibleViewOptions extends IViewOptions {
initialBodySize
?:
number
;
}
export
abstract
class
CollapsibleView
extends
AbstractCollapsibleView
implements
IView
{
export
abstract
class
CollapsibleView
extends
AbstractCollapsibleView
implements
IView
letView
{
readonly
id
:
string
;
readonly
name
:
string
;
...
...
@@ -281,7 +281,7 @@ export interface IViewState {
export
class
ViewsViewlet
extends
Viewlet
{
protected
viewletContainer
:
HTMLElement
;
protected
lastFocusedView
:
IView
;
protected
lastFocusedView
:
IView
letView
;
private
splitView
:
SplitView
;
private
viewHeaderContextMenuListeners
:
IDisposable
[]
=
[];
protected
dimension
:
Dimension
;
...
...
@@ -322,9 +322,9 @@ export class ViewsViewlet extends Viewlet {
this
.
viewletContainer
=
DOM
.
append
(
parent
.
getHTMLElement
(),
DOM
.
$
(
''
));
this
.
splitView
=
this
.
_register
(
new
SplitView
(
this
.
viewletContainer
,
{
canChangeOrderByDragAndDrop
:
true
}));
this
.
attachSplitViewStyler
(
this
.
splitView
);
this
.
_register
(
this
.
splitView
.
onFocus
((
view
:
IView
)
=>
this
.
lastFocusedView
=
view
));
this
.
_register
(
this
.
splitView
.
onFocus
((
view
:
IView
letView
)
=>
this
.
lastFocusedView
=
view
));
this
.
_register
(
this
.
splitView
.
onDidOrderChange
(()
=>
{
const
views
=
this
.
splitView
.
getViews
<
IView
>
();
const
views
=
this
.
splitView
.
getViews
<
IView
letView
>
();
for
(
let
order
=
0
;
order
<
views
.
length
;
order
++
)
{
this
.
viewsStates
.
get
(
views
[
order
].
id
).
order
=
order
;
}
...
...
@@ -332,29 +332,29 @@ export class ViewsViewlet extends Viewlet {
return
this
.
onViewsRegistered
(
ViewsRegistry
.
getViews
(
this
.
location
))
.
then
(()
=>
{
this
.
lastFocusedView
=
this
.
splitView
.
getViews
<
IView
>
()[
0
];
this
.
lastFocusedView
=
this
.
splitView
.
getViews
<
IView
letView
>
()[
0
];
this
.
focus
();
});
}
getTitle
():
string
{
let
title
=
Registry
.
as
<
ViewletRegistry
>
(
Extensions
.
Viewlets
).
getViewlet
(
this
.
getId
()).
name
;
if
(
this
.
showHeaderInTitleArea
()
&&
this
.
splitView
.
getViews
<
IView
>
()[
0
])
{
title
+=
'
:
'
+
this
.
splitView
.
getViews
<
IView
>
()[
0
].
name
;
if
(
this
.
showHeaderInTitleArea
()
&&
this
.
splitView
.
getViews
<
IView
letView
>
()[
0
])
{
title
+=
'
:
'
+
this
.
splitView
.
getViews
<
IView
letView
>
()[
0
].
name
;
}
return
title
;
}
getActions
():
IAction
[]
{
if
(
this
.
showHeaderInTitleArea
()
&&
this
.
splitView
.
getViews
<
IView
>
()[
0
])
{
return
this
.
splitView
.
getViews
<
IView
>
()[
0
].
getActions
();
if
(
this
.
showHeaderInTitleArea
()
&&
this
.
splitView
.
getViews
<
IView
letView
>
()[
0
])
{
return
this
.
splitView
.
getViews
<
IView
letView
>
()[
0
].
getActions
();
}
return
[];
}
getSecondaryActions
():
IAction
[]
{
if
(
this
.
showHeaderInTitleArea
()
&&
this
.
splitView
.
getViews
<
IView
>
()[
0
])
{
return
this
.
splitView
.
getViews
<
IView
>
()[
0
].
getSecondaryActions
();
if
(
this
.
showHeaderInTitleArea
()
&&
this
.
splitView
.
getViews
<
IView
letView
>
()[
0
])
{
return
this
.
splitView
.
getViews
<
IView
letView
>
()[
0
].
getSecondaryActions
();
}
return
[];
}
...
...
@@ -373,7 +373,7 @@ export class ViewsViewlet extends Viewlet {
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
return
super
.
setVisible
(
visible
)
.
then
(()
=>
TPromise
.
join
(
this
.
splitView
.
getViews
<
IView
>
().
filter
(
view
=>
view
.
isVisible
()
!==
visible
)
.
then
(()
=>
TPromise
.
join
(
this
.
splitView
.
getViews
<
IView
letView
>
().
filter
(
view
=>
view
.
isVisible
()
!==
visible
)
.
map
((
view
)
=>
view
.
setVisible
(
visible
))))
.
then
(()
=>
void
0
);
}
...
...
@@ -395,19 +395,19 @@ export class ViewsViewlet extends Viewlet {
getOptimalWidth
():
number
{
const
additionalMargin
=
16
;
const
optimalWidth
=
Math
.
max
(...
this
.
splitView
.
getViews
<
IView
>
().
map
(
view
=>
view
.
getOptimalWidth
()
||
0
));
const
optimalWidth
=
Math
.
max
(...
this
.
splitView
.
getViews
<
IView
letView
>
().
map
(
view
=>
view
.
getOptimalWidth
()
||
0
));
return
optimalWidth
+
additionalMargin
;
}
shutdown
():
void
{
this
.
splitView
.
getViews
<
IView
>
().
forEach
((
view
)
=>
view
.
shutdown
());
this
.
splitView
.
getViews
<
IView
letView
>
().
forEach
((
view
)
=>
view
.
shutdown
());
super
.
shutdown
();
}
private
layoutViews
():
void
{
if
(
this
.
splitView
)
{
this
.
splitView
.
layout
(
this
.
dimension
.
height
);
for
(
const
view
of
this
.
splitView
.
getViews
<
IView
>
())
{
for
(
const
view
of
this
.
splitView
.
getViews
<
IView
letView
>
())
{
let
viewState
=
this
.
updateViewStateSize
(
view
);
this
.
viewsStates
.
set
(
view
.
id
,
viewState
);
}
...
...
@@ -428,7 +428,7 @@ export class ViewsViewlet extends Viewlet {
this
.
updateViews
();
}
private
onViewsRegistered
(
views
:
IViewDescriptor
[]):
TPromise
<
IView
[]
>
{
private
onViewsRegistered
(
views
:
IViewDescriptor
[]):
TPromise
<
IView
letView
[]
>
{
this
.
viewsContextKeys
.
clear
();
for
(
const
viewDescriptor
of
this
.
getViewDescriptorsFromRegistry
())
{
if
(
viewDescriptor
.
when
)
{
...
...
@@ -441,7 +441,7 @@ export class ViewsViewlet extends Viewlet {
return
this
.
updateViews
();
}
private
onViewsDeregistered
(
views
:
IViewDescriptor
[]):
TPromise
<
IView
[]
>
{
private
onViewsDeregistered
(
views
:
IViewDescriptor
[]):
TPromise
<
IView
letView
[]
>
{
return
this
.
updateViews
(
views
);
}
...
...
@@ -463,7 +463,7 @@ export class ViewsViewlet extends Viewlet {
}
}
protected
updateViews
(
unregisteredViews
:
IViewDescriptor
[]
=
[]):
TPromise
<
IView
[]
>
{
protected
updateViews
(
unregisteredViews
:
IViewDescriptor
[]
=
[]):
TPromise
<
IView
letView
[]
>
{
if
(
this
.
splitView
)
{
const
registeredViews
=
this
.
getViewDescriptorsFromRegistry
();
...
...
@@ -487,10 +487,10 @@ export class ViewsViewlet extends Viewlet {
},
[[],
[],
unregisteredViews
]);
const
toCreate
:
IView
[]
=
[];
const
toCreate
:
IView
letView
[]
=
[];
if
(
toAdd
.
length
||
toRemove
.
length
)
{
for
(
const
view
of
this
.
splitView
.
getViews
<
IView
>
())
{
for
(
const
view
of
this
.
splitView
.
getViews
<
IView
letView
>
())
{
let
viewState
=
this
.
viewsStates
.
get
(
view
.
id
);
if
(
!
viewState
||
typeof
viewState
.
size
===
'
undefined
'
||
view
.
size
!==
viewState
.
size
||
!
view
.
isExpanded
()
!==
viewState
.
collapsed
)
{
viewState
=
this
.
updateViewStateSize
(
view
);
...
...
@@ -569,14 +569,14 @@ export class ViewsViewlet extends Viewlet {
}
if
(
this
.
showHeaderInTitleArea
())
{
if
(
this
.
splitView
.
getViews
<
IView
>
()[
0
])
{
this
.
splitView
.
getViews
<
IView
>
()[
0
].
hideHeader
();
if
(
!
this
.
splitView
.
getViews
<
IView
>
()[
0
].
isExpanded
())
{
this
.
splitView
.
getViews
<
IView
>
()[
0
].
expand
();
if
(
this
.
splitView
.
getViews
<
IView
letView
>
()[
0
])
{
this
.
splitView
.
getViews
<
IView
letView
>
()[
0
].
hideHeader
();
if
(
!
this
.
splitView
.
getViews
<
IView
letView
>
()[
0
].
isExpanded
())
{
this
.
splitView
.
getViews
<
IView
letView
>
()[
0
].
expand
();
}
}
}
else
{
for
(
const
view
of
this
.
splitView
.
getViews
<
IView
>
())
{
for
(
const
view
of
this
.
splitView
.
getViews
<
IView
letView
>
())
{
view
.
showHeader
();
}
}
...
...
@@ -605,7 +605,7 @@ export class ViewsViewlet extends Viewlet {
return
this
.
setVisible
(
this
.
isVisible
());
}
private
onContextMenu
(
event
:
StandardMouseEvent
,
view
:
IView
):
void
{
private
onContextMenu
(
event
:
StandardMouseEvent
,
view
:
IView
letView
):
void
{
event
.
stopPropagation
();
event
.
preventDefault
();
...
...
@@ -625,7 +625,7 @@ export class ViewsViewlet extends Viewlet {
if
(
!
this
.
showHeaderInTitleWhenSingleView
)
{
return
false
;
}
if
(
this
.
splitView
.
getViews
<
IView
>
().
length
>
1
)
{
if
(
this
.
splitView
.
getViews
<
IView
letView
>
().
length
>
1
)
{
return
false
;
}
if
(
ViewLocation
.
getContributedViewLocation
(
this
.
location
.
id
)
&&
!
this
.
areExtensionsReady
)
{
...
...
@@ -663,32 +663,32 @@ export class ViewsViewlet extends Viewlet {
});
}
protected
createView
(
viewDescriptor
:
IViewDescriptor
,
initialSize
:
number
,
options
:
IViewletViewOptions
):
IView
{
protected
createView
(
viewDescriptor
:
IViewDescriptor
,
initialSize
:
number
,
options
:
IViewletViewOptions
):
IView
letView
{
return
this
.
instantiationService
.
createInstance
(
viewDescriptor
.
ctor
,
initialSize
,
options
);
}
protected
get
views
():
IView
[]
{
return
this
.
splitView
?
this
.
splitView
.
getViews
<
IView
>
()
:
[];
protected
get
views
():
IView
letView
[]
{
return
this
.
splitView
?
this
.
splitView
.
getViews
<
IView
letView
>
()
:
[];
}
protected
getView
(
id
:
string
):
IView
{
return
this
.
splitView
.
getViews
<
IView
>
().
filter
(
view
=>
view
.
id
===
id
)[
0
];
protected
getView
(
id
:
string
):
IView
letView
{
return
this
.
splitView
.
getViews
<
IView
letView
>
().
filter
(
view
=>
view
.
id
===
id
)[
0
];
}
private
updateViewStateSize
(
view
:
IView
):
IViewState
{
private
updateViewStateSize
(
view
:
IView
letView
):
IViewState
{
const
currentState
=
this
.
viewsStates
.
get
(
view
.
id
);
const
newViewState
=
this
.
createViewState
(
view
);
return
currentState
?
{
...
currentState
,
collapsed
:
newViewState
.
collapsed
,
size
:
newViewState
.
size
}
:
newViewState
;
}
protected
createViewState
(
view
:
IView
):
IViewState
{
protected
createViewState
(
view
:
IView
letView
):
IViewState
{
const
collapsed
=
!
view
.
isExpanded
();
const
size
=
collapsed
&&
view
instanceof
CollapsibleView
?
view
.
previousSize
:
view
.
size
;
return
{
collapsed
,
size
:
size
&&
size
>
0
?
size
:
void
0
,
isHidden
:
false
,
order
:
this
.
splitView
.
getViews
<
IView
>
().
indexOf
(
view
)
order
:
this
.
splitView
.
getViews
<
IView
letView
>
().
indexOf
(
view
)
};
}
}
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts
浏览文件 @
d9246d98
...
...
@@ -46,7 +46,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import
{
inputForeground
,
inputBackground
,
inputBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ViewsRegistry
,
ViewLocation
,
IViewDescriptor
}
from
'
vs/workbench/browser/parts/views/viewsRegistry
'
;
import
{
PersistentViewsViewlet
,
IView
}
from
'
vs/workbench/browser/parts/views/views
'
;
import
{
PersistentViewsViewlet
,
IView
letView
}
from
'
vs/workbench/browser/parts/views/views
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IContextKeyService
,
ContextKeyExpr
,
RawContextKey
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -310,7 +310,7 @@ export class ExtensionsViewlet extends PersistentViewsViewlet implements IExtens
await
this
.
updateViews
([],
!!
value
);
}
protected
async
updateViews
(
unregisteredViews
:
IViewDescriptor
[]
=
[],
showAll
=
false
):
TPromise
<
IView
[]
>
{
protected
async
updateViews
(
unregisteredViews
:
IViewDescriptor
[]
=
[],
showAll
=
false
):
TPromise
<
IView
letView
[]
>
{
const
created
=
await
super
.
updateViews
();
const
toShow
=
showAll
?
this
.
views
:
created
;
if
(
toShow
.
length
)
{
...
...
src/vs/workbench/parts/files/browser/explorerViewlet.ts
浏览文件 @
d9246d98
...
...
@@ -12,7 +12,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
{
Builder
}
from
'
vs/base/browser/builder
'
;
import
{
VIEWLET_ID
,
ExplorerViewletVisibleContext
,
IFilesConfiguration
,
OpenEditorsVisibleContext
,
OpenEditorsVisibleCondition
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
PersistentViewsViewlet
,
IView
,
IViewletViewOptions
}
from
'
vs/workbench/browser/parts/views/views
'
;
import
{
PersistentViewsViewlet
,
IView
letView
,
IViewletViewOptions
}
from
'
vs/workbench/browser/parts/views/views
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationEditingService
}
from
'
vs/workbench/services/configuration/common/configurationEditing
'
;
import
{
ActionRunner
,
FileViewletState
}
from
'
vs/workbench/parts/files/browser/views/explorerViewer
'
;
...
...
@@ -125,7 +125,7 @@ export class ExplorerViewlet extends PersistentViewsViewlet {
this
.
openEditorsVisibleContextKey
.
set
(
!
this
.
contextService
.
hasWorkspace
()
||
(
<
IFilesConfiguration
>
this
.
configurationService
.
getConfiguration
()).
explorer
.
openEditors
.
visible
!==
0
);
}
protected
createView
(
viewDescriptor
:
IViewDescriptor
,
initialSize
:
number
,
options
:
IViewletViewOptions
):
IView
{
protected
createView
(
viewDescriptor
:
IViewDescriptor
,
initialSize
:
number
,
options
:
IViewletViewOptions
):
IView
letView
{
if
(
viewDescriptor
.
id
===
ExplorerView
.
ID
)
{
// Create a delegating editor service for the explorer to be able to delay the refresh in the opened
// editors view above. This is a workaround for being able to double click on a file to make it pinned
...
...
@@ -223,7 +223,7 @@ export class ExplorerViewlet extends PersistentViewsViewlet {
super
.
focus
();
}
private
hasSelectionOrFocus
(
view
:
IView
):
boolean
{
private
hasSelectionOrFocus
(
view
:
IView
letView
):
boolean
{
if
(
!
view
)
{
return
false
;
}
...
...
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
d9246d98
...
...
@@ -12,7 +12,7 @@ import { chain } from 'vs/base/common/event';
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
Builder
}
from
'
vs/base/browser/builder
'
;
import
{
PersistentViewsViewlet
,
CollapsibleView
,
IViewletViewOptions
,
IView
,
IViewOptions
}
from
'
vs/workbench/browser/parts/views/views
'
;
import
{
PersistentViewsViewlet
,
CollapsibleView
,
IViewletViewOptions
,
IView
letView
,
IViewOptions
}
from
'
vs/workbench/browser/parts/views/views
'
;
import
{
append
,
$
,
toggleClass
,
trackFocus
}
from
'
vs/base/browser/dom
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
List
}
from
'
vs/base/browser/ui/list/listWidget
'
;
...
...
@@ -552,7 +552,7 @@ export class SCMViewlet extends PersistentViewsViewlet {
this
.
scmService
.
repositories
.
forEach
(
p
=>
this
.
onDidAddRepository
(
p
));
}
protected
createView
(
viewDescriptor
:
IViewDescriptor
,
initialSize
:
number
,
options
:
IViewletViewOptions
):
IView
{
protected
createView
(
viewDescriptor
:
IViewDescriptor
,
initialSize
:
number
,
options
:
IViewletViewOptions
):
IView
letView
{
if
(
viewDescriptor
instanceof
SourceControlViewDescriptor
)
{
return
this
.
instantiationService
.
createInstance
(
SourceControlView
,
initialSize
,
viewDescriptor
.
repository
,
options
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录