src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.ts/KernelPickerFlatStrategy/updateKernelStatusAction
class KernelPickerFlatStrategy:	static updateKernelStatusAction(notebook: NotebookTextModel, action: IAction, notebookKernelService: INotebookKernelService, scopedContextKeyService?: IContextKeyService) {
		const detectionTasks = notebookKernelService.getKernelDetectionTasks(notebook);
		if (detectionTasks.length) {
			const info = notebookKernelService.getMatchingKernel(notebook);
			action.enabled = true;
			action.class = ThemeIcon.asClassName(ThemeIcon.modify(executingStateIcon, 'spin'));

			if (info.selected) {
				action.label = info.selected.label;
				const kernelInfo = info.selected.description ?? info.selected.detail;
				action.tooltip = kernelInfo
					? localize('kernels.selectedKernelAndKernelDetectionRunning', "Selected Kernel: {0} (Kernel Detection Tasks Running)", kernelInfo)
					: localize('kernels.detecting', "Detecting Kernels");
			} else {
				action.label = localize('kernels.detecting', "Detecting Kernels");
			}
			return;
		}

		const runningActions = notebookKernelService.getRunningSourceActions(notebook);

		const updateActionFromSourceAction = (sourceAction: ISourceAction, running: boolean) => {
			const sAction = sourceAction.action;
			action.class = running ? ThemeIcon.asClassName(ThemeIcon.modify(executingStateIcon, 'spin')) : ThemeIcon.asClassName(selectKernelIcon);
			action.label = sAction.label;
			action.enabled = true;
		};

		if (runningActions.length) {
			return updateActionFromSourceAction(runningActions[0] /** TODO handle multiple actions state */, true);
		}

		const info = notebookKernelService.getMatchingKernel(notebook);
		if (info.all.length === 0) {
			action.enabled = true;
			const sourceActions = notebookKernelService.getSourceActions(notebook, scopedContextKeyService);
			if (sourceActions.length === 1) {
				// exact one action
				updateActionFromSourceAction(sourceActions[0], false);
			} else if (sourceActions.filter(sourceAction => sourceAction.isPrimary).length === 1) {
				// exact one primary action
				updateActionFromSourceAction(sourceActions.filter(sourceAction => sourceAction.isPrimary)[0], false);
			} else {
				action.class = ThemeIcon.asClassName(selectKernelIcon);
				action.label = localize('select', "Select Kernel");
				action.tooltip = '';
			}
			return;
		}

		action.enabled = true;
		action.class = ThemeIcon.asClassName(selectKernelIcon);
		const selectedOrSuggested = info.selected
			?? (info.suggestions.length === 1 ? info.suggestions[0] : undefined)
			?? (info.all.length === 1 ? info.all[0] : undefined);
		if (selectedOrSuggested) {
			// selected or suggested kernel
			action.label = selectedOrSuggested.label;
			action.tooltip = selectedOrSuggested.description ?? selectedOrSuggested.detail ?? '';
			if (!info.selected) {
				// special UI for selected kernel?
			}
		} else {
			// many kernels or no kernels
			action.label = localize('select', "Select Kernel");
			action.tooltip = '';
		}
	}