Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
12215af8
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,发现更多精彩内容 >>
提交
12215af8
编写于
2月 17, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
notifications - change event names to follow conventions
上级
cce81b98
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
52 addition
and
52 deletion
+52
-52
src/vs/workbench/browser/parts/notifications/notificationsAlerts.ts
...kbench/browser/parts/notifications/notificationsAlerts.ts
+4
-4
src/vs/workbench/browser/parts/notifications/notificationsCenter.ts
...kbench/browser/parts/notifications/notificationsCenter.ts
+2
-2
src/vs/workbench/browser/parts/notifications/notificationsStatus.ts
...kbench/browser/parts/notifications/notificationsStatus.ts
+4
-4
src/vs/workbench/browser/parts/notifications/notificationsToasts.ts
...kbench/browser/parts/notifications/notificationsToasts.ts
+5
-5
src/vs/workbench/browser/parts/notifications/notificationsViewer.ts
...kbench/browser/parts/notifications/notificationsViewer.ts
+1
-1
src/vs/workbench/common/notifications.ts
src/vs/workbench/common/notifications.ts
+29
-29
src/vs/workbench/test/common/notifications.test.ts
src/vs/workbench/test/common/notifications.test.ts
+7
-7
未找到文件。
src/vs/workbench/browser/parts/notifications/notificationsAlerts.ts
浏览文件 @
12215af8
...
@@ -23,10 +23,10 @@ export class NotificationsAlerts extends Disposable {
...
@@ -23,10 +23,10 @@ export class NotificationsAlerts extends Disposable {
}
}
private
registerListeners
():
void
{
private
registerListeners
():
void
{
this
.
_register
(
this
.
model
.
onDid
NotificationChange
(
e
=>
this
.
onDidNotificationChange
(
e
)));
this
.
_register
(
this
.
model
.
onDid
ChangeNotification
(
e
=>
this
.
onDidChangeNotification
(
e
)));
}
}
private
onDid
NotificationChange
(
e
:
INotificationChangeEvent
):
void
{
private
onDid
ChangeNotification
(
e
:
INotificationChangeEvent
):
void
{
if
(
e
.
kind
===
NotificationChangeType
.
ADD
)
{
if
(
e
.
kind
===
NotificationChangeType
.
ADD
)
{
// ARIA alert for screen readers
// ARIA alert for screen readers
...
@@ -46,7 +46,7 @@ export class NotificationsAlerts extends Disposable {
...
@@ -46,7 +46,7 @@ export class NotificationsAlerts extends Disposable {
private
triggerAriaAlert
(
notifiation
:
INotificationViewItem
):
void
{
private
triggerAriaAlert
(
notifiation
:
INotificationViewItem
):
void
{
// Trigger the alert again whenever the label changes
// Trigger the alert again whenever the label changes
const
listener
=
notifiation
.
onDid
LabelChange
(
e
=>
{
const
listener
=
notifiation
.
onDid
ChangeLabel
(
e
=>
{
if
(
e
.
kind
===
NotificationViewItemLabelKind
.
MESSAGE
)
{
if
(
e
.
kind
===
NotificationViewItemLabelKind
.
MESSAGE
)
{
this
.
doTriggerAriaAlert
(
notifiation
);
this
.
doTriggerAriaAlert
(
notifiation
);
}
}
...
@@ -69,4 +69,4 @@ export class NotificationsAlerts extends Disposable {
...
@@ -69,4 +69,4 @@ export class NotificationsAlerts extends Disposable {
alert
(
alertText
);
alert
(
alertText
);
}
}
}
}
\ No newline at end of file
src/vs/workbench/browser/parts/notifications/notificationsCenter.ts
浏览文件 @
12215af8
...
@@ -58,7 +58,7 @@ export class NotificationsCenter extends Themable {
...
@@ -58,7 +58,7 @@ export class NotificationsCenter extends Themable {
}
}
private
registerListeners
():
void
{
private
registerListeners
():
void
{
this
.
_register
(
this
.
model
.
onDid
NotificationChange
(
e
=>
this
.
onDidNotificationChange
(
e
)));
this
.
_register
(
this
.
model
.
onDid
ChangeNotification
(
e
=>
this
.
onDidChangeNotification
(
e
)));
this
.
_register
(
this
.
layoutService
.
onLayout
(
dimension
=>
this
.
layout
(
dimension
)));
this
.
_register
(
this
.
layoutService
.
onLayout
(
dimension
=>
this
.
layout
(
dimension
)));
}
}
...
@@ -167,7 +167,7 @@ export class NotificationsCenter extends Themable {
...
@@ -167,7 +167,7 @@ export class NotificationsCenter extends Themable {
return
keybinding
?
keybinding
.
getLabel
()
:
null
;
return
keybinding
?
keybinding
.
getLabel
()
:
null
;
}
}
private
onDid
NotificationChange
(
e
:
INotificationChangeEvent
):
void
{
private
onDid
ChangeNotification
(
e
:
INotificationChangeEvent
):
void
{
if
(
!
this
.
_isVisible
)
{
if
(
!
this
.
_isVisible
)
{
return
;
// only if visible
return
;
// only if visible
}
}
...
...
src/vs/workbench/browser/parts/notifications/notificationsStatus.ts
浏览文件 @
12215af8
...
@@ -34,11 +34,11 @@ export class NotificationsStatus extends Disposable {
...
@@ -34,11 +34,11 @@ export class NotificationsStatus extends Disposable {
}
}
private
registerListeners
():
void
{
private
registerListeners
():
void
{
this
.
_register
(
this
.
model
.
onDid
NotificationChange
(
e
=>
this
.
onDidNotificationChange
(
e
)));
this
.
_register
(
this
.
model
.
onDid
ChangeNotification
(
e
=>
this
.
onDidChangeNotification
(
e
)));
this
.
_register
(
this
.
model
.
onDid
StatusMessageChange
(
e
=>
this
.
onDidStatusMessageChan
ge
(
e
)));
this
.
_register
(
this
.
model
.
onDid
ChangeStatusMessage
(
e
=>
this
.
onDidChangeStatusMessa
ge
(
e
)));
}
}
private
onDid
NotificationChange
(
e
:
INotificationChangeEvent
):
void
{
private
onDid
ChangeNotification
(
e
:
INotificationChangeEvent
):
void
{
if
(
this
.
isNotificationsCenterVisible
)
{
if
(
this
.
isNotificationsCenterVisible
)
{
return
;
// no change if notification center is visible
return
;
// no change if notification center is visible
}
}
...
@@ -101,7 +101,7 @@ export class NotificationsStatus extends Disposable {
...
@@ -101,7 +101,7 @@ export class NotificationsStatus extends Disposable {
}
}
}
}
private
onDid
StatusMessageChan
ge
(
e
:
IStatusMessageChangeEvent
):
void
{
private
onDid
ChangeStatusMessa
ge
(
e
:
IStatusMessageChangeEvent
):
void
{
const
statusItem
=
e
.
item
;
const
statusItem
=
e
.
item
;
switch
(
e
.
kind
)
{
switch
(
e
.
kind
)
{
...
...
src/vs/workbench/browser/parts/notifications/notificationsToasts.ts
浏览文件 @
12215af8
...
@@ -90,11 +90,11 @@ export class NotificationsToasts extends Themable {
...
@@ -90,11 +90,11 @@ export class NotificationsToasts extends Themable {
this
.
model
.
notifications
.
forEach
(
notification
=>
this
.
addToast
(
notification
));
this
.
model
.
notifications
.
forEach
(
notification
=>
this
.
addToast
(
notification
));
// Update toasts on notification changes
// Update toasts on notification changes
this
.
_register
(
this
.
model
.
onDid
NotificationChange
(
e
=>
this
.
onDidNotificationChange
(
e
)));
this
.
_register
(
this
.
model
.
onDid
ChangeNotification
(
e
=>
this
.
onDidChangeNotification
(
e
)));
});
});
// Filter
// Filter
this
.
_register
(
this
.
model
.
onDid
FilterChange
(
filter
=>
{
this
.
_register
(
this
.
model
.
onDid
ChangeFilter
(
filter
=>
{
if
(
filter
===
NotificationsFilter
.
SILENT
||
filter
===
NotificationsFilter
.
ERROR
)
{
if
(
filter
===
NotificationsFilter
.
SILENT
||
filter
===
NotificationsFilter
.
ERROR
)
{
this
.
hide
();
this
.
hide
();
}
}
...
@@ -114,7 +114,7 @@ export class NotificationsToasts extends Themable {
...
@@ -114,7 +114,7 @@ export class NotificationsToasts extends Themable {
]);
]);
}
}
private
onDid
NotificationChange
(
e
:
INotificationChangeEvent
):
void
{
private
onDid
ChangeNotification
(
e
:
INotificationChangeEvent
):
void
{
switch
(
e
.
kind
)
{
switch
(
e
.
kind
)
{
case
NotificationChangeType
.
ADD
:
case
NotificationChangeType
.
ADD
:
return
this
.
addToast
(
e
.
item
);
return
this
.
addToast
(
e
.
item
);
...
@@ -194,12 +194,12 @@ export class NotificationsToasts extends Themable {
...
@@ -194,12 +194,12 @@ export class NotificationsToasts extends Themable {
this
.
layoutContainer
(
maxDimensions
.
height
);
this
.
layoutContainer
(
maxDimensions
.
height
);
// Update when item height changes due to expansion
// Update when item height changes due to expansion
itemDisposables
.
add
(
item
.
onDid
ExpansionChange
(()
=>
{
itemDisposables
.
add
(
item
.
onDid
ChangeExpansion
(()
=>
{
notificationList
.
updateNotificationsList
(
0
,
1
,
[
item
]);
notificationList
.
updateNotificationsList
(
0
,
1
,
[
item
]);
}));
}));
// Update when item height potentially changes due to label changes
// Update when item height potentially changes due to label changes
itemDisposables
.
add
(
item
.
onDid
LabelChange
(
e
=>
{
itemDisposables
.
add
(
item
.
onDid
ChangeLabel
(
e
=>
{
if
(
!
item
.
expanded
)
{
if
(
!
item
.
expanded
)
{
return
;
// dynamic height only applies to expanded notifications
return
;
// dynamic height only applies to expanded notifications
}
}
...
...
src/vs/workbench/browser/parts/notifications/notificationsViewer.ts
浏览文件 @
12215af8
...
@@ -345,7 +345,7 @@ export class NotificationTemplateRenderer extends Disposable {
...
@@ -345,7 +345,7 @@ export class NotificationTemplateRenderer extends Disposable {
this
.
renderProgress
(
notification
);
this
.
renderProgress
(
notification
);
// Label Change Events
// Label Change Events
this
.
inputDisposables
.
add
(
notification
.
onDid
LabelChange
(
event
=>
{
this
.
inputDisposables
.
add
(
notification
.
onDid
ChangeLabel
(
event
=>
{
switch
(
event
.
kind
)
{
switch
(
event
.
kind
)
{
case
NotificationViewItemLabelKind
.
SEVERITY
:
case
NotificationViewItemLabelKind
.
SEVERITY
:
this
.
renderSeverity
(
notification
);
this
.
renderSeverity
(
notification
);
...
...
src/vs/workbench/common/notifications.ts
浏览文件 @
12215af8
...
@@ -20,8 +20,8 @@ export interface INotificationsModel {
...
@@ -20,8 +20,8 @@ export interface INotificationsModel {
readonly
notifications
:
INotificationViewItem
[];
readonly
notifications
:
INotificationViewItem
[];
readonly
onDid
NotificationChange
:
Event
<
INotificationChangeEvent
>
;
readonly
onDid
ChangeNotification
:
Event
<
INotificationChangeEvent
>
;
readonly
onDid
FilterChange
:
Event
<
NotificationsFilter
>
;
readonly
onDid
ChangeFilter
:
Event
<
NotificationsFilter
>
;
addNotification
(
notification
:
INotification
):
INotificationHandle
;
addNotification
(
notification
:
INotification
):
INotificationHandle
;
...
@@ -34,7 +34,7 @@ export interface INotificationsModel {
...
@@ -34,7 +34,7 @@ export interface INotificationsModel {
readonly
statusMessage
:
IStatusMessageViewItem
|
undefined
;
readonly
statusMessage
:
IStatusMessageViewItem
|
undefined
;
readonly
onDid
StatusMessageChan
ge
:
Event
<
IStatusMessageChangeEvent
>
;
readonly
onDid
ChangeStatusMessa
ge
:
Event
<
IStatusMessageChangeEvent
>
;
showStatusMessage
(
message
:
NotificationMessage
,
options
?:
IStatusMessageOptions
):
IDisposable
;
showStatusMessage
(
message
:
NotificationMessage
,
options
?:
IStatusMessageOptions
):
IDisposable
;
...
@@ -134,14 +134,14 @@ export class NotificationsModel extends Disposable implements INotificationsMode
...
@@ -134,14 +134,14 @@ export class NotificationsModel extends Disposable implements INotificationsMode
private
static
readonly
NO_OP_NOTIFICATION
=
new
NoOpNotification
();
private
static
readonly
NO_OP_NOTIFICATION
=
new
NoOpNotification
();
private
readonly
_onDid
NotificationChange
=
this
.
_register
(
new
Emitter
<
INotificationChangeEvent
>
());
private
readonly
_onDid
ChangeNotification
=
this
.
_register
(
new
Emitter
<
INotificationChangeEvent
>
());
readonly
onDid
NotificationChange
=
this
.
_onDidNotificationChange
.
event
;
readonly
onDid
ChangeNotification
=
this
.
_onDidChangeNotification
.
event
;
private
readonly
_onDid
StatusMessageChan
ge
=
this
.
_register
(
new
Emitter
<
IStatusMessageChangeEvent
>
());
private
readonly
_onDid
ChangeStatusMessa
ge
=
this
.
_register
(
new
Emitter
<
IStatusMessageChangeEvent
>
());
readonly
onDid
StatusMessageChange
=
this
.
_onDidStatusMessageChan
ge
.
event
;
readonly
onDid
ChangeStatusMessage
=
this
.
_onDidChangeStatusMessa
ge
.
event
;
private
readonly
_onDid
FilterChange
=
this
.
_register
(
new
Emitter
<
NotificationsFilter
>
());
private
readonly
_onDid
ChangeFilter
=
this
.
_register
(
new
Emitter
<
NotificationsFilter
>
());
readonly
onDid
FilterChange
=
this
.
_onDidFilterChange
.
event
;
readonly
onDid
ChangeFilter
=
this
.
_onDidChangeFilter
.
event
;
private
readonly
_notifications
:
INotificationViewItem
[]
=
[];
private
readonly
_notifications
:
INotificationViewItem
[]
=
[];
get
notifications
():
INotificationViewItem
[]
{
return
this
.
_notifications
;
}
get
notifications
():
INotificationViewItem
[]
{
return
this
.
_notifications
;
}
...
@@ -154,7 +154,7 @@ export class NotificationsModel extends Disposable implements INotificationsMode
...
@@ -154,7 +154,7 @@ export class NotificationsModel extends Disposable implements INotificationsMode
setFilter
(
filter
:
NotificationsFilter
):
void
{
setFilter
(
filter
:
NotificationsFilter
):
void
{
this
.
filter
=
filter
;
this
.
filter
=
filter
;
this
.
_onDid
FilterChange
.
fire
(
filter
);
this
.
_onDid
ChangeFilter
.
fire
(
filter
);
}
}
addNotification
(
notification
:
INotification
):
INotificationHandle
{
addNotification
(
notification
:
INotification
):
INotificationHandle
{
...
@@ -173,7 +173,7 @@ export class NotificationsModel extends Disposable implements INotificationsMode
...
@@ -173,7 +173,7 @@ export class NotificationsModel extends Disposable implements INotificationsMode
this
.
_notifications
.
splice
(
0
,
0
,
item
);
this
.
_notifications
.
splice
(
0
,
0
,
item
);
// Events
// Events
this
.
_onDid
NotificationChange
.
fire
({
item
,
index
:
0
,
kind
:
NotificationChangeType
.
ADD
});
this
.
_onDid
ChangeNotification
.
fire
({
item
,
index
:
0
,
kind
:
NotificationChangeType
.
ADD
});
// Wrap into handle
// Wrap into handle
return
new
NotificationHandle
(
item
,
item
=>
this
.
onClose
(
item
));
return
new
NotificationHandle
(
item
,
item
=>
this
.
onClose
(
item
));
...
@@ -202,13 +202,13 @@ export class NotificationsModel extends Disposable implements INotificationsMode
...
@@ -202,13 +202,13 @@ export class NotificationsModel extends Disposable implements INotificationsMode
const
onItemChangeEvent
=
()
=>
{
const
onItemChangeEvent
=
()
=>
{
const
index
=
this
.
_notifications
.
indexOf
(
item
);
const
index
=
this
.
_notifications
.
indexOf
(
item
);
if
(
index
>=
0
)
{
if
(
index
>=
0
)
{
this
.
_onDid
NotificationChange
.
fire
({
item
,
index
,
kind
:
NotificationChangeType
.
CHANGE
});
this
.
_onDid
ChangeNotification
.
fire
({
item
,
index
,
kind
:
NotificationChangeType
.
CHANGE
});
}
}
};
};
const
itemExpansionChangeListener
=
item
.
onDid
ExpansionChange
(()
=>
onItemChangeEvent
());
const
itemExpansionChangeListener
=
item
.
onDid
ChangeExpansion
(()
=>
onItemChangeEvent
());
const
itemLabelChangeListener
=
item
.
onDid
LabelChange
(
e
=>
{
const
itemLabelChangeListener
=
item
.
onDid
ChangeLabel
(
e
=>
{
// a label change in the area of actions or the message is a change that potentially has an impact
// a label change in the area of actions or the message is a change that potentially has an impact
// on the size of the notification and as such we emit a change event so that viewers can redraw
// on the size of the notification and as such we emit a change event so that viewers can redraw
if
(
e
.
kind
===
NotificationViewItemLabelKind
.
ACTIONS
||
e
.
kind
===
NotificationViewItemLabelKind
.
MESSAGE
)
{
if
(
e
.
kind
===
NotificationViewItemLabelKind
.
ACTIONS
||
e
.
kind
===
NotificationViewItemLabelKind
.
MESSAGE
)
{
...
@@ -223,7 +223,7 @@ export class NotificationsModel extends Disposable implements INotificationsMode
...
@@ -223,7 +223,7 @@ export class NotificationsModel extends Disposable implements INotificationsMode
const
index
=
this
.
_notifications
.
indexOf
(
item
);
const
index
=
this
.
_notifications
.
indexOf
(
item
);
if
(
index
>=
0
)
{
if
(
index
>=
0
)
{
this
.
_notifications
.
splice
(
index
,
1
);
this
.
_notifications
.
splice
(
index
,
1
);
this
.
_onDid
NotificationChange
.
fire
({
item
,
index
,
kind
:
NotificationChangeType
.
REMOVE
});
this
.
_onDid
ChangeNotification
.
fire
({
item
,
index
,
kind
:
NotificationChangeType
.
REMOVE
});
}
}
});
});
...
@@ -238,14 +238,14 @@ export class NotificationsModel extends Disposable implements INotificationsMode
...
@@ -238,14 +238,14 @@ export class NotificationsModel extends Disposable implements INotificationsMode
// Remember as current status message and fire events
// Remember as current status message and fire events
this
.
_statusMessage
=
item
;
this
.
_statusMessage
=
item
;
this
.
_onDid
StatusMessageChan
ge
.
fire
({
kind
:
StatusMessageChangeType
.
ADD
,
item
});
this
.
_onDid
ChangeStatusMessa
ge
.
fire
({
kind
:
StatusMessageChangeType
.
ADD
,
item
});
return
toDisposable
(()
=>
{
return
toDisposable
(()
=>
{
// Only reset status message if the item is still the one we had remembered
// Only reset status message if the item is still the one we had remembered
if
(
this
.
_statusMessage
===
item
)
{
if
(
this
.
_statusMessage
===
item
)
{
this
.
_statusMessage
=
undefined
;
this
.
_statusMessage
=
undefined
;
this
.
_onDid
StatusMessageChan
ge
.
fire
({
kind
:
StatusMessageChangeType
.
REMOVE
,
item
});
this
.
_onDid
ChangeStatusMessa
ge
.
fire
({
kind
:
StatusMessageChangeType
.
REMOVE
,
item
});
}
}
});
});
}
}
...
@@ -263,9 +263,9 @@ export interface INotificationViewItem {
...
@@ -263,9 +263,9 @@ export interface INotificationViewItem {
readonly
expanded
:
boolean
;
readonly
expanded
:
boolean
;
readonly
canCollapse
:
boolean
;
readonly
canCollapse
:
boolean
;
readonly
onDid
ExpansionChange
:
Event
<
void
>
;
readonly
onDid
ChangeExpansion
:
Event
<
void
>
;
readonly
onDidClose
:
Event
<
void
>
;
readonly
onDidClose
:
Event
<
void
>
;
readonly
onDid
LabelChange
:
Event
<
INotificationViewItemLabelChangeEvent
>
;
readonly
onDid
ChangeLabel
:
Event
<
INotificationViewItemLabelChangeEvent
>
;
expand
():
void
;
expand
():
void
;
collapse
(
skipEvents
?:
boolean
):
void
;
collapse
(
skipEvents
?:
boolean
):
void
;
...
@@ -410,14 +410,14 @@ export class NotificationViewItem extends Disposable implements INotificationVie
...
@@ -410,14 +410,14 @@ export class NotificationViewItem extends Disposable implements INotificationVie
private
_actions
:
INotificationActions
|
undefined
;
private
_actions
:
INotificationActions
|
undefined
;
private
_progress
:
NotificationViewItemProgress
|
undefined
;
private
_progress
:
NotificationViewItemProgress
|
undefined
;
private
readonly
_onDid
ExpansionChange
=
this
.
_register
(
new
Emitter
<
void
>
());
private
readonly
_onDid
ChangeExpansion
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onDid
ExpansionChange
=
this
.
_onDidExpansionChange
.
event
;
readonly
onDid
ChangeExpansion
=
this
.
_onDidChangeExpansion
.
event
;
private
readonly
_onDidClose
=
this
.
_register
(
new
Emitter
<
void
>
());
private
readonly
_onDidClose
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onDidClose
=
this
.
_onDidClose
.
event
;
readonly
onDidClose
=
this
.
_onDidClose
.
event
;
private
readonly
_onDid
LabelChange
=
this
.
_register
(
new
Emitter
<
INotificationViewItemLabelChangeEvent
>
());
private
readonly
_onDid
ChangeLabel
=
this
.
_register
(
new
Emitter
<
INotificationViewItemLabelChangeEvent
>
());
readonly
onDid
LabelChange
=
this
.
_onDidLabelChange
.
event
;
readonly
onDid
ChangeLabel
=
this
.
_onDidChangeLabel
.
event
;
static
create
(
notification
:
INotification
,
filter
:
NotificationsFilter
=
NotificationsFilter
.
OFF
):
INotificationViewItem
|
undefined
{
static
create
(
notification
:
INotification
,
filter
:
NotificationsFilter
=
NotificationsFilter
.
OFF
):
INotificationViewItem
|
undefined
{
if
(
!
notification
||
!
notification
.
message
||
isPromiseCanceledError
(
notification
.
message
))
{
if
(
!
notification
||
!
notification
.
message
||
isPromiseCanceledError
(
notification
.
message
))
{
...
@@ -566,7 +566,7 @@ export class NotificationViewItem extends Disposable implements INotificationVie
...
@@ -566,7 +566,7 @@ export class NotificationViewItem extends Disposable implements INotificationVie
get
progress
():
INotificationViewItemProgress
{
get
progress
():
INotificationViewItemProgress
{
if
(
!
this
.
_progress
)
{
if
(
!
this
.
_progress
)
{
this
.
_progress
=
this
.
_register
(
new
NotificationViewItemProgress
());
this
.
_progress
=
this
.
_register
(
new
NotificationViewItemProgress
());
this
.
_register
(
this
.
_progress
.
onDidChange
(()
=>
this
.
_onDid
LabelChange
.
fire
({
kind
:
NotificationViewItemLabelKind
.
PROGRESS
})));
this
.
_register
(
this
.
_progress
.
onDidChange
(()
=>
this
.
_onDid
ChangeLabel
.
fire
({
kind
:
NotificationViewItemLabelKind
.
PROGRESS
})));
}
}
return
this
.
_progress
;
return
this
.
_progress
;
...
@@ -586,7 +586,7 @@ export class NotificationViewItem extends Disposable implements INotificationVie
...
@@ -586,7 +586,7 @@ export class NotificationViewItem extends Disposable implements INotificationVie
updateSeverity
(
severity
:
Severity
):
void
{
updateSeverity
(
severity
:
Severity
):
void
{
this
.
_severity
=
severity
;
this
.
_severity
=
severity
;
this
.
_onDid
LabelChange
.
fire
({
kind
:
NotificationViewItemLabelKind
.
SEVERITY
});
this
.
_onDid
ChangeLabel
.
fire
({
kind
:
NotificationViewItemLabelKind
.
SEVERITY
});
}
}
updateMessage
(
input
:
NotificationMessage
):
void
{
updateMessage
(
input
:
NotificationMessage
):
void
{
...
@@ -596,13 +596,13 @@ export class NotificationViewItem extends Disposable implements INotificationVie
...
@@ -596,13 +596,13 @@ export class NotificationViewItem extends Disposable implements INotificationVie
}
}
this
.
_message
=
message
;
this
.
_message
=
message
;
this
.
_onDid
LabelChange
.
fire
({
kind
:
NotificationViewItemLabelKind
.
MESSAGE
});
this
.
_onDid
ChangeLabel
.
fire
({
kind
:
NotificationViewItemLabelKind
.
MESSAGE
});
}
}
updateActions
(
actions
?:
INotificationActions
):
void
{
updateActions
(
actions
?:
INotificationActions
):
void
{
this
.
setActions
(
actions
);
this
.
setActions
(
actions
);
this
.
_onDid
LabelChange
.
fire
({
kind
:
NotificationViewItemLabelKind
.
ACTIONS
});
this
.
_onDid
ChangeLabel
.
fire
({
kind
:
NotificationViewItemLabelKind
.
ACTIONS
});
}
}
expand
():
void
{
expand
():
void
{
...
@@ -611,7 +611,7 @@ export class NotificationViewItem extends Disposable implements INotificationVie
...
@@ -611,7 +611,7 @@ export class NotificationViewItem extends Disposable implements INotificationVie
}
}
this
.
_expanded
=
true
;
this
.
_expanded
=
true
;
this
.
_onDid
ExpansionChange
.
fire
();
this
.
_onDid
ChangeExpansion
.
fire
();
}
}
collapse
(
skipEvents
?:
boolean
):
void
{
collapse
(
skipEvents
?:
boolean
):
void
{
...
@@ -622,7 +622,7 @@ export class NotificationViewItem extends Disposable implements INotificationVie
...
@@ -622,7 +622,7 @@ export class NotificationViewItem extends Disposable implements INotificationVie
this
.
_expanded
=
false
;
this
.
_expanded
=
false
;
if
(
!
skipEvents
)
{
if
(
!
skipEvents
)
{
this
.
_onDid
ExpansionChange
.
fire
();
this
.
_onDid
ChangeExpansion
.
fire
();
}
}
}
}
...
...
src/vs/workbench/test/common/notifications.test.ts
浏览文件 @
12215af8
...
@@ -41,7 +41,7 @@ suite('Notifications', () => {
...
@@ -41,7 +41,7 @@ suite('Notifications', () => {
// Events
// Events
let
called
=
0
;
let
called
=
0
;
item1
.
onDid
ExpansionChange
(()
=>
{
item1
.
onDid
ChangeExpansion
(()
=>
{
called
++
;
called
++
;
});
});
...
@@ -53,7 +53,7 @@ suite('Notifications', () => {
...
@@ -53,7 +53,7 @@ suite('Notifications', () => {
assert
.
equal
(
called
,
2
);
assert
.
equal
(
called
,
2
);
called
=
0
;
called
=
0
;
item1
.
onDid
LabelChange
(
e
=>
{
item1
.
onDid
ChangeLabel
(
e
=>
{
if
(
e
.
kind
===
NotificationViewItemLabelKind
.
PROGRESS
)
{
if
(
e
.
kind
===
NotificationViewItemLabelKind
.
PROGRESS
)
{
called
++
;
called
++
;
}
}
...
@@ -65,7 +65,7 @@ suite('Notifications', () => {
...
@@ -65,7 +65,7 @@ suite('Notifications', () => {
assert
.
equal
(
called
,
2
);
assert
.
equal
(
called
,
2
);
called
=
0
;
called
=
0
;
item1
.
onDid
LabelChange
(
e
=>
{
item1
.
onDid
ChangeLabel
(
e
=>
{
if
(
e
.
kind
===
NotificationViewItemLabelKind
.
MESSAGE
)
{
if
(
e
.
kind
===
NotificationViewItemLabelKind
.
MESSAGE
)
{
called
++
;
called
++
;
}
}
...
@@ -74,7 +74,7 @@ suite('Notifications', () => {
...
@@ -74,7 +74,7 @@ suite('Notifications', () => {
item1
.
updateMessage
(
'
message update
'
);
item1
.
updateMessage
(
'
message update
'
);
called
=
0
;
called
=
0
;
item1
.
onDid
LabelChange
(
e
=>
{
item1
.
onDid
ChangeLabel
(
e
=>
{
if
(
e
.
kind
===
NotificationViewItemLabelKind
.
SEVERITY
)
{
if
(
e
.
kind
===
NotificationViewItemLabelKind
.
SEVERITY
)
{
called
++
;
called
++
;
}
}
...
@@ -83,7 +83,7 @@ suite('Notifications', () => {
...
@@ -83,7 +83,7 @@ suite('Notifications', () => {
item1
.
updateSeverity
(
Severity
.
Error
);
item1
.
updateSeverity
(
Severity
.
Error
);
called
=
0
;
called
=
0
;
item1
.
onDid
LabelChange
(
e
=>
{
item1
.
onDid
ChangeLabel
(
e
=>
{
if
(
e
.
kind
===
NotificationViewItemLabelKind
.
ACTIONS
)
{
if
(
e
.
kind
===
NotificationViewItemLabelKind
.
ACTIONS
)
{
called
++
;
called
++
;
}
}
...
@@ -146,12 +146,12 @@ suite('Notifications', () => {
...
@@ -146,12 +146,12 @@ suite('Notifications', () => {
const
model
=
new
NotificationsModel
();
const
model
=
new
NotificationsModel
();
let
lastNotificationEvent
!
:
INotificationChangeEvent
;
let
lastNotificationEvent
!
:
INotificationChangeEvent
;
model
.
onDid
NotificationChange
(
e
=>
{
model
.
onDid
ChangeNotification
(
e
=>
{
lastNotificationEvent
=
e
;
lastNotificationEvent
=
e
;
});
});
let
lastStatusMessageEvent
!
:
IStatusMessageChangeEvent
;
let
lastStatusMessageEvent
!
:
IStatusMessageChangeEvent
;
model
.
onDid
StatusMessageChan
ge
(
e
=>
{
model
.
onDid
ChangeStatusMessa
ge
(
e
=>
{
lastStatusMessageEvent
=
e
;
lastStatusMessageEvent
=
e
;
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录