本文整理匯總了TypeScript中vs/base/common/async.toThenable函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript toThenable函數的具體用法?TypeScript toThenable怎麽用?TypeScript toThenable使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了toThenable函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: provideSignatureHelp
export function provideSignatureHelp(model:IModel, position:IEditorPosition, cancellationToken = CancellationToken.None): Thenable<SignatureHelp> {
let support = SignatureHelpProviderRegistry.ordered(model)[0];
if (!support) {
return TPromise.as(undefined);
}
return toThenable(support.provideSignatureHelp(model, position, cancellationToken));
}
示例2: computeDiff
export function computeDiff(oneDocument: vscode.TextDocument, otherDocument: vscode.TextDocument): Thenable<vscode.LineChange[]> {
const oneLines = getTextDocumentLines(oneDocument);
const otherLines = getTextDocumentLines(otherDocument);
const computer = new DiffComputer(oneLines, otherLines, {
shouldPostProcessCharChanges: false,
shouldIgnoreTrimWhitespace: false, // options?
shouldConsiderTrimWhitespaceInEmptyCase: false
});
return toThenable(computer.computeDiff());
}
示例3: toThenable
const promises = supports.map((support, idx) => {
return toThenable(support.provideHover(model, position, cancellationToken)).then(result => {
if (result) {
let hasRange = (typeof result.range !== 'undefined');
let hasHtmlContent = (typeof result.htmlContent !== 'undefined' && result.htmlContent && result.htmlContent.length > 0);
if (hasRange && hasHtmlContent) {
values[idx] = result;
}
}
}, err => {
onUnexpectedError(err);
});
});
示例4: toThenable
let promises = providers.map((provider, i) => {
return toThenable(provider.provideFoldingRanges(model, foldingContext, cancellationToken)).then(ranges => {
if (cancellationToken.isCancellationRequested) {
return;
}
if (Array.isArray(ranges)) {
if (!Array.isArray(rangeData)) {
rangeData = [];
}
let nLines = model.getLineCount();
for (let r of ranges) {
if (r.start > 0 && r.end > r.start && r.end <= nLines) {
rangeData.push({ start: r.start, end: r.end, rank: i, kind: r.kind });
}
}
}
}, onUnexpectedExternalError);
});
示例5: toThenable
let promises = providers.map(provider => toThenable(provider.provideFoldingRanges(model, foldingContext, cancellationToken)));