本文整理汇总了TypeScript中vs/editor/common/modes/languageFeatureRegistry.all函数的典型用法代码示例。如果您正苦于以下问题:TypeScript all函数的具体用法?TypeScript all怎么用?TypeScript all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了all函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getOutlineEntries
export function getOutlineEntries(model: IModel): TPromise<IOutline> {
let groupLabels: { [n: string]: string } = Object.create(null);
let entries: IOutlineEntry[] = [];
let promises = OutlineRegistry.all(model).map(support => {
if (support.outlineGroupLabel) {
let keys = Object.keys(support.outlineGroupLabel);
for (let i = 0, len = keys.length; i < len; i++) {
let key = keys[i];
groupLabels[key] = support.outlineGroupLabel[key];
}
}
return support.getOutline(model.getAssociatedResource()).then(result => {
if (Array.isArray(result)) {
entries.push(...result);
}
}, err => {
onUnexpectedError(err);
});
});
return TPromise.join(promises).then(() => {
let flatEntries: IOutlineEntry[] = [];
flatten(flatEntries, entries, '');
flatEntries.sort(compareEntriesUsingStart);
return {
entries: flatEntries,
outlineGroupLabel: groupLabels
};
});
}
示例2: getOutlineEntries
export function getOutlineEntries(model: IModel): TPromise<IOutline> {
let groupLabels: { [n: string]: string } = Object.create(null);
let entries: IOutlineEntry[] = [];
let promises = OutlineRegistry.all(model).map(support => {
if (support.outlineGroupLabel) {
for (var key in support.outlineGroupLabel) {
if (Object.prototype.hasOwnProperty.call(support.outlineGroupLabel, key)) {
groupLabels[key] = support.outlineGroupLabel[key];
}
}
}
return support.getOutline(model.getAssociatedResource()).then(result => {
if (Array.isArray(result)) {
entries.push(...result);
}
}, err => {
onUnexpectedError(err);
});
});
return TPromise.join(promises).then(() => {
let flatEntries: IOutlineEntry[] = [];
flatten(flatEntries, entries, '');
flatEntries.sort(compareEntriesUsingStart);
return {
entries: flatEntries,
outlineGroupLabel: groupLabels
};
});
}
示例3: getCodeLensData
export function getCodeLensData(model: IModel):TPromise<ICodeLensData[]> {
const symbols: ICodeLensData[] = [];
const promises = CodeLensRegistry.all(model).map(support => {
return support.findCodeLensSymbols(model.getAssociatedResource()).then(result => {
if (!Array.isArray(result)) {
return;
}
for (let symbol of result) {
symbols.push({ symbol, support });
}
}, err => {
onUnexpectedError(err);
});
});
return TPromise.join(promises).then(() => symbols);
}
示例4: getQuickFixes
export function getQuickFixes(model: IModel, range: IRange): TPromise<IQuickFix2[]> {
const quickFixes: IQuickFix2[] = [];
let idPool = 0;
const promises = QuickFixRegistry.all(model).map(support => {
return support.getQuickFixes(model.getAssociatedResource(), range).then(result => {
if (!Array.isArray(result)) {
return;
}
for (let fix of result) {
quickFixes.push({
command: fix.command,
score: fix.score,
id: `quickfix_#${idPool++}`,
support
});
}
}, err => {
onUnexpectedError(err);
});
});
return TPromise.join(promises).then(() => quickFixes);
}