Skip to content

Commit 1649200

Browse files
authored
Merge pull request #2118 from nteract/remote-kernel-fixes
2 parents 621cb99 + dc2a205 commit 1649200

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lib/ws-kernel-picker.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export default class WSKernelPicker {
257257
},
258258
],
259259
infoMessage:
260-
"Connection to gateway failed. Your settings may be incorrect, the server may be unavailable, or you may lack sufficient privileges to complete the connection.",
260+
"You may need to authenticate to complete the connection, or your settings may be incorrect, or the server may be unavailable.",
261261
loadingMessage: null,
262262
emptyMessage: null,
263263
} as SelectListProperties);
@@ -338,10 +338,27 @@ export default class WSKernelPicker {
338338
this._kernelSpecFilter(spec)
339339
);
340340

341+
if (kernelSpecs.length === 0) {
342+
this.listView.cancel();
343+
atom.notifications.addError(
344+
`Therer are no kernels that matches the grammar of the currently open file.
345+
Open the file you intend to use the remote kernel for and try again.
346+
You might also need to choose the correct grammar for the file.`
347+
);
348+
return;
349+
}
350+
341351
const kernelNames = kernelSpecs.map((specModel) => specModel.name);
342352

343353
try {
344354
let sessionModels = await Session.listRunning(serverSettings);
355+
// if no seession propmt for the crendials
356+
// if the kernel still refused, then go to catch block
357+
if (sessionModels.length === 0) {
358+
await this.promptForCredentials(gatewayOptions);
359+
serverSettings = ServerConnection.makeSettings(gatewayOptions);
360+
sessionModels = await Session.listRunning(serverSettings);
361+
}
345362
sessionModels = sessionModels.filter((model) => {
346363
const name = model.kernel ? model.kernel.name : null;
347364
return name ? kernelNames.includes(name) : true;

0 commit comments

Comments
 (0)