浏览代码

Merge pull request #2042 from ian-r-rose/no_completion_for_markdown

Don't invoke completer for non-code cells.
Steven Silvester 8 年之前
父节点
当前提交
8caf7102ab
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      packages/completer-extension/src/index.ts

+ 4 - 2
packages/completer-extension/src/index.ts

@@ -199,8 +199,10 @@ const notebookPlugin: JupyterLabPlugin<void> = {
     // Add notebook completer command.
     // Add notebook completer command.
     app.commands.addCommand(CommandIDs.invokeNotebook, {
     app.commands.addCommand(CommandIDs.invokeNotebook, {
       execute: () => {
       execute: () => {
-        const id = notebooks.currentWidget && notebooks.currentWidget.id;
-        return app.commands.execute(CommandIDs.invoke, { id });
+        const panel = notebooks.currentWidget;
+        if (panel && panel.notebook.activeCell.model.type === 'code') {
+          return app.commands.execute(CommandIDs.invoke, { id: panel.id });
+        }
       }
       }
     });
     });