本文整理匯總了TypeScript中vscode.window.visibleTextEditors.find方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript window.visibleTextEditors.find方法的具體用法?TypeScript window.visibleTextEditors.find怎麽用?TypeScript window.visibleTextEditors.find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vscode.window.visibleTextEditors
的用法示例。
在下文中一共展示了window.visibleTextEditors.find方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: execute
execute(editor: TextEditor, uri?: Uri, args: ToggleFileBlameCommandArgs = {}): Thenable<any> {
// Handle the case where we are focused on a non-editor editor (output, debug console)
if (editor != null && !isTextEditor(editor)) {
if (uri != null && !UriComparer.equals(uri, editor.document.uri)) {
const e = window.visibleTextEditors.find(e => UriComparer.equals(uri, e.document.uri));
if (e !== undefined) {
editor = e;
}
}
}
try {
if (args.type === undefined) {
args = { ...args, type: FileAnnotationType.Blame };
}
return Container.fileAnnotations.toggle(
editor,
args.type!,
args.sha !== undefined ? args.sha : editor && editor.selection.active.line,
args.on
);
}
catch (ex) {
Logger.error(ex, 'ToggleFileBlameCommand');
return window.showErrorMessage(
`Unable to toggle file ${args.type} annotations. See output channel for more details`
);
}
}
示例2: find_file_editor
export function find_file_editor(uri: Uri): TextEditor | undefined
{
function check(editor: TextEditor): boolean
{ return editor && is_file(editor.document.uri) && editor.document.uri.fsPath === uri.fsPath }
if (is_file(uri)) {
if (check(window.activeTextEditor)) return window.activeTextEditor
else return window.visibleTextEditors.find(check)
}
else return undefined
}
示例3: source
export function source(preview_uri: Uri)
{
const document_uri = decode_preview(preview_uri)
if (document_uri) {
const editor =
window.visibleTextEditors.find(editor =>
library.is_file(editor.document.uri) &&
editor.document.uri.fsPath === document_uri.fsPath)
if (editor) window.showTextDocument(editor.document, editor.viewColumn)
else workspace.openTextDocument(document_uri).then(window.showTextDocument)
}
else commands.executeCommand("workbench.action.navigateBack")
}
示例4: findEditor
export function findEditor(url: string) {
return window.visibleTextEditors.find(
e =>
e.document.uri.scheme === ADTSCHEME && e.document.uri.toString() === url
)
}
示例5:
export const findEditorByDocument = document =>
window.visibleTextEditors.find(editor =>
editor.document.uri.toString() === document.uri.toString());