Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b7932c78
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,发现更多精彩内容 >>
提交
b7932c78
编写于
2月 14, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strict null work on panels
上级
72dbd895
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
35 addition
and
33 deletion
+35
-33
src/vs/base/browser/dnd.ts
src/vs/base/browser/dnd.ts
+1
-1
src/vs/workbench/browser/labels.ts
src/vs/workbench/browser/labels.ts
+2
-2
src/vs/workbench/browser/parts/compositeBar.ts
src/vs/workbench/browser/parts/compositeBar.ts
+3
-3
src/vs/workbench/browser/parts/compositeBarActions.ts
src/vs/workbench/browser/parts/compositeBarActions.ts
+19
-17
src/vs/workbench/browser/parts/editor/titleControl.ts
src/vs/workbench/browser/parts/editor/titleControl.ts
+8
-8
src/vs/workbench/browser/parts/panel/panelPart.ts
src/vs/workbench/browser/parts/panel/panelPart.ts
+2
-2
未找到文件。
src/vs/base/browser/dnd.ts
浏览文件 @
b7932c78
...
...
@@ -71,7 +71,7 @@ export const DataTransfers = {
TEXT
:
'
text/plain
'
};
export
function
applyDragImage
(
event
:
DragEvent
,
label
:
string
,
clazz
:
string
):
void
{
export
function
applyDragImage
(
event
:
DragEvent
,
label
:
string
|
null
,
clazz
:
string
):
void
{
const
dragImage
=
document
.
createElement
(
'
div
'
);
dragImage
.
className
=
clazz
;
dragImage
.
textContent
=
label
;
...
...
src/vs/workbench/browser/labels.ts
浏览文件 @
b7932c78
...
...
@@ -386,10 +386,10 @@ class ResourceLabelWidget extends IconLabel {
}
if
(
this
.
label
)
{
const
configuredLangId
=
getConfiguredLangId
(
this
.
modelService
,
this
.
label
.
resource
)
;
const
configuredLangId
=
this
.
label
.
resource
?
getConfiguredLangId
(
this
.
modelService
,
this
.
label
.
resource
)
:
null
;
if
(
this
.
lastKnownConfiguredLangId
!==
configuredLangId
)
{
clearIconCache
=
true
;
this
.
lastKnownConfiguredLangId
=
configuredLangId
;
this
.
lastKnownConfiguredLangId
=
configuredLangId
||
undefined
;
}
}
...
...
src/vs/workbench/browser/parts/compositeBar.ts
浏览文件 @
b7932c78
...
...
@@ -112,7 +112,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
if
(
this
.
compositeTransfer
.
hasData
(
DraggedCompositeIdentifier
.
prototype
))
{
EventHelper
.
stop
(
e
,
true
);
const
draggedCompositeId
=
this
.
compositeTransfer
.
getData
(
DraggedCompositeIdentifier
.
prototype
)[
0
].
id
;
const
draggedCompositeId
=
this
.
compositeTransfer
.
getData
(
DraggedCompositeIdentifier
.
prototype
)
!
[
0
].
id
;
this
.
compositeTransfer
.
clearData
(
DraggedCompositeIdentifier
.
prototype
);
const
targetItem
=
this
.
model
.
visibleItems
[
this
.
model
.
visibleItems
.
length
-
1
];
...
...
@@ -507,7 +507,7 @@ class CompositeBarModel {
return
this
.
items
.
filter
(
item
=>
item
.
visible
&&
item
.
pinned
);
}
private
createCompositeBarItem
(
id
:
string
,
name
:
string
,
order
:
number
,
pinned
:
boolean
,
visible
:
boolean
):
ICompositeBarModelItem
{
private
createCompositeBarItem
(
id
:
string
,
name
:
string
,
order
:
number
|
undefined
,
pinned
:
boolean
,
visible
:
boolean
):
ICompositeBarModelItem
{
const
options
=
this
.
options
;
return
{
id
,
name
,
pinned
,
order
,
visible
,
...
...
@@ -521,7 +521,7 @@ class CompositeBarModel {
};
}
add
(
id
:
string
,
name
:
string
,
order
:
number
):
boolean
{
add
(
id
:
string
,
name
:
string
,
order
:
number
|
undefined
):
boolean
{
const
item
=
this
.
findItem
(
id
);
if
(
item
)
{
let
changed
=
false
;
...
...
src/vs/workbench/browser/parts/compositeBarActions.ts
浏览文件 @
b7932c78
...
...
@@ -57,13 +57,11 @@ export class ActivityAction extends Action {
private
_onDidChangeBadge
=
new
Emitter
<
this
>
();
get
onDidChangeBadge
():
Event
<
this
>
{
return
this
.
_onDidChangeBadge
.
event
;
}
private
badge
:
IBadge
;
private
badge
?
:
IBadge
;
private
clazz
:
string
|
undefined
;
constructor
(
private
_activity
:
IActivity
)
{
super
(
_activity
.
id
,
_activity
.
name
,
_activity
.
cssClass
);
this
.
badge
=
null
;
}
get
activity
():
IActivity
{
...
...
@@ -87,7 +85,7 @@ export class ActivityAction extends Action {
}
}
getBadge
():
IBadge
{
getBadge
():
IBadge
|
undefined
{
return
this
.
badge
;
}
...
...
@@ -95,7 +93,7 @@ export class ActivityAction extends Action {
return
this
.
clazz
;
}
setBadge
(
badge
:
IBadge
,
clazz
?:
string
):
void
{
setBadge
(
badge
:
IBadge
|
undefined
,
clazz
?:
string
):
void
{
this
.
badge
=
badge
;
this
.
clazz
=
clazz
;
this
.
_onDidChangeBadge
.
fire
(
this
);
...
...
@@ -207,10 +205,10 @@ export class ActivityActionItem extends BaseActionItem {
}));
// Label
this
.
label
=
dom
.
append
(
this
.
element
,
dom
.
$
(
'
a
'
));
this
.
label
=
dom
.
append
(
this
.
element
!
,
dom
.
$
(
'
a
'
));
// Badge
this
.
badge
=
dom
.
append
(
this
.
element
,
dom
.
$
(
'
.badge
'
));
this
.
badge
=
dom
.
append
(
this
.
element
!
,
dom
.
$
(
'
.badge
'
));
this
.
badgeContent
=
dom
.
append
(
this
.
badge
,
dom
.
$
(
'
.badge-content
'
));
dom
.
hide
(
this
.
badge
);
...
...
@@ -373,7 +371,7 @@ export class CompositeOverflowActivityActionItem extends ActivityActionItem {
this
.
actions
=
this
.
getActions
();
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
this
.
element
,
getAnchor
:
()
=>
this
.
element
!
,
getActions
:
()
=>
this
.
actions
,
onHide
:
()
=>
dispose
(
this
.
actions
)
});
...
...
@@ -385,7 +383,7 @@ export class CompositeOverflowActivityActionItem extends ActivityActionItem {
action
.
radio
=
this
.
getActiveCompositeId
()
===
action
.
id
;
const
badge
=
this
.
getBadge
(
composite
.
id
);
let
suffix
:
string
|
number
;
let
suffix
:
string
|
number
|
undefined
;
if
(
badge
instanceof
NumberBadge
)
{
suffix
=
badge
.
number
;
}
else
if
(
badge
instanceof
TextBadge
)
{
...
...
@@ -434,7 +432,7 @@ export class CompositeActionItem extends ActivityActionItem {
private
static
manageExtensionAction
:
ManageExtensionAction
;
private
compositeActivity
:
IActivity
;
private
compositeActivity
:
IActivity
|
null
;
private
compositeTransfer
:
LocalSelectionTransfer
<
DraggedCompositeIdentifier
>
;
constructor
(
...
...
@@ -463,7 +461,7 @@ export class CompositeActionItem extends ActivityActionItem {
protected
get
activity
():
IActivity
{
if
(
!
this
.
compositeActivity
)
{
let
activityName
:
string
;
const
keybinding
=
t
his
.
getKeybindingLabel
(
this
.
compositeActivityAction
.
activity
.
keybindingId
)
;
const
keybinding
=
t
ypeof
this
.
compositeActivityAction
.
activity
.
keybindingId
===
'
string
'
?
this
.
getKeybindingLabel
(
this
.
compositeActivityAction
.
activity
.
keybindingId
)
:
null
;
if
(
keybinding
)
{
activityName
=
nls
.
localize
(
'
titleKeybinding
'
,
"
{0} ({1})
"
,
this
.
compositeActivityAction
.
activity
.
name
,
keybinding
);
}
else
{
...
...
@@ -480,7 +478,7 @@ export class CompositeActionItem extends ActivityActionItem {
return
this
.
compositeActivity
;
}
private
getKeybindingLabel
(
id
:
string
):
string
{
private
getKeybindingLabel
(
id
:
string
):
string
|
null
{
const
kb
=
this
.
keybindingService
.
lookupKeybinding
(
id
);
if
(
kb
)
{
return
kb
.
getLabel
();
...
...
@@ -503,7 +501,7 @@ export class CompositeActionItem extends ActivityActionItem {
// Allow to drag
this
.
_register
(
dom
.
addDisposableListener
(
this
.
container
,
dom
.
EventType
.
DRAG_START
,
(
e
:
DragEvent
)
=>
{
e
.
dataTransfer
.
effectAllowed
=
'
move
'
;
e
.
dataTransfer
!
.
effectAllowed
=
'
move
'
;
// Registe as dragged to local transfer
this
.
compositeTransfer
.
setData
([
new
DraggedCompositeIdentifier
(
this
.
activity
.
id
)],
DraggedCompositeIdentifier
.
prototype
);
...
...
@@ -516,7 +514,7 @@ export class CompositeActionItem extends ActivityActionItem {
this
.
_register
(
new
DragAndDropObserver
(
this
.
container
,
{
onDragEnter
:
e
=>
{
if
(
this
.
compositeTransfer
.
hasData
(
DraggedCompositeIdentifier
.
prototype
)
&&
this
.
compositeTransfer
.
getData
(
DraggedCompositeIdentifier
.
prototype
)[
0
].
id
!==
this
.
activity
.
id
)
{
if
(
this
.
compositeTransfer
.
hasData
(
DraggedCompositeIdentifier
.
prototype
)
&&
this
.
compositeTransfer
.
getData
(
DraggedCompositeIdentifier
.
prototype
)
!
[
0
].
id
!==
this
.
activity
.
id
)
{
this
.
updateFromDragging
(
container
,
true
);
}
},
...
...
@@ -539,7 +537,7 @@ export class CompositeActionItem extends ActivityActionItem {
dom
.
EventHelper
.
stop
(
e
,
true
);
if
(
this
.
compositeTransfer
.
hasData
(
DraggedCompositeIdentifier
.
prototype
))
{
const
draggedCompositeId
=
this
.
compositeTransfer
.
getData
(
DraggedCompositeIdentifier
.
prototype
)[
0
].
id
;
const
draggedCompositeId
=
this
.
compositeTransfer
.
getData
(
DraggedCompositeIdentifier
.
prototype
)
!
[
0
].
id
;
if
(
draggedCompositeId
!==
this
.
activity
.
id
)
{
this
.
updateFromDragging
(
container
,
false
);
this
.
compositeTransfer
.
clearData
(
DraggedCompositeIdentifier
.
prototype
);
...
...
@@ -617,6 +615,10 @@ export class CompositeActionItem extends ActivityActionItem {
}
protected
updateEnabled
():
void
{
if
(
!
this
.
element
)
{
return
;
}
if
(
this
.
getAction
().
enabled
)
{
dom
.
removeClass
(
this
.
element
,
'
disabled
'
);
}
else
{
...
...
@@ -636,12 +638,12 @@ export class CompositeActionItem extends ActivityActionItem {
export
class
ToggleCompositePinnedAction
extends
Action
{
constructor
(
private
activity
:
IActivity
,
private
activity
:
IActivity
|
undefined
,
private
compositeBar
:
ICompositeBar
)
{
super
(
'
show.toggleCompositePinned
'
,
activity
?
activity
.
name
:
nls
.
localize
(
'
toggle
'
,
"
Toggle View Pinned
"
));
this
.
checked
=
this
.
activity
&&
this
.
compositeBar
.
isPinned
(
this
.
activity
.
id
);
this
.
checked
=
!!
this
.
activity
&&
this
.
compositeBar
.
isPinned
(
this
.
activity
.
id
);
}
run
(
context
:
string
):
Promise
<
any
>
{
...
...
src/vs/workbench/browser/parts/editor/titleControl.ts
浏览文件 @
b7932c78
...
...
@@ -50,7 +50,7 @@ export abstract class TitleControl extends Themable {
protected
readonly
groupTransfer
=
LocalSelectionTransfer
.
getInstance
<
DraggedEditorGroupIdentifier
>
();
protected
readonly
editorTransfer
=
LocalSelectionTransfer
.
getInstance
<
DraggedEditorIdentifier
>
();
protected
breadcrumbsControl
:
BreadcrumbsControl
;
protected
breadcrumbsControl
?
:
BreadcrumbsControl
;
private
currentPrimaryEditorActionIds
:
string
[]
=
[];
private
currentSecondaryEditorActionIds
:
string
[]
=
[];
...
...
@@ -154,18 +154,18 @@ export abstract class TitleControl extends Themable {
}));
}
private
actionItemProvider
(
action
:
Action
):
IActionItem
{
private
actionItemProvider
(
action
:
Action
):
IActionItem
|
null
{
const
activeControl
=
this
.
group
.
activeControl
;
// Check Active Editor
let
actionItem
:
IActionItem
;
let
actionItem
:
IActionItem
|
null
=
null
;
if
(
activeControl
instanceof
BaseEditor
)
{
actionItem
=
activeControl
.
getActionItem
(
action
);
}
// Check extensions
if
(
!
actionItem
)
{
actionItem
=
createActionItem
(
action
,
this
.
keybindingService
,
this
.
notificationService
,
this
.
contextMenuService
);
actionItem
=
createActionItem
(
action
,
this
.
keybindingService
,
this
.
notificationService
,
this
.
contextMenuService
)
||
null
;
}
return
actionItem
;
...
...
@@ -253,11 +253,11 @@ export abstract class TitleControl extends Themable {
// Set editor group as transfer
this
.
groupTransfer
.
setData
([
new
DraggedEditorGroupIdentifier
(
this
.
group
.
id
)],
DraggedEditorGroupIdentifier
.
prototype
);
e
.
dataTransfer
.
effectAllowed
=
'
copyMove
'
;
e
.
dataTransfer
!
.
effectAllowed
=
'
copyMove
'
;
// If tabs are disabled, treat dragging as if an editor tab was dragged
if
(
!
this
.
accessor
.
partOptions
.
showTabs
)
{
const
resource
=
t
oResource
(
this
.
group
.
activeEditor
,
{
supportSideBySide
:
true
})
;
const
resource
=
t
his
.
group
.
activeEditor
?
toResource
(
this
.
group
.
activeEditor
,
{
supportSideBySide
:
true
})
:
null
;
if
(
resource
)
{
this
.
instantiationService
.
invokeFunction
(
fillResourceDataTransfers
,
[
resource
],
e
);
}
...
...
@@ -316,10 +316,10 @@ export abstract class TitleControl extends Themable {
return
this
.
keybindingService
.
lookupKeybinding
(
action
.
id
);
}
protected
getKeybindingLabel
(
action
:
IAction
):
string
{
protected
getKeybindingLabel
(
action
:
IAction
):
string
|
undefined
{
const
keybinding
=
this
.
getKeybinding
(
action
);
return
keybinding
?
keybinding
.
getLabel
()
:
undefined
;
return
keybinding
?
keybinding
.
getLabel
()
||
undefined
:
undefined
;
}
abstract
openEditor
(
editor
:
IEditorInput
):
void
;
...
...
src/vs/workbench/browser/parts/panel/panelPart.ts
浏览文件 @
b7932c78
...
...
@@ -41,7 +41,7 @@ export const PanelFocusContext = new RawContextKey<boolean>('panelFocus', false)
interface
ICachedPanel
{
id
:
string
;
pinned
:
boolean
;
order
:
number
;
order
?
:
number
;
visible
:
boolean
;
}
...
...
@@ -243,7 +243,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService, IS
getPanels
():
PanelDescriptor
[]
{
return
Registry
.
as
<
PanelRegistry
>
(
PanelExtensions
.
Panels
).
getPanels
()
.
sort
((
v1
,
v2
)
=>
v1
.
order
-
v2
.
order
);
.
sort
((
v1
,
v2
)
=>
typeof
v1
.
order
===
'
number
'
&&
typeof
v2
.
order
===
'
number
'
?
v1
.
order
-
v2
.
order
:
NaN
);
}
getPinnedPanels
():
PanelDescriptor
[]
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录