function initProjectsView()

in vscode/qodana/src/extension.ts [114:141]


function initProjectsView(context: vscode.ExtensionContext) {
	if (!context) {
		return;
	}
	const projectsView = new ProjectsView(async () => {
		return extensionInstance.auth?.getProjects();
	});
	context.subscriptions.push(vscode.window.createTreeView('qodana.link-view', {
		treeDataProvider: projectsView
	}));

	context.subscriptions.push(
		vscode.commands.registerCommand(COMMAND_REFRESH_PROJECTS, () => projectsView.refresh())
	);
	context.subscriptions.push(
		vscode.commands.registerCommand(COMMAND_TREE_OTHER_ITEM, async (otherItem: OtherTreeItem) => {
			const userInput = await vscode.window.showInputBox({
				prompt: OTHER_PROJECT_TOOLTIP,
			});
			if (userInput !== undefined) {
				otherItem.label = 'Other project: ' + userInput;
				otherItem.projectId = userInput;
				projectsView.refreshItem(otherItem);
			}
			vscode.commands.executeCommand(COMMAND_SELECT_NODE, otherItem.projectId);
		})
	);
}