本文整理汇总了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)));