本文整理匯總了TypeScript中vscode.workspace.textDocuments.find方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript workspace.textDocuments.find方法的具體用法?TypeScript workspace.textDocuments.find怎麽用?TypeScript workspace.textDocuments.find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vscode.workspace.textDocuments
的用法示例。
在下文中一共展示了workspace.textDocuments.find方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test('Convert from yaml to tmLanguage', async function() {
const textDocument = await workspace.openTextDocument(jsonTestFile);
const textEditor = await window.showTextDocument(textDocument);
const fileConverter: FileConverter = new FileConverter();
var success : boolean = await fileConverter.convertFileToTml();
assert.equal(true, success);
let resultDoc = workspace.textDocuments.find((doc : TextDocument) => { return doc.fileName == jsonResultFile;});
var text = resultDoc.getText();
assert.notEqual(text, "");
});
示例2: encode_preview
language_client.onNotification(protocol.preview_response_type, params =>
{
const preview_uri = encode_preview(Uri.parse(params.uri))
if (preview_uri) {
content_provider.set_content(preview_uri, params.content)
content_provider.update(preview_uri)
const existing_document =
workspace.textDocuments.find(document =>
document.uri.scheme === preview_uri.scheme &&
document.uri.query === preview_uri.query)
if (!existing_document && params.column != 0) {
commands.executeCommand("vscode.previewHtml", preview_uri, params.column, params.label)
}
}
})
示例3: encode_state
language_client.onNotification(protocol.state_output_type, params =>
{
const uri = encode_state(params.id)
if (uri) {
content_provider.set_content(uri, params.content)
content_provider.update(uri)
const existing_document =
workspace.textDocuments.find(document =>
document.uri.scheme === uri.scheme &&
document.uri.fragment === uri.fragment)
if (!existing_document) {
const column = library.adjacent_editor_column(window.activeTextEditor, true)
commands.executeCommand("vscode.previewHtml", uri, column, "State")
}
}
})