Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a10fc279
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,发现更多精彩内容 >>
提交
a10fc279
编写于
2月 12, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
notifications - scaffold a notification service
上级
7410a0ea
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
115 addition
and
3 deletion
+115
-3
src/vs/editor/standalone/browser/simpleServices.ts
src/vs/editor/standalone/browser/simpleServices.ts
+25
-0
src/vs/editor/standalone/browser/standaloneServices.ts
src/vs/editor/standalone/browser/standaloneServices.ts
+4
-1
src/vs/platform/notification/common/notification.ts
src/vs/platform/notification/common/notification.ts
+28
-0
src/vs/workbench/electron-browser/actions.ts
src/vs/workbench/electron-browser/actions.ts
+5
-2
src/vs/workbench/electron-browser/shell.ts
src/vs/workbench/electron-browser/shell.ts
+4
-0
src/vs/workbench/services/notification/browser/notificationList.ts
...rkbench/services/notification/browser/notificationList.ts
+20
-0
src/vs/workbench/services/notification/browser/notificationService.ts
...ench/services/notification/browser/notificationService.ts
+29
-0
未找到文件。
src/vs/editor/standalone/browser/simpleServices.ts
浏览文件 @
a10fc279
...
...
@@ -39,6 +39,7 @@ import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKe
import
{
OS
}
from
'
vs/base/common/platform
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
INotificationService
,
INotification
}
from
'
vs/platform/notification/common/notification
'
;
export
class
SimpleEditor
implements
IEditor
{
...
...
@@ -280,6 +281,30 @@ export class SimpleMessageService implements IMessageService {
}
}
export
class
SimpleNotificationService
implements
INotificationService
{
public
_serviceBrand
:
any
;
private
static
readonly
Empty
:
INotification
=
{
dispose
:
()
=>
undefined
};
public
notify
(
sev
:
Severity
,
message
:
string
):
INotification
{
switch
(
sev
)
{
case
Severity
.
Error
:
console
.
error
(
message
);
break
;
case
Severity
.
Warning
:
console
.
warn
(
message
);
break
;
default
:
console
.
log
(
message
);
break
;
}
return
SimpleNotificationService
.
Empty
;
}
}
export
class
StandaloneCommandService
implements
ICommandService
{
_serviceBrand
:
any
;
...
...
src/vs/editor/standalone/browser/standaloneServices.ts
浏览文件 @
a10fc279
...
...
@@ -33,7 +33,7 @@ import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
import
{
CodeEditorServiceImpl
}
from
'
vs/editor/browser/services/codeEditorServiceImpl
'
;
import
{
SimpleConfigurationService
,
SimpleResourceConfigurationService
,
SimpleMenuService
,
SimpleMessageService
,
SimpleProgressService
,
StandaloneCommandService
,
StandaloneKeybindingService
,
SimpleProgressService
,
StandaloneCommandService
,
StandaloneKeybindingService
,
SimpleNotificationService
,
StandaloneTelemetryService
,
SimpleWorkspaceContextService
}
from
'
vs/editor/standalone/browser/simpleServices
'
;
import
{
ContextKeyService
}
from
'
vs/platform/contextkey/browser/contextKeyService
'
;
...
...
@@ -41,6 +41,7 @@ import { IMenuService } from 'vs/platform/actions/common/actions';
import
{
IStandaloneThemeService
}
from
'
vs/editor/standalone/common/standaloneThemeService
'
;
import
{
StandaloneThemeServiceImpl
}
from
'
vs/editor/standalone/browser/standaloneThemeServiceImpl
'
;
import
{
ILogService
,
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
export
interface
IEditorContextViewService
extends
IContextViewService
{
dispose
():
void
;
...
...
@@ -127,6 +128,8 @@ export module StaticServices {
export
const
messageService
=
define
(
IMessageService
,
()
=>
new
SimpleMessageService
());
export
const
notificationService
=
define
(
INotificationService
,
()
=>
new
SimpleNotificationService
());
export
const
markerService
=
define
(
IMarkerService
,
()
=>
new
MarkerService
());
export
const
modeService
=
define
(
IModeService
,
(
o
)
=>
new
ModeServiceImpl
());
...
...
src/vs/platform/notification/common/notification.ts
0 → 100644
浏览文件 @
a10fc279
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
export
const
INotificationService
=
createDecorator
<
INotificationService
>
(
'
notificationService
'
);
export
interface
INotification
extends
IDisposable
{
}
export
interface
INotificationService
{
_serviceBrand
:
any
;
notify
(
sev
:
Severity
,
message
:
string
):
INotification
;
// notify(sev: Severity, message: Error): () => void;
// notify(sev: Severity, message: string[]): () => void;
// notify(sev: Severity, message: Error[]): () => void;
// notify(sev: Severity, message: IMessageWithAction): () => void;
}
\ No newline at end of file
src/vs/workbench/electron-browser/actions.ts
浏览文件 @
a10fc279
...
...
@@ -51,6 +51,7 @@ import { getDomNodePagePosition, createStyleSheet, createCSSRule } from 'vs/base
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
Context
}
from
'
vs/platform/contextkey/browser/contextKeyService
'
;
import
{
IWorkbenchIssueService
}
from
'
vs/workbench/services/issue/common/issue
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
// --- actions
...
...
@@ -1571,13 +1572,15 @@ export class ShowAboutDialogAction extends Action {
constructor
(
id
:
string
,
label
:
string
,
@
I
WindowsService
private
windowsService
:
IWindows
Service
@
I
NotificationService
private
notificationService
:
INotification
Service
)
{
super
(
id
,
label
);
}
run
():
TPromise
<
void
>
{
return
this
.
windowsService
.
openAboutDialog
();
this
.
notificationService
.
notify
(
Severity
.
Info
,
'
This is a message with a [link](https://code.visualstudio.com).
'
);
return
TPromise
.
as
(
undefined
);
}
}
...
...
src/vs/workbench/electron-browser/shell.ts
浏览文件 @
a10fc279
...
...
@@ -94,6 +94,8 @@ import { ILocalizationsChannel, LocalizationsChannelClient } from 'vs/platform/l
import
{
ILocalizationsService
}
from
'
vs/platform/localizations/common/localizations
'
;
import
{
IWorkbenchIssueService
}
from
'
vs/workbench/services/issue/common/issue
'
;
import
{
WorkbenchIssueService
}
from
'
vs/workbench/services/issue/electron-browser/workbenchIssueService
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
NotificationService
}
from
'
vs/workbench/services/notification/browser/notificationService
'
;
/**
* Services that we require for the Shell
...
...
@@ -401,6 +403,8 @@ export class WorkbenchShell {
serviceCollection
.
set
(
IMessageService
,
this
.
messageService
);
serviceCollection
.
set
(
IChoiceService
,
this
.
messageService
);
serviceCollection
.
set
(
INotificationService
,
new
SyncDescriptor
(
NotificationService
,
container
));
const
lifecycleService
=
instantiationService
.
createInstance
(
LifecycleService
);
this
.
toUnbind
.
push
(
lifecycleService
.
onShutdown
(
reason
=>
this
.
dispose
(
reason
)));
serviceCollection
.
set
(
ILifecycleService
,
lifecycleService
);
...
...
src/vs/workbench/services/notification/browser/notificationList.ts
0 → 100644
浏览文件 @
a10fc279
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
Severity
}
from
'
vs/platform/message/common/message
'
;
export
class
NotificationList
{
constructor
(
private
container
:
HTMLElement
)
{
}
public
show
(
severity
:
Severity
,
notification
:
string
):
void
{
console
.
log
(
this
.
container
);
}
}
\ No newline at end of file
src/vs/workbench/services/notification/browser/notificationService.ts
0 → 100644
浏览文件 @
a10fc279
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
INotificationService
,
INotification
}
from
'
vs/platform/notification/common/notification
'
;
import
{
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
NotificationList
}
from
'
vs/workbench/services/notification/browser/notificationList
'
;
export
class
NotificationService
implements
INotificationService
{
public
_serviceBrand
:
any
;
private
handler
:
NotificationList
;
constructor
(
container
:
HTMLElement
)
{
this
.
handler
=
new
NotificationList
(
container
);
}
public
notify
(
sev
:
Severity
,
message
:
string
):
INotification
{
this
.
handler
.
show
(
sev
,
message
);
return
{
dispose
:
()
=>
void
0
};
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录