Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
46b76978
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,发现更多精彩内容 >>
提交
46b76978
编写于
10月 16, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
color - move color provider api to stable api
上级
65a2d30e
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
142 addition
and
148 deletion
+142
-148
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+138
-0
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+0
-143
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+4
-5
未找到文件。
src/vs/vscode.d.ts
浏览文件 @
46b76978
...
...
@@ -2996,7 +2996,132 @@ declare module 'vscode' {
resolveDocumentLink
?(
link
:
DocumentLink
,
token
:
CancellationToken
):
ProviderResult
<
DocumentLink
>
;
}
/**
* Represents a color in RGBA space.
*/
export
class
Color
{
/**
* The red component of this color in the range [0-1].
*/
readonly
red
:
number
;
/**
* The green component of this color in the range [0-1].
*/
readonly
green
:
number
;
/**
* The blue component of this color in the range [0-1].
*/
readonly
blue
:
number
;
/**
* The alpha component of this color in the range [0-1].
*/
readonly
alpha
:
number
;
/**
* Creates a new color instance.
*
* @param red The red component.
* @param green The green component.
* @param blue The bluew component.
* @param alpha The alpha component.
*/
constructor
(
red
:
number
,
green
:
number
,
blue
:
number
,
alpha
:
number
);
}
/**
* Represents a color range from a document.
*/
export
class
ColorInformation
{
/**
* The range in the document where this color appers.
*/
range
:
Range
;
/**
* The actual color value for this color range.
*/
color
:
Color
;
/**
* Creates a new color range.
*
* @param range The range the color appears in. Must not be empty.
* @param color The value of the color.
* @param format The format in which this color is currently formatted.
*/
constructor
(
range
:
Range
,
color
:
Color
);
}
/**
* A color presentation object describes how a [`color`](#Color) should be represented as text and what
* edits are required to refer to it from source code.
*
* For some languages one color can have multiple presentations, e.g. css can represent the color red with
* the constant `Red`, the hex-value `#ff0000`, or in rgba and hsla forms. In csharp other representations
* apply, e.g `System.Drawing.Color.Red`.
*/
export
class
ColorPresentation
{
/**
* The label of this color presentation. It will be shown on the color
* picker header. By default this is also the text that is inserted when selecting
* this color presentation.
*/
label
:
string
;
/**
* An [edit](#TextEdit) which is applied to a document when selecting
* this presentation for the color. When `falsy` the [label](#ColorPresentation.label)
* is used.
*/
textEdit
?:
TextEdit
;
/**
* An optional array of additional [text edits](#TextEdit) that are applied when
* selecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves.
*/
additionalTextEdits
?:
TextEdit
[];
/**
* Creates a new color presentation.
*
* @param label The label of this color presentation.
*/
constructor
(
label
:
string
);
}
/**
* The document color provider defines the contract between extensions and feature of
* picking and modifying colors in the editor.
*/
export
interface
DocumentColorProvider
{
/**
* Provide colors for the given document.
*
* @param document The document in which the command was invoked.
* @param token A cancellation token.
* @return An array of [color informations](#ColorInformation) or a thenable that resolves to such. The lack of a result
* can be signaled by returning `undefined`, `null`, or an empty array.
*/
provideDocumentColors
(
document
:
TextDocument
,
token
:
CancellationToken
):
ProviderResult
<
ColorInformation
[]
>
;
/**
* Provide [representations](#ColorPresentation) for a color.
*
* @param color The color to show and insert.
* @param context A context object with additional information
* @param token A cancellation token.
* @return An array of color presentations or a thenable that resolves to such. The lack of a result
* can be signaled by returning `undefined`, `null`, or an empty array.
*/
provideColorPresentations
(
color
:
Color
,
context
:
{
document
:
TextDocument
,
range
:
Range
},
token
:
CancellationToken
):
ProviderResult
<
ColorPresentation
[]
>
;
}
/**
* A tuple of two characters, like a pair of
...
...
@@ -5587,6 +5712,19 @@ declare module 'vscode' {
*/
export
function
registerDocumentLinkProvider
(
selector
:
DocumentSelector
,
provider
:
DocumentLinkProvider
):
Disposable
;
/**
* Register a color provider.
*
* Multiple providers can be registered for a language. In that case providers are asked in
* parallel and the results are merged. A failing provider (rejected promise or exception) will
* not cause a failure of the whole operation.
*
* @param selector A selector that defines the documents this provider is applicable to.
* @param provider A color provider.
* @return A [disposable](#Disposable) that unregisters this provider when being disposed.
*/
export
function
registerColorProvider
(
selector
:
DocumentSelector
,
provider
:
DocumentColorProvider
):
Disposable
;
/**
* Set a [language configuration](#LanguageConfiguration) for a language.
*
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
46b76978
...
...
@@ -168,147 +168,4 @@ declare module 'vscode' {
*/
export
function
registerDiffInformationCommand
(
command
:
string
,
callback
:
(
diff
:
LineChange
[],
...
args
:
any
[])
=>
any
,
thisArg
?:
any
):
Disposable
;
}
/**
* Represents a color in RGBA space.
*/
export
class
Color
{
/**
* The red component of this color in the range [0-1].
*/
readonly
red
:
number
;
/**
* The green component of this color in the range [0-1].
*/
readonly
green
:
number
;
/**
* The blue component of this color in the range [0-1].
*/
readonly
blue
:
number
;
/**
* The alpha component of this color in the range [0-1].
*/
readonly
alpha
:
number
;
/**
* Creates a new color instance.
*
* @param red The red component.
* @param green The green component.
* @param blue The bluew component.
* @param alpha The alpha component.
*/
constructor
(
red
:
number
,
green
:
number
,
blue
:
number
,
alpha
:
number
);
}
/**
* Represents a color range from a document.
*/
export
class
ColorInformation
{
/**
* The range in the document where this color appers.
*/
range
:
Range
;
/**
* The actual color value for this color range.
*/
color
:
Color
;
/**
* Creates a new color range.
*
* @param range The range the color appears in. Must not be empty.
* @param color The value of the color.
* @param format The format in which this color is currently formatted.
*/
constructor
(
range
:
Range
,
color
:
Color
);
}
/**
* A color presentation object describes how a [`color`](#Color) should be represented as text and what
* edits are required to refer to it from source code.
*
* For some languages one color can have multiple presentations, e.g. css can represent the color red with
* the constant `Red`, the hex-value `#ff0000`, or in rgba and hsla forms. In csharp other representations
* apply, e.g `System.Drawing.Color.Red`.
*/
export
class
ColorPresentation
{
/**
* The label of this color presentation. It will be shown on the color
* picker header. By default this is also the text that is inserted when selecting
* this color presentation.
*/
label
:
string
;
/**
* An [edit](#TextEdit) which is applied to a document when selecting
* this presentation for the color. When `falsy` the [label](#ColorPresentation.label)
* is used.
*/
textEdit
?:
TextEdit
;
/**
* An optional array of additional [text edits](#TextEdit) that are applied when
* selecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves.
*/
additionalTextEdits
?:
TextEdit
[];
/**
* Creates a new color presentation.
*
* @param label The label of this color presentation.
*/
constructor
(
label
:
string
);
}
/**
* The document color provider defines the contract between extensions and feature of
* picking and modifying colors in the editor.
*/
export
interface
DocumentColorProvider
{
/**
* Provide colors for the given document.
*
* @param document The document in which the command was invoked.
* @param token A cancellation token.
* @return An array of [color informations](#ColorInformation) or a thenable that resolves to such. The lack of a result
* can be signaled by returning `undefined`, `null`, or an empty array.
*/
provideDocumentColors
(
document
:
TextDocument
,
token
:
CancellationToken
):
ProviderResult
<
ColorInformation
[]
>
;
/**
* Provide [representations](#ColorPresentation) for a color.
*
* @param color The color to show and insert.
* @param context A context object with additional information
* @param token A cancellation token.
* @return An array of color presentations or a thenable that resolves to such. The lack of a result
* can be signaled by returning `undefined`, `null`, or an empty array.
*/
provideColorPresentations
(
color
:
Color
,
context
:
{
document
:
TextDocument
,
range
:
Range
},
token
:
CancellationToken
):
ProviderResult
<
ColorPresentation
[]
>
;
}
export
namespace
languages
{
/**
* Register a color provider.
*
* Multiple providers can be registered for a language. In that case providers are asked in
* parallel and the results are merged. A failing provider (rejected promise or exception) will
* not cause a failure of the whole operation.
*
* @param selector A selector that defines the documents this provider is applicable to.
* @param provider A color provider.
* @return A [disposable](#Disposable) that unregisters this provider when being disposed.
*/
export
function
registerColorProvider
(
selector
:
DocumentSelector
,
provider
:
DocumentColorProvider
):
Disposable
;
}
}
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
46b76978
...
...
@@ -269,13 +269,12 @@ export function createApiFactory(
registerDocumentLinkProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentLinkProvider
):
vscode
.
Disposable
{
return
languageFeatures
.
registerDocumentLinkProvider
(
selector
,
provider
);
},
registerColorProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentColorProvider
):
vscode
.
Disposable
{
return
languageFeatures
.
registerColorProvider
(
selector
,
provider
);
},
setLanguageConfiguration
:
(
language
:
string
,
configuration
:
vscode
.
LanguageConfiguration
):
vscode
.
Disposable
=>
{
return
languageFeatures
.
setLanguageConfiguration
(
language
,
configuration
);
},
// proposed API
registerColorProvider
:
proposedApiFunction
(
extension
,
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentColorProvider
)
=>
{
return
languageFeatures
.
registerColorProvider
(
selector
,
provider
);
})
}
};
// namespace: window
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录