本文整理汇总了TypeScript中vs/editor/common/modes.ColorProviderRegistry类的典型用法代码示例。如果您正苦于以下问题:TypeScript ColorProviderRegistry类的具体用法?TypeScript ColorProviderRegistry怎么用?TypeScript ColorProviderRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ColorProviderRegistry类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getColors
export function getColors(model: IReadOnlyModel): TPromise<IColorRange[]> {
const providers = ColorProviderRegistry.ordered(model).reverse();
const promises = providers.map(p => asWinJsPromise(token => p.provideColorRanges(model, token)));
return TPromise.join(promises)
.then(ranges => flatten(ranges.filter(r => Array.isArray(r))));
}
开发者ID:armanio123,项目名称:vscode,代码行数:7,代码来源:color.ts
示例2: registerLanguageCommand
registerLanguageCommand('_executeColorPresentationProvider', function (accessor, args) {
const { resource, color, range } = args;
if (!(resource instanceof URI) || !Array.isArray(color) || color.length !== 4 || !Range.isIRange(range)) {
throw illegalArgument();
}
const [red, green, blue, alpha] = color;
const model = accessor.get(IModelService).getModel(resource);
if (!model) {
throw illegalArgument();
}
const colorInfo = {
range,
color: { red, green, blue, alpha }
};
const presentations: IColorPresentation[] = [];
const providers = ColorProviderRegistry.ordered(model).reverse();
const promises = providers.map(provider => Promise.resolve(provider.provideColorPresentations(model, colorInfo, CancellationToken.None)).then(result => {
if (Array.isArray(result)) {
presentations.push(...result);
}
}));
return Promise.all(promises).then(() => presentations);
});
开发者ID:DonJayamanne,项目名称:vscode,代码行数:27,代码来源:color.ts
示例3: getColors
export function getColors(model: ITextModel, token: CancellationToken): Promise<IColorData[]> {
const colors: IColorData[] = [];
const providers = ColorProviderRegistry.ordered(model).reverse();
const promises = providers.map(provider => Promise.resolve(provider.provideDocumentColors(model, token)).then(result => {
if (Array.isArray(result)) {
for (let colorInfo of result) {
colors.push({ colorInfo, provider });
}
}
}));
return Promise.all(promises).then(() => colors);
}
开发者ID:DonJayamanne,项目名称:vscode,代码行数:13,代码来源:color.ts
示例4: getColors
export function getColors(model: ITextModel): TPromise<IColorData[]> {
const colors: IColorData[] = [];
const providers = ColorProviderRegistry.ordered(model).reverse();
const promises = providers.map(provider => asWinJsPromise(token => provider.provideDocumentColors(model, token)).then(result => {
if (Array.isArray(result)) {
for (let colorInfo of result) {
colors.push({ colorInfo, provider });
}
}
}));
return TPromise.join(promises).then(() => colors);
}
开发者ID:AllureFer,项目名称:vscode,代码行数:13,代码来源:color.ts
示例5: getColors
export function getColors(model: IReadOnlyModel): TPromise<IColorRange[]> {
let colorInfo: IColorRange[] = [];
// ask all providers for colors in parallel
const promises = ColorProviderRegistry.ordered(model).reverse().map(provider => {
return asWinJsPromise(token => provider.provideColorRanges(model, token)).then(result => {
if (Array.isArray(result)) {
colorInfo = colorInfo.concat(result);
}
}, onUnexpectedExternalError);
});
return TPromise.join(promises).then(() => {
return colorInfo;
});
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:16,代码来源:colorPicker.ts
示例6: registerColorProvider
export function registerColorProvider(languageId: string, provider: modes.DocumentColorProvider): IDisposable {
return modes.ColorProviderRegistry.register(languageId, provider);
}
开发者ID:ramesius,项目名称:vscode,代码行数:3,代码来源:standaloneLanguages.ts
注:本文中的vs/editor/common/modes.ColorProviderRegistry类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论