当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript window.visibleTextEditors.find方法代码示例

本文整理汇总了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`
            );
        }
    }
开发者ID:chrisleaman,项目名称:vscode-gitlens,代码行数:30,代码来源:annotations.ts

示例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
}
开发者ID:seL4,项目名称:isabelle,代码行数:11,代码来源:library.ts

示例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")
}
开发者ID:seL4,项目名称:isabelle,代码行数:13,代码来源:preview.ts

示例4: findEditor

export function findEditor(url: string) {
  return window.visibleTextEditors.find(
    e =>
      e.document.uri.scheme === ADTSCHEME && e.document.uri.toString() === url
  )
}
开发者ID:valdirmendesgt,项目名称:vscode_abap_remote_fs,代码行数:6,代码来源:langClient.ts

示例5:

export const findEditorByDocument = document =>
  window.visibleTextEditors.find(editor =>
    editor.document.uri.toString() === document.uri.toString());
开发者ID:d4rkr00t,项目名称:language-stylus,代码行数:3,代码来源:color-decorators.ts


注:本文中的vscode.window.visibleTextEditors.find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。