Skip to content

Commit 4124177

Browse files
lgeigerrgbkrk
authored andcommitted
Improve error message if kernelspec isn't correctly setup
1 parent 8d6653f commit 4124177

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

lib/kernel-manager.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,17 @@ export class KernelManager {
2929
this.getKernelSpecForGrammar(grammar).then(kernelSpec => {
3030
if (!kernelSpec) {
3131
const message = `No kernel for grammar \`${grammar.name}\` found`;
32-
const description =
33-
"Check that the language for this file is set in Atom and that you have a Jupyter kernel installed for it.";
34-
atom.notifications.addError(message, { description });
32+
const pythonDescription =
33+
grammar && /python/g.test(grammar.scopeName)
34+
? "\n\nTo detect your current Python install you will need to run:<pre>python -m pip install ipykernel\npython -m ipykernel install --user</pre>"
35+
: "";
36+
const description = `Check that the language for this file is set in Atom and that you have a Jupyter kernel installed for it.${
37+
pythonDescription
38+
}`;
39+
atom.notifications.addError(message, {
40+
description,
41+
dismissable: pythonDescription !== ""
42+
});
3543
return;
3644
}
3745

@@ -121,14 +129,10 @@ export class KernelManager {
121129

122130
if (kernelSpecs.length === 0) {
123131
const message = "No Kernels Installed";
124-
const pythonDescription =
125-
grammar && /python/g.test(grammar.scopeName)
126-
? "\n\nTo detect your current Python install you will need to run:<pre>python -m pip install ipykernel\npython -m ipykernel install --user</pre>"
127-
: "";
132+
128133
const options = {
129-
description: `No kernels are installed on your system so you will not be able to execute code in any language.${
130-
pythonDescription
131-
}`,
134+
description:
135+
"No kernels are installed on your system so you will not be able to execute code in any language.",
132136
dismissable: true,
133137
buttons: [
134138
{

0 commit comments

Comments
 (0)