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


TypeScript window.onDidChangeVisibleTextEditors方法代码示例

本文整理汇总了TypeScript中vscode.window.onDidChangeVisibleTextEditors方法的典型用法代码示例。如果您正苦于以下问题:TypeScript window.onDidChangeVisibleTextEditors方法的具体用法?TypeScript window.onDidChangeVisibleTextEditors怎么用?TypeScript window.onDidChangeVisibleTextEditors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vscode.window的用法示例。


在下文中一共展示了window.onDidChangeVisibleTextEditors方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: test

	test('editor, onDidChangeVisibleTextEditors', () => {

		let eventCounter = 0;
		let reg = window.onDidChangeVisibleTextEditors(editor => {
			eventCounter += 1;
		});

		return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
			return window.showTextDocument(doc, ViewColumn.One).then(editor => {
				assert.equal(eventCounter, 1);
				return doc;
			});
		}).then(doc => {
			return window.showTextDocument(doc, ViewColumn.Two).then(editor => {
				assert.equal(eventCounter, 2);
				return doc;
			});
		}).then(doc => {
			return window.showTextDocument(doc, ViewColumn.Three).then(editor => {
				assert.equal(eventCounter, 3);
				return doc;
			});
		}).then(doc => {
			reg.dispose();
		});
	});
开发者ID:sandy081,项目名称:vscode,代码行数:26,代码来源:window.test.ts

示例2: realActivation

function realActivation(): void {
    if (new CppSettings().intelliSenseEngine === "Disabled") {
        throw new Error(intelliSenseDisabledError);
    } else {
        console.log("activating extension");
        let checkForConflictingExtensions: PersistentState<boolean> = new PersistentState<boolean>("CPP." + util.packageJson.version + ".checkForConflictingExtensions", true);
        if (checkForConflictingExtensions.Value) {
            checkForConflictingExtensions.Value = false;
            let clangCommandAdapterActive: boolean = vscode.extensions.all.some((extension: vscode.Extension<any>, index: number, array: vscode.Extension<any>[]): boolean => {
                return extension.isActive && extension.id === "mitaki28.vscode-clang";
            });
            if (clangCommandAdapterActive) {
                telemetry.logLanguageServerEvent("conflictingExtension");
            }
        }
    }

    realActivationOccurred = true;
    console.log("starting language server");
    clients = new ClientCollection();
    ui = getUI();

    // Check for files left open from the previous session. We won't get events for these until they gain focus,
    // so we manually activate the visible file.
    if (vscode.workspace.textDocuments !== undefined && vscode.workspace.textDocuments.length > 0) {
        onDidChangeActiveTextEditor(vscode.window.activeTextEditor);
    }

    // There may have already been registered CustomConfigurationProviders.
    // Request for configurations from those providers.
    clients.forEach(client => {
        getCustomConfigProviders().forEach(provider => client.onRegisterCustomConfigurationProvider(provider));
    });

    disposables.push(vscode.workspace.onDidChangeConfiguration(onDidChangeSettings));
    disposables.push(vscode.workspace.onDidSaveTextDocument(onDidSaveTextDocument));
    disposables.push(vscode.window.onDidChangeActiveTextEditor(onDidChangeActiveTextEditor));
    disposables.push(vscode.window.onDidChangeTextEditorSelection(onDidChangeTextEditorSelection));
    disposables.push(vscode.window.onDidChangeVisibleTextEditors(onDidChangeVisibleTextEditors));

    updateLanguageConfigurations();

    reportMacCrashes();
    
    const settings: CppSettings = new CppSettings(clients.ActiveClient.RootUri);
    
    if (settings.updateChannel === 'Default') {
        suggestInsidersChannel();
    } else if (settings.updateChannel === 'Insiders') {
        insiderUpdateTimer = setInterval(checkAndApplyUpdate, insiderUpdateTimerInterval, settings.updateChannel);
        checkAndApplyUpdate(settings.updateChannel);
    }

    intervalTimer = setInterval(onInterval, 2500);
}
开发者ID:swyphcosmo,项目名称:vscode-cpptools,代码行数:55,代码来源:extension.ts

示例3: Promise

  let waitForTextEditorsToClose = new Promise((c, e) => {
    if (vscode.window.visibleTextEditors.length === numExpectedEditors) {
      return c();
    }

    vscode.window.onDidChangeVisibleTextEditors(() => {
      if (vscode.window.visibleTextEditors.length === numExpectedEditors) {
        c();
      }
    });
  });
开发者ID:rebornix,项目名称:Vim,代码行数:11,代码来源:testUtils.ts

示例4: Promise

	return new Promise((resolve, reject) => {
		if (vscode.window.visibleTextEditors.length === 0) {
			return resolve();
		}

		const reg = vscode.window.onDidChangeVisibleTextEditors(editors => {
			if (editors.length === 0) {
				resolve();
				reg.dispose();
			}
		});

		vscode.commands.executeCommand('workbench.action.closeAllEditors').then(undefined, reject);

	}).then(() => {
开发者ID:StateFarmIns,项目名称:vscode,代码行数:15,代码来源:utils.ts

示例5: test

	test('editor, onDidChangeVisibleTextEditors', async () => {
		let eventCounter = 0;
		let reg = window.onDidChangeVisibleTextEditors(_editor => {
			eventCounter += 1;
		});

		const doc = await workspace.openTextDocument(join(workspace.rootPath || '', './far.js'));
		await window.showTextDocument(doc, ViewColumn.One);
		assert.equal(eventCounter, 1);

		await window.showTextDocument(doc, ViewColumn.Two);
		assert.equal(eventCounter, 2);

		await window.showTextDocument(doc, ViewColumn.Three);
		assert.equal(eventCounter, 3);

		reg.dispose();
	});
开发者ID:joelday,项目名称:vscode,代码行数:18,代码来源:window.test.ts


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