本文整理匯總了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);
}