Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
9a3b1b4a
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
9a3b1b4a
编写于
2月 15, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
notifications - first cut keybindings support with commands
上级
4eb771bf
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
250 addition
and
43 deletion
+250
-43
src/vs/workbench/browser/parts/notifications/media/notificationsActions.css
...rowser/parts/notifications/media/notificationsActions.css
+3
-3
src/vs/workbench/browser/parts/notifications/notificationCommands.ts
...bench/browser/parts/notifications/notificationCommands.ts
+149
-10
src/vs/workbench/browser/parts/notifications/notificationsActions.ts
...bench/browser/parts/notifications/notificationsActions.ts
+16
-11
src/vs/workbench/browser/parts/notifications/notificationsCenter.ts
...kbench/browser/parts/notifications/notificationsCenter.ts
+55
-11
src/vs/workbench/browser/parts/notifications/notificationsViewer.ts
...kbench/browser/parts/notifications/notificationsViewer.ts
+14
-6
src/vs/workbench/common/notifications.ts
src/vs/workbench/common/notifications.ts
+12
-0
src/vs/workbench/parts/feedback/electron-browser/feedback.ts
src/vs/workbench/parts/feedback/electron-browser/feedback.ts
+1
-1
src/vs/workbench/parts/feedback/electron-browser/media/feedback.css
...kbench/parts/feedback/electron-browser/media/feedback.css
+0
-1
未找到文件。
src/vs/workbench/browser/parts/notifications/media/notificationsActions.css
浏览文件 @
9a3b1b4a
...
...
@@ -3,12 +3,12 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.vs
.monaco-workbench
>
.notifications-list-container
.notification-list-item
.notification-list-item-toolbar-container
.cl
ose
-notification-action
{
.vs
.monaco-workbench
>
.notifications-list-container
.notification-list-item
.notification-list-item-toolbar-container
.cl
ear
-notification-action
{
background-image
:
url('close.svg')
;
}
.vs-dark
.monaco-workbench
>
.notifications-list-container
.notification-list-item
.notification-list-item-toolbar-container
.cl
ose
-notification-action
,
.hc-black
.monaco-workbench
>
.notifications-list-container
.notification-list-item
.notification-list-item-toolbar-container
.cl
ose
-notification-action
{
.vs-dark
.monaco-workbench
>
.notifications-list-container
.notification-list-item
.notification-list-item-toolbar-container
.cl
ear
-notification-action
,
.hc-black
.monaco-workbench
>
.notifications-list-container
.notification-list-item
.notification-list-item-toolbar-container
.cl
ear
-notification-action
{
background-image
:
url('close-inverse.svg')
;
}
...
...
src/vs/workbench/browser/parts/notifications/notificationCommands.ts
浏览文件 @
9a3b1b4a
...
...
@@ -7,28 +7,167 @@
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
RawContextKey
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
KeyCode
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
INotificationViewItem
,
isNotificationViewItem
}
from
'
vs/workbench/common/notifications
'
;
import
{
MenuRegistry
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
export
const
SHOW_NOTFICATIONS_CENTER_COMMAND_ID
=
'
notificationsCenter.show
'
;
export
const
HIDE_NOTFICATIONS_CENTER_COMMAND_ID
=
'
notificationsCenter.hide
'
;
export
const
TOGGLE_NOTFICATIONS_CENTER_COMMAND_ID
=
'
notificationsCenter.toggle
'
;
export
const
SHOW_NOTFICATIONS_CENTER_COMMAND_ID
=
'
notifications.show
'
;
export
const
HIDE_NOTFICATIONS_CENTER_COMMAND_ID
=
'
notifications.hide
'
;
export
const
TOGGLE_NOTFICATIONS_CENTER_COMMAND_ID
=
'
notifications.toggle
'
;
export
const
COLLAPSE_NOTIFICATION
=
'
notification.collapse
'
;
export
const
EXPAND_NOTIFICATION
=
'
notification.expand
'
;
export
const
TOGGLE_NOTIFICATION
=
'
notification.toggle
'
;
export
const
CLEAR_NOTFICATION
=
'
notification.clear
'
;
export
const
CLEAR_ALL_NOTFICATIONS
=
'
notifications.clearAll
'
;
const
notificationsCenterFocusedId
=
'
notificationsCenterFocus
'
;
export
const
NotificationsCenterFocusedContext
=
new
RawContextKey
<
boolean
>
(
notificationsCenterFocusedId
,
true
);
const
notificationsCenterVisibleId
=
'
notificationsCenterVisible
'
;
export
const
NotificationsCenterVisibleContext
=
new
RawContextKey
<
boolean
>
(
notificationsCenterVisibleId
,
false
);
export
const
InNotificationsCenterContext
=
ContextKeyExpr
.
and
(
ContextKeyExpr
.
has
(
notificationsCenterFocusedId
),
ContextKeyExpr
.
has
(
notificationsCenterVisibleId
));
export
interface
INotificationsCenterController
{
isVisible
:
boolean
;
readonly
isVisible
:
boolean
;
readonly
selected
:
INotificationViewItem
;
show
():
void
;
hide
():
void
;
clearAll
():
void
;
}
export
function
registerNotificationCommands
(
center
:
INotificationsCenterController
):
void
{
// Show Center
CommandsRegistry
.
registerCommand
(
SHOW_NOTFICATIONS_CENTER_COMMAND_ID
,
()
=>
center
.
show
());
function
showCenter
():
void
{
center
.
show
();
}
function
hideCenter
(
accessor
:
ServicesAccessor
):
void
{
// Hide center
center
.
hide
();
// Restore focus if we got an editor
const
editor
=
accessor
.
get
(
IWorkbenchEditorService
).
getActiveEditor
();
if
(
editor
)
{
editor
.
focus
();
}
}
// Show Notifications Cneter
CommandsRegistry
.
registerCommand
(
SHOW_NOTFICATIONS_CENTER_COMMAND_ID
,
()
=>
showCenter
());
// Hide Notifications Center
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
HIDE_NOTFICATIONS_CENTER_COMMAND_ID
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
InNotificationsCenterContext
,
primary
:
KeyCode
.
Escape
,
handler
:
accessor
=>
hideCenter
(
accessor
)
});
// Toggle Notifications Center
CommandsRegistry
.
registerCommand
(
TOGGLE_NOTFICATIONS_CENTER_COMMAND_ID
,
accessor
=>
center
.
isVisible
?
hideCenter
(
accessor
)
:
showCenter
());
// Clear Notification
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
CLEAR_NOTFICATION
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
InNotificationsCenterContext
,
primary
:
KeyCode
.
Delete
,
mac
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
Backspace
},
handler
:
(
accessor
,
args
?:
any
)
=>
{
let
notification
:
INotificationViewItem
;
if
(
isNotificationViewItem
(
args
))
{
notification
=
args
;
}
else
{
notification
=
center
.
selected
;
}
if
(
notification
)
{
notification
.
dispose
();
}
}
});
// Expand Notification
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
EXPAND_NOTIFICATION
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
InNotificationsCenterContext
,
primary
:
KeyCode
.
RightArrow
,
handler
:
(
accessor
,
args
?:
any
)
=>
{
let
notification
:
INotificationViewItem
;
if
(
isNotificationViewItem
(
args
))
{
notification
=
args
;
}
else
{
notification
=
center
.
selected
;
}
if
(
notification
)
{
notification
.
expand
();
}
}
});
// Collapse Notification
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
COLLAPSE_NOTIFICATION
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
InNotificationsCenterContext
,
primary
:
KeyCode
.
LeftArrow
,
handler
:
(
accessor
,
args
?:
any
)
=>
{
let
notification
:
INotificationViewItem
;
if
(
isNotificationViewItem
(
args
))
{
notification
=
args
;
}
else
{
notification
=
center
.
selected
;
}
if
(
notification
)
{
notification
.
collapse
();
}
}
});
// Toggle Notification
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
TOGGLE_NOTIFICATION
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
InNotificationsCenterContext
,
primary
:
KeyCode
.
Space
,
handler
:
accessor
=>
{
const
notification
=
center
.
selected
;
if
(
notification
)
{
if
(
notification
.
expanded
)
{
notification
.
collapse
();
}
else
{
notification
.
expand
();
}
}
}
});
/// Clear All Notifications
CommandsRegistry
.
registerCommand
(
CLEAR_ALL_NOTFICATIONS
,
()
=>
center
.
clearAll
());
// Commands for Command Palette
const
category
=
localize
(
'
notifications
'
,
"
Notifications
"
);
MenuRegistry
.
appendMenuItem
(
MenuId
.
CommandPalette
,
{
command
:
{
id
:
SHOW_NOTFICATIONS_CENTER_COMMAND_ID
,
title
:
localize
(
'
showNotifications
'
,
"
Show Notifications
"
),
category
},
when
:
NotificationsCenterVisibleContext
.
toNegated
()
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
CommandPalette
,
{
command
:
{
id
:
HIDE_NOTFICATIONS_CENTER_COMMAND_ID
,
title
:
localize
(
'
hideNotifications
'
,
"
Hide Notifications
"
),
category
},
when
:
NotificationsCenterVisibleContext
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
CommandPalette
,
{
command
:
{
id
:
CLEAR_ALL_NOTFICATIONS
,
title
:
localize
(
'
clearAllNotifications
'
,
"
Clear All Notifications
"
),
category
}
});
// Hide Center
CommandsRegistry
.
registerCommand
(
HIDE_NOTFICATIONS_CENTER_COMMAND_ID
,
()
=>
center
.
hide
());
// Toggle Center
CommandsRegistry
.
registerCommand
(
TOGGLE_NOTFICATIONS_CENTER_COMMAND_ID
,
()
=>
center
.
isVisible
?
center
.
hide
()
:
center
.
show
());
// TODO@Notification remove me
CommandsRegistry
.
registerCommand
(
'
notifications.showInfo
'
,
accessor
=>
{
...
...
src/vs/workbench/browser/parts/notifications/notificationsActions.ts
浏览文件 @
9a3b1b4a
...
...
@@ -12,21 +12,24 @@ import { Action, IAction, ActionRunner } from 'vs/base/common/actions';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
CLEAR_NOTFICATION
,
EXPAND_NOTIFICATION
,
COLLAPSE_NOTIFICATION
}
from
'
vs/workbench/browser/parts/notifications/notificationCommands
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
export
class
Cl
ose
NotificationAction
extends
Action
{
export
class
Cl
ear
NotificationAction
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.closeNotification
'
;
public
static
readonly
ID
=
CLEAR_NOTFICATION
;
public
static
readonly
LABEL
=
localize
(
'
closeNotification
'
,
"
Close Notification
"
);
constructor
(
id
:
string
,
label
:
string
label
:
string
,
@
ICommandService
private
commandService
:
ICommandService
)
{
super
(
id
,
label
,
'
cl
ose
-notification-action
'
);
super
(
id
,
label
,
'
cl
ear
-notification-action
'
);
}
public
run
(
notification
:
INotificationViewItem
):
TPromise
<
any
>
{
notification
.
dispose
(
);
this
.
commandService
.
executeCommand
(
CLEAR_NOTFICATION
,
notification
);
return
TPromise
.
as
(
void
0
);
}
...
...
@@ -34,18 +37,19 @@ export class CloseNotificationAction extends Action {
export
class
ExpandNotificationAction
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.expandNotification
'
;
public
static
readonly
ID
=
EXPAND_NOTIFICATION
;
public
static
readonly
LABEL
=
localize
(
'
expandNotification
'
,
"
Expand Notification
"
);
constructor
(
id
:
string
,
label
:
string
label
:
string
,
@
ICommandService
private
commandService
:
ICommandService
)
{
super
(
id
,
label
,
'
expand-notification-action
'
);
}
public
run
(
notification
:
INotificationViewItem
):
TPromise
<
any
>
{
notification
.
expand
(
);
this
.
commandService
.
executeCommand
(
EXPAND_NOTIFICATION
,
notification
);
return
TPromise
.
as
(
void
0
);
}
...
...
@@ -53,18 +57,19 @@ export class ExpandNotificationAction extends Action {
export
class
CollapseNotificationAction
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.collapseNotification
'
;
public
static
readonly
ID
=
COLLAPSE_NOTIFICATION
;
public
static
readonly
LABEL
=
localize
(
'
collapseNotification
'
,
"
Collapse Notification
"
);
constructor
(
id
:
string
,
label
:
string
label
:
string
,
@
ICommandService
private
commandService
:
ICommandService
)
{
super
(
id
,
label
,
'
collapse-notification-action
'
);
}
public
run
(
notification
:
INotificationViewItem
):
TPromise
<
any
>
{
notification
.
collapse
(
);
this
.
commandService
.
executeCommand
(
COLLAPSE_NOTIFICATION
,
notification
);
return
TPromise
.
as
(
void
0
);
}
...
...
src/vs/workbench/browser/parts/notifications/notificationsCenter.ts
浏览文件 @
9a3b1b4a
...
...
@@ -20,6 +20,8 @@ import { NotificationActionRunner } from 'vs/workbench/browser/parts/notificatio
import
{
Dimension
}
from
'
vs/base/browser/builder
'
;
import
{
IPartService
,
Parts
}
from
'
vs/workbench/services/part/common/partService
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
NotificationsCenterFocusedContext
,
NotificationsCenterVisibleContext
}
from
'
vs/workbench/browser/parts/notifications/notificationCommands
'
;
export
class
NotificationsCenter
extends
Themable
{
...
...
@@ -31,19 +33,23 @@ export class NotificationsCenter extends Themable {
private
_isVisible
:
boolean
;
private
workbenchDimensions
:
Dimension
;
private
_onDidChangeVisibility
:
Emitter
<
void
>
;
private
notificationsCenterVisibleContextKey
:
IContextKey
<
boolean
>
;
constructor
(
private
container
:
HTMLElement
,
private
model
:
INotificationsModel
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IThemeService
themeService
:
IThemeService
,
@
IPartService
private
partService
:
IPartService
@
IPartService
private
partService
:
IPartService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
)
{
super
(
themeService
);
this
.
_onDidChangeVisibility
=
new
Emitter
<
void
>
();
this
.
toUnbind
.
push
(
this
.
_onDidChangeVisibility
);
this
.
notificationsCenterVisibleContextKey
=
NotificationsCenterVisibleContext
.
bindTo
(
contextKeyService
);
this
.
viewModel
=
[];
this
.
registerListeners
();
}
...
...
@@ -56,6 +62,16 @@ export class NotificationsCenter extends Themable {
return
this
.
_isVisible
;
}
public
get
selected
():
INotificationViewItem
{
if
(
!
this
.
_isVisible
||
!
this
.
list
)
{
return
null
;
}
const
focusedIndex
=
this
.
list
.
getFocus
()[
0
];
return
this
.
viewModel
[
focusedIndex
];
}
private
registerListeners
():
void
{
this
.
toUnbind
.
push
(
this
.
model
.
onDidNotificationChange
(
e
=>
this
.
onDidNotificationChange
(
e
)));
}
...
...
@@ -82,6 +98,9 @@ export class NotificationsCenter extends Themable {
// Focus
this
.
focusNotificationsList
();
// Context Key
this
.
notificationsCenterVisibleContextKey
.
set
(
true
);
// Event
this
.
_onDidChangeVisibility
.
fire
();
}
...
...
@@ -92,10 +111,6 @@ export class NotificationsCenter extends Themable {
}
this
.
list
.
domFocus
();
if
(
this
.
list
.
getFocus
().
length
===
0
)
{
this
.
list
.
focusFirst
();
}
}
private
createNotificationsList
():
void
{
...
...
@@ -120,6 +135,9 @@ export class NotificationsCenter extends Themable {
);
this
.
toUnbind
.
push
(
this
.
list
);
// Context key
NotificationsCenterFocusedContext
.
bindTo
(
this
.
list
.
contextKeyService
);
// Only allow for focus in notifications, as the
// selection is too strong over the contents of
// the notification
...
...
@@ -165,7 +183,8 @@ export class NotificationsCenter extends Themable {
private
updateNotificationsList
(
start
:
number
,
deleteCount
:
number
,
items
:
INotificationViewItem
[]
=
[])
{
// Remember focus
const
focus
=
this
.
indexToItems
(
this
.
list
.
getFocus
());
const
focusedIndex
=
this
.
list
.
getFocus
()[
0
];
const
focusedItem
=
this
.
viewModel
[
focusedIndex
];
// Update view model
this
.
viewModel
.
splice
(
start
,
deleteCount
,
...
items
);
...
...
@@ -181,15 +200,26 @@ export class NotificationsCenter extends Themable {
// Otherwise restore focus
else
{
this
.
list
.
setFocus
(
focus
.
map
(
f
=>
this
.
viewModel
.
indexOf
(
f
)));
let
indexToFocus
=
0
;
if
(
focusedItem
)
{
let
indexToFocusCandidate
=
this
.
viewModel
.
indexOf
(
focusedItem
);
if
(
indexToFocusCandidate
===
-
1
)
{
indexToFocusCandidate
=
focusedIndex
-
1
;
// item could have been removed
}
if
(
indexToFocusCandidate
<
this
.
viewModel
.
length
&&
indexToFocusCandidate
>=
0
)
{
indexToFocus
=
indexToFocusCandidate
;
}
}
private
indexToItems
(
indeces
:
number
[]):
INotificationViewItem
[]
{
return
indeces
.
map
(
index
=>
this
.
viewModel
[
index
]).
filter
(
item
=>
!!
item
);
this
.
list
.
setFocus
([
indexToFocus
]);
}
}
public
hide
():
void
{
if
(
!
this
.
_isVisible
||
!
this
.
list
)
{
return
;
// already hidden
}
// Hide
this
.
_isVisible
=
false
;
...
...
@@ -201,6 +231,9 @@ export class NotificationsCenter extends Themable {
// Clear view model
this
.
viewModel
=
[];
// Context Key
this
.
notificationsCenterVisibleContextKey
.
set
(
false
);
// Event
this
.
_onDidChangeVisibility
.
fire
();
}
...
...
@@ -264,6 +297,17 @@ export class NotificationsCenter extends Themable {
this
.
list
.
getHTMLElement
().
style
.
maxHeight
=
`
${
maxHeight
}
px`
;
this
.
list
.
layout
();
}
public
clearAll
():
void
{
// Hide notifications center first
this
.
hide
();
// Dispose all
while
(
this
.
model
.
notifications
.
length
)
{
this
.
model
.
notifications
[
0
].
dispose
();
}
}
}
registerThemingParticipant
((
theme
:
ITheme
,
collector
:
ICssStyleCollector
)
=>
{
...
...
src/vs/workbench/browser/parts/notifications/notificationsViewer.ts
浏览文件 @
9a3b1b4a
...
...
@@ -24,7 +24,8 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
DropdownMenuActionItem
}
from
'
vs/base/browser/ui/dropdown/dropdown
'
;
import
{
INotificationViewItem
,
NotificationViewItem
}
from
'
vs/workbench/common/notifications
'
;
import
{
CloseNotificationAction
,
ExpandNotificationAction
,
CollapseNotificationAction
,
DoNotShowNotificationAgainAction
,
ConfigureNotificationAction
}
from
'
vs/workbench/browser/parts/notifications/notificationsActions
'
;
import
{
ClearNotificationAction
,
ExpandNotificationAction
,
CollapseNotificationAction
,
DoNotShowNotificationAgainAction
,
ConfigureNotificationAction
}
from
'
vs/workbench/browser/parts/notifications/notificationsActions
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
export
class
NotificationsListDelegate
implements
IDelegate
<
INotificationViewItem
>
{
...
...
@@ -143,7 +144,7 @@ export class NotificationRenderer implements IRenderer<INotificationViewItem, IN
private
toDispose
:
IDisposable
[];
private
closeNotificationAction
:
Cl
ose
NotificationAction
;
private
closeNotificationAction
:
Cl
ear
NotificationAction
;
private
expandNotificationAction
:
ExpandNotificationAction
;
private
collapseNotificationAction
:
CollapseNotificationAction
;
private
doNotShowNotificationAgainAction
:
DoNotShowNotificationAgainAction
;
...
...
@@ -153,11 +154,12 @@ export class NotificationRenderer implements IRenderer<INotificationViewItem, IN
@
IOpenerService
private
openerService
:
IOpenerService
,
@
IThemeService
private
themeService
:
IThemeService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
,
@
IKeybindingService
private
keybindingService
:
IKeybindingService
)
{
this
.
toDispose
=
[];
this
.
closeNotificationAction
=
instantiationService
.
createInstance
(
Cl
oseNotificationAction
,
CloseNotificationAction
.
ID
,
Close
NotificationAction
.
LABEL
);
this
.
closeNotificationAction
=
instantiationService
.
createInstance
(
Cl
earNotificationAction
,
ClearNotificationAction
.
ID
,
Clear
NotificationAction
.
LABEL
);
this
.
expandNotificationAction
=
instantiationService
.
createInstance
(
ExpandNotificationAction
,
ExpandNotificationAction
.
ID
,
ExpandNotificationAction
.
LABEL
);
this
.
collapseNotificationAction
=
instantiationService
.
createInstance
(
CollapseNotificationAction
,
CollapseNotificationAction
.
ID
,
CollapseNotificationAction
.
LABEL
);
this
.
doNotShowNotificationAgainAction
=
this
.
instantiationService
.
createInstance
(
DoNotShowNotificationAgainAction
,
DoNotShowNotificationAgainAction
.
ID
,
DoNotShowNotificationAgainAction
.
LABEL
);
...
...
@@ -206,7 +208,7 @@ export class NotificationRenderer implements IRenderer<INotificationViewItem, IN
return
null
;
}
}
,
}
);
// Details Row
...
...
@@ -288,7 +290,7 @@ export class NotificationRenderer implements IRenderer<INotificationViewItem, IN
// Toolbar
data
.
toolbar
.
clear
();
data
.
toolbar
.
context
=
notification
;
data
.
toolbar
.
push
(
actions
,
{
icon
:
true
,
label
:
false
}
);
actions
.
forEach
(
action
=>
data
.
toolbar
.
push
(
action
,
{
icon
:
true
,
label
:
false
,
keybinding
:
this
.
getKeybindingLabel
(
action
)
})
);
// Source
if
(
notification
.
expanded
&&
notification
.
source
)
{
...
...
@@ -304,6 +306,12 @@ export class NotificationRenderer implements IRenderer<INotificationViewItem, IN
}
}
private
getKeybindingLabel
(
action
:
IAction
):
string
{
const
keybinding
=
this
.
keybindingService
.
lookupKeybinding
(
action
.
id
);
return
keybinding
?
keybinding
.
getLabel
()
:
void
0
;
}
private
createButton
(
notification
:
INotificationViewItem
,
action
:
IAction
,
data
:
INotificationTemplateData
):
Button
{
const
button
=
new
Button
(
data
.
actionsContainer
);
data
.
toDispose
.
push
(
attachButtonStyler
(
button
,
this
.
themeService
));
...
...
src/vs/workbench/common/notifications.ts
浏览文件 @
9a3b1b4a
...
...
@@ -128,6 +128,10 @@ export interface INotificationViewItem {
dispose
():
void
;
}
export
function
isNotificationViewItem
(
obj
:
any
):
obj
is
INotificationViewItem
{
return
obj
instanceof
NotificationViewItem
;
}
export
class
NotificationViewItem
implements
INotificationViewItem
{
private
static
MAX_MESSAGE_LENGTH
=
1000
;
...
...
@@ -216,11 +220,19 @@ export class NotificationViewItem implements INotificationViewItem {
}
public
expand
():
void
{
if
(
this
.
_expanded
)
{
return
;
}
this
.
_expanded
=
true
;
this
.
_onDidChange
.
fire
();
}
public
collapse
():
void
{
if
(
!
this
.
_expanded
||
!
this
.
canCollapse
)
{
return
;
}
this
.
_expanded
=
false
;
this
.
_onDidChange
.
fire
();
}
...
...
src/vs/workbench/parts/feedback/electron-browser/feedback.ts
浏览文件 @
9a3b1b4a
...
...
@@ -224,7 +224,7 @@ export class FeedbackDropdown extends Dropdown {
this
.
toDispose
.
push
(
attachStylerCallback
(
this
.
themeService
,
{
widgetShadow
,
editorWidgetBackground
,
inputBackground
,
inputForeground
,
inputBorder
,
editorBackground
,
contrastBorder
},
colors
=>
{
$form
.
style
(
'
background-color
'
,
colors
.
editorWidgetBackground
);
$form
.
style
(
'
box-shadow
'
,
colors
.
widgetShadow
?
`0
2
px 8px
${
colors
.
widgetShadow
}
`
:
null
);
$form
.
style
(
'
box-shadow
'
,
colors
.
widgetShadow
?
`0
5
px 8px
${
colors
.
widgetShadow
}
`
:
null
);
if
(
this
.
feedbackDescriptionInput
)
{
this
.
feedbackDescriptionInput
.
style
.
backgroundColor
=
colors
.
inputBackground
;
...
...
src/vs/workbench/parts/feedback/electron-browser/media/feedback.css
浏览文件 @
9a3b1b4a
...
...
@@ -88,7 +88,6 @@
position
:
absolute
;
top
:
0
;
right
:
0
;
margin
:
.5em
0
0
0
;
padding
:
.5em
;
width
:
22px
;
height
:
22px
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录