in src/Explorer/Notebook/NotebookComponent/epics.ts [136:214]
function acquireKernelInfo(channels: Channels, kernelRef: KernelRef, contentRef: ContentRef) {
const message = createMessage("kernel_info_request");
const obs = channels.pipe(
childOf(message),
ofMessageType("kernel_info_reply"),
first(),
mergeMap((msg) => {
const content = msg.content;
const languageInfo = (content && content.language_info) || {
name: "",
version: "",
mimetype: "",
file_extension: "",
pygments_lexer: "",
codemirror_mode: "",
nbconvert_exporter: "",
};
switch (languageInfo.name) {
case "csharp":
languageInfo.codemirror_mode = "text/x-csharp";
break;
case "scala":
languageInfo.codemirror_mode = "text/x-scala";
break;
}
const info: KernelInfo = {
protocolVersion: content.protocol_version,
implementation: content.implementation,
implementationVersion: content.implementation_version,
banner: content.banner,
helpLinks: content.help_links,
languageName: languageInfo.name,
languageVersion: languageInfo.version,
mimetype: languageInfo.mimetype,
fileExtension: languageInfo.file_extension,
pygmentsLexer: languageInfo.pygments_lexer,
codemirrorMode: languageInfo.codemirror_mode,
nbconvertExporter: languageInfo.nbconvert_exporter,
};
let result;
if (!content.protocol_version.startsWith("5")) {
result = [
actions.launchKernelFailed({
kernelRef,
contentRef,
error: new Error(
"The kernel that you are attempting to launch does not support the latest version (v5) of the messaging protocol.",
),
}),
];
} else {
result = [
// The original action we were using
actions.setLanguageInfo({
langInfo: msg.content.language_info,
kernelRef,
contentRef,
}),
actions.setKernelInfo({
kernelRef,
info,
}),
];
}
return of(...result);
}),
);
return Observable.create((observer: Observer<any>) => {
const subscription = obs.subscribe(observer);
channels.next(message);
return subscription;
});
}