當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript vscode.window.visibleTextEditors類代碼示例

本文整理匯總了TypeScript中vscode.window.visibleTextEditors的典型用法代碼示例。如果您正苦於以下問題:TypeScript window.visibleTextEditors類的具體用法?TypeScript window.visibleTextEditors怎麽用?TypeScript window.visibleTextEditors使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了window.visibleTextEditors類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: refresh

    @gate()
    @debug()
    async refresh(reset: boolean = false) {
        const cc = Logger.getCorrelationContext();

        if (reset) {
            this._uri = unknownGitUri;
            this._selection = undefined;
            this.resetChild();
        }

        const editor = window.activeTextEditor;
        if (editor == null || !Container.git.isTrackable(editor.document.uri)) {
            if (
                this.uri === unknownGitUri ||
                (Container.git.isTrackable(this.uri) &&
                    window.visibleTextEditors.some(e => e.document && UriComparer.equals(e.document.uri, this.uri)))
            ) {
                return true;
            }

            this._uri = unknownGitUri;
            this._selection = undefined;
            this.resetChild();

            if (cc !== undefined) {
                cc.exitDetails = `, uri=${Logger.toLoggable(this._uri)}`;
            }
            return false;
        }

        if (
            UriComparer.equals(editor!.document.uri, this.uri) &&
            (this._selection !== undefined && editor.selection.isEqual(this._selection))
        ) {
            if (cc !== undefined) {
                cc.exitDetails = `, uri=${Logger.toLoggable(this._uri)}`;
            }
            return true;
        }

        const gitUri = await GitUri.fromUri(editor!.document.uri);

        if (
            this.uri !== unknownGitUri &&
            UriComparer.equals(gitUri, this.uri) &&
            (this._selection !== undefined && editor.selection.isEqual(this._selection))
        ) {
            return true;
        }

        this._uri = gitUri;
        this._selection = editor.selection;
        this.resetChild();

        if (cc !== undefined) {
            cc.exitDetails = `, uri=${Logger.toLoggable(this._uri)}`;
        }
        return false;
    }
開發者ID:eamodio,項目名稱:vscode-git-codelens,代碼行數:60,代碼來源:lineHistoryTrackerNode.ts

示例3: revertChange

	@command('git.revertChange')
	async revertChange(uri: Uri, changes: LineChange[], index: number): Promise<void> {
		const textEditor = window.visibleTextEditors.filter(e => e.document.uri.toString() === uri.toString())[0];

		if (!textEditor) {
			return;
		}

		await this._revertChanges(textEditor, [...changes.slice(0, index), ...changes.slice(index + 1)]);
	}
開發者ID:golf1052,項目名稱:vscode,代碼行數:10,代碼來源:commands.ts

示例4: stageChange

	@command('git.stageChange')
	async stageChange(uri: Uri, changes: LineChange[], index: number): Promise<void> {
		const textEditor = window.visibleTextEditors.filter(e => e.document.uri.toString() === uri.toString())[0];

		if (!textEditor) {
			return;
		}

		await this._stageChanges(textEditor, [changes[index]]);
	}
開發者ID:golf1052,項目名稱:vscode,代碼行數:10,代碼來源:commands.ts

示例5: validateAllDocuments

function validateAllDocuments() {
	// TODO: why doesn't this not work?
	//workspace.textDocuments.forEach(each => validateDocument(each));

	window.visibleTextEditors.forEach(each => {
		if (each.document) {
			validateDocument(each.document);
		}
	});
}
開發者ID:scytalezero,項目名稱:vscode-npm-scripts,代碼行數:10,代碼來源:main.ts

示例6: updatePriorityFiles

	updatePriorityFiles() {
		let visibleDocuments = window.visibleTextEditors.map(e => e.document);
		let otherOpenDocuments = workspace.textDocuments.filter(doc => visibleDocuments.indexOf(doc) == -1);

		let priorityDocuments = visibleDocuments.concat(otherOpenDocuments).filter(d => util.isAnalyzable(d));
		let priorityFiles = priorityDocuments.map(doc => doc.fileName);

		this.analyzer.analysisSetPriorityFiles({
			files: priorityFiles
		}).then(() => {}, e => console.warn(e.message));
	}
開發者ID:ikhwanhayat,項目名稱:Dart-Code,代碼行數:11,代碼來源:open_file_tracker.ts

示例7: 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

示例8: 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

示例9: activateColorDecorations

export function activateColorDecorations(): Disposable {
  const disposables: Disposable[] = [];
  const colorsDecorationType = window.createTextEditorDecorationType(decorationType);
	disposables.push(colorsDecorationType);

  window.visibleTextEditors.forEach(editor => {
    if (!editor || !editor.document) return;
    updateDecoratorsWrapper(colorsDecorationType, editor);
  });

  window.onDidChangeActiveTextEditor(editor => {
    if (!editor || !editor.document) return;
    updateDecoratorsWrapperDebounced(colorsDecorationType, editor);
  });

  workspace.onDidChangeTextDocument(evt => {
    if (!evt.document) return;
    const editor = findEditorByDocument(evt.document);
    if (!editor) return;
    updateDecoratorsWrapperDebounced(colorsDecorationType, editor);
  });

  workspace.onDidOpenTextDocument(document => {
    if (!document) return;
    const editor = findEditorByDocument(document);
    if (!editor) return;
    updateDecoratorsWrapperDebounced(colorsDecorationType, editor);
  });

  (window as any).onDidChangeVisibleTextEditors(editors => {
    editors.forEach(editor => {
      if (!editor.document) return;
      updateDecoratorsWrapperDebounced(colorsDecorationType, editor);
    })
  });

  return Disposable.from(...disposables);
}
開發者ID:d4rkr00t,項目名稱:language-stylus,代碼行數:38,代碼來源:color-decorators.ts


注:本文中的vscode.window.visibleTextEditors類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。