Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5ddbda01
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,发现更多精彩内容 >>
提交
5ddbda01
编写于
12月 02, 2019
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add theming API
上级
099e498f
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
146 addition
and
4 deletion
+146
-4
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+36
-0
src/vs/workbench/api/browser/extensionHost.contribution.ts
src/vs/workbench/api/browser/extensionHost.contribution.ts
+1
-0
src/vs/workbench/api/browser/mainThreadTheming.ts
src/vs/workbench/api/browser/mainThreadTheming.ts
+33
-0
src/vs/workbench/api/common/extHost.api.impl.ts
src/vs/workbench/api/common/extHost.api.impl.ts
+11
-2
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+10
-2
src/vs/workbench/api/common/extHostTheming.ts
src/vs/workbench/api/common/extHostTheming.ts
+38
-0
src/vs/workbench/api/common/extHostTypes.ts
src/vs/workbench/api/common/extHostTypes.ts
+17
-0
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
5ddbda01
...
...
@@ -1412,4 +1412,40 @@ declare module 'vscode' {
}
//#endregion
//#region color theme access
/**
* Represents a color theme kind.
*/
export
enum
ColorThemeKind
{
Light
=
1
,
Dark
=
2
,
HighContrast
=
3
}
/**
* Represents a color theme.
*/
export
interface
ColorTheme
{
/**
* The kind of this color theme: light, dark or high contrast.
*/
readonly
kind
:
ColorThemeKind
;
}
export
namespace
window
{
/**
* The currently active color theme as configured in the settings. The active
* theme can be changed via the `workbench.colorTheme` setting.
*/
export
let
activeColorTheme
:
ColorTheme
;
/**
* An [event](#Event) which fires when the active theme changes or one of it's colors chnage.
*/
export
const
onDidChangeActiveColorTheme
:
Event
<
ColorTheme
>
;
}
}
src/vs/workbench/api/browser/extensionHost.contribution.ts
浏览文件 @
5ddbda01
...
...
@@ -47,6 +47,7 @@ import './mainThreadStatusBar';
import
'
./mainThreadStorage
'
;
import
'
./mainThreadTelemetry
'
;
import
'
./mainThreadTerminalService
'
;
import
'
./mainThreadTheming
'
;
import
'
./mainThreadTreeViews
'
;
import
'
./mainThreadDownloadService
'
;
import
'
./mainThreadUrls
'
;
...
...
src/vs/workbench/api/browser/mainThreadTheming.ts
0 → 100644
浏览文件 @
5ddbda01
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
MainContext
,
IExtHostContext
,
ExtHostThemingShape
,
ExtHostContext
,
MainThreadThemingShape
}
from
'
../common/extHost.protocol
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadTheming
)
export
class
MainThreadTheming
implements
MainThreadThemingShape
{
private
readonly
_themeService
:
IThemeService
;
private
readonly
_proxy
:
ExtHostThemingShape
;
private
readonly
_themeChangeListener
:
IDisposable
;
constructor
(
extHostContext
:
IExtHostContext
,
@
IThemeService
themeService
:
IThemeService
)
{
this
.
_themeService
=
themeService
;
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostTheming
);
this
.
_themeChangeListener
=
this
.
_themeService
.
onThemeChange
(
e
=>
{
this
.
_proxy
.
$onColorThemeChange
(
this
.
_themeService
.
getTheme
().
type
);
});
}
dispose
():
void
{
this
.
_themeChangeListener
.
dispose
();
}
}
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
5ddbda01
...
...
@@ -67,6 +67,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import
{
IURITransformerService
}
from
'
vs/workbench/api/common/extHostUriTransformerService
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/extHostRpcService
'
;
import
{
IExtHostInitDataService
}
from
'
vs/workbench/api/common/extHostInitDataService
'
;
import
{
ExtHostTheming
}
from
'
vs/workbench/api/common/extHostTheming
'
;
export
interface
IExtensionApiFactory
{
(
extension
:
IExtensionDescription
,
registry
:
ExtensionDescriptionRegistry
,
configProvider
:
ExtHostConfigProvider
):
typeof
vscode
;
...
...
@@ -122,7 +123,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const
extHostComment
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostComments
,
new
ExtHostComments
(
rpcProtocol
,
extHostCommands
,
extHostDocuments
));
const
extHostWindow
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostWindow
,
new
ExtHostWindow
(
rpcProtocol
));
const
extHostProgress
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostProgress
,
new
ExtHostProgress
(
rpcProtocol
.
getProxy
(
MainContext
.
MainThreadProgress
)));
const
extHostLabelService
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHosLabelService
,
new
ExtHostLabelService
(
rpcProtocol
));
const
extHostLabelService
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostLabelService
,
new
ExtHostLabelService
(
rpcProtocol
));
const
extHostTheming
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostTheming
,
new
ExtHostTheming
(
rpcProtocol
));
// Check that no named customers are missing
const
expected
:
ProxyIdentifier
<
any
>
[]
=
values
(
ExtHostContext
);
...
...
@@ -550,6 +552,12 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
},
createInputBox
():
vscode
.
InputBox
{
return
extHostQuickOpen
.
createInputBox
(
extension
.
identifier
);
},
get
activeColorTheme
():
vscode
.
ColorTheme
{
return
extHostTheming
.
activeColorTheme
;
},
onDidChangeActiveColorTheme
(
listener
,
thisArg
?,
disposables
?)
{
return
extHostTheming
.
onDidChangeActiveColorTheme
(
listener
,
thisArg
,
disposables
);
}
};
...
...
@@ -939,7 +947,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
DebugConsoleMode
:
extHostTypes
.
DebugConsoleMode
,
Decoration
:
extHostTypes
.
Decoration
,
WebviewContentState
:
extHostTypes
.
WebviewContentState
,
UIKind
:
UIKind
UIKind
:
UIKind
,
ColorThemeKind
:
extHostTypes
.
ColorThemeKind
};
};
}
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
5ddbda01
...
...
@@ -1385,6 +1385,12 @@ export interface ExtHostStorageShape {
$acceptValue
(
shared
:
boolean
,
key
:
string
,
value
:
object
|
undefined
):
void
;
}
export
interface
ExtHostThemingShape
{
$onColorThemeChange
(
themeType
:
string
):
void
;
}
export
interface
MainThreadThemingShape
extends
IDisposable
{
}
// --- proxy identifiers
export
const
MainContext
=
{
...
...
@@ -1425,7 +1431,8 @@ export const MainContext = {
MainThreadSearch
:
createMainId
<
MainThreadSearchShape
>
(
'
MainThreadSearch
'
),
MainThreadTask
:
createMainId
<
MainThreadTaskShape
>
(
'
MainThreadTask
'
),
MainThreadWindow
:
createMainId
<
MainThreadWindowShape
>
(
'
MainThreadWindow
'
),
MainThreadLabelService
:
createMainId
<
MainThreadLabelServiceShape
>
(
'
MainThreadLabelService
'
)
MainThreadLabelService
:
createMainId
<
MainThreadLabelServiceShape
>
(
'
MainThreadLabelService
'
),
MainThreadTheming
:
createMainId
<
MainThreadThemingShape
>
(
'
MainThreadTheming
'
)
};
export
const
ExtHostContext
=
{
...
...
@@ -1459,5 +1466,6 @@ export const ExtHostContext = {
ExtHostStorage
:
createMainId
<
ExtHostStorageShape
>
(
'
ExtHostStorage
'
),
ExtHostUrls
:
createExtId
<
ExtHostUrlsShape
>
(
'
ExtHostUrls
'
),
ExtHostOutputService
:
createMainId
<
ExtHostOutputServiceShape
>
(
'
ExtHostOutputService
'
),
ExtHosLabelService
:
createMainId
<
ExtHostLabelServiceShape
>
(
'
ExtHostLabelService
'
)
ExtHostLabelService
:
createMainId
<
ExtHostLabelServiceShape
>
(
'
ExtHostLabelService
'
),
ExtHostTheming
:
createMainId
<
ExtHostThemingShape
>
(
'
ExtHostTheming
'
)
};
src/vs/workbench/api/common/extHostTheming.ts
0 → 100644
浏览文件 @
5ddbda01
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ColorTheme
,
ColorThemeKind
}
from
'
./extHostTypes
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/extHostRpcService
'
;
import
{
ExtHostThemingShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
export
class
ExtHostTheming
implements
ExtHostThemingShape
{
readonly
_serviceBrand
:
undefined
;
private
_actual
:
ColorTheme
;
private
_onDidChangeActiveColorTheme
:
Emitter
<
ColorTheme
>
;
constructor
(
@
IExtHostRpcService
_extHostRpc
:
IExtHostRpcService
)
{
this
.
_actual
=
new
ColorTheme
(
ColorThemeKind
.
Dark
);
this
.
_onDidChangeActiveColorTheme
=
new
Emitter
<
ColorTheme
>
();
}
public
get
activeColorTheme
():
ColorTheme
{
return
this
.
_actual
;
}
$onColorThemeChange
(
type
:
string
):
void
{
let
kind
=
type
===
'
light
'
?
ColorThemeKind
.
Light
:
type
===
'
dark
'
?
ColorThemeKind
.
Dark
:
ColorThemeKind
.
HighContrast
;
this
.
_actual
=
new
ColorTheme
(
kind
);
this
.
_onDidChangeActiveColorTheme
.
fire
(
this
.
_actual
);
}
public
get
onDidChangeActiveColorTheme
():
Event
<
ColorTheme
>
{
return
this
.
_onDidChangeActiveColorTheme
.
event
;
}
}
src/vs/workbench/api/common/extHostTypes.ts
浏览文件 @
5ddbda01
...
...
@@ -2503,3 +2503,20 @@ export enum WebviewContentState {
Unchanged
=
2
,
Dirty
=
3
,
}
//#region Theming
@
es5ClassCompat
export
class
ColorTheme
implements
vscode
.
ColorTheme
{
constructor
(
public
readonly
kind
:
ColorThemeKind
)
{
}
}
export
enum
ColorThemeKind
{
Light
=
1
,
Dark
=
2
,
HighContrast
=
3
}
//#endregion Theming
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录