Explorar el Código

Append an empty line for test of completeness of statements

Bo Peng hace 5 años
padre
commit
39bf41de51
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      packages/notebook-extension/src/index.ts

+ 2 - 1
packages/notebook-extension/src/index.ts

@@ -992,7 +992,8 @@ function addCommands(
         while (true) {
           code = srcLines.slice(firstLine, lastLine).join('\n');
           let reply = await current.context.session.kernel.requestIsComplete({
-            code: code
+            // ipython needs an empty line at the end to correctly identify completeness of indented code
+            code: code + '\n\n'
           });
           if (reply.content.status === 'complete') {
             if (curLine < lastLine) {