From 9e164159078ccac68e32a14e782b92c01a0c17cf Mon Sep 17 00:00:00 2001 From: "Brian E. Granger" Date: Fri, 22 Aug 2014 17:28:13 -0400 Subject: [PATCH 1/5] Initial messing around. Latex tab completion will have to be done outside the normal completer logic as the completer line splitting logic uses \\ as a special character to split lines on. I probably want to put the latex completions first and it if finds any matches, don't do any other completion logic. The only issue is that might short circuit dir/path matching on windows. Hmmm. --- IPython/html/static/notebook/js/completer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/IPython/html/static/notebook/js/completer.js b/IPython/html/static/notebook/js/completer.js index ec7287867..1b06a1570 100644 --- a/IPython/html/static/notebook/js/completer.js +++ b/IPython/html/static/notebook/js/completer.js @@ -165,6 +165,7 @@ define([ Completer.prototype.finish_completing = function (msg) { // let's build a function that wrap all that stuff into what is needed // for the new completer: + console.log(msg); var content = msg.content; var start = content.cursor_start; var end = content.cursor_end; From 27f2f6baaacab7d45071c8f701ca5492822c1e4a Mon Sep 17 00:00:00 2001 From: "Brian E. Granger" Date: Thu, 28 Aug 2014 21:42:04 -0400 Subject: [PATCH 2/5] Adding regexp for unicode identifers to CM mode. --- IPython/html/static/notebook/js/codemirror-ipython.js | 1 + 1 file changed, 1 insertion(+) diff --git a/IPython/html/static/notebook/js/codemirror-ipython.js b/IPython/html/static/notebook/js/codemirror-ipython.js index 1fb01ee3b..575abad29 100644 --- a/IPython/html/static/notebook/js/codemirror-ipython.js +++ b/IPython/html/static/notebook/js/codemirror-ipython.js @@ -15,6 +15,7 @@ CodeMirror.requireMode('python',function(){ } pythonConf.name = 'python'; pythonConf.singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\\?]"); + pythonConf.identifiers = new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*"); return CodeMirror.getMode(conf, pythonConf); }, 'python'); From 2dfd4079ecc4ccc06cb360b5312a9046e9a1a28f Mon Sep 17 00:00:00 2001 From: "Brian E. Granger" Date: Thu, 28 Aug 2014 21:50:26 -0400 Subject: [PATCH 3/5] Cleaning up and only doing latex completion for python 3. --- IPython/html/static/notebook/js/completer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/IPython/html/static/notebook/js/completer.js b/IPython/html/static/notebook/js/completer.js index 1b06a1570..ec7287867 100644 --- a/IPython/html/static/notebook/js/completer.js +++ b/IPython/html/static/notebook/js/completer.js @@ -165,7 +165,6 @@ define([ Completer.prototype.finish_completing = function (msg) { // let's build a function that wrap all that stuff into what is needed // for the new completer: - console.log(msg); var content = msg.content; var start = content.cursor_start; var end = content.cursor_end; From a67c7e83a6c0081924dbdd61beb1cc620ef1a8ed Mon Sep 17 00:00:00 2001 From: "Brian E. Granger" Date: Fri, 29 Aug 2014 09:55:40 -0400 Subject: [PATCH 4/5] Adding tests and limiting CM mode to python 3. --- IPython/html/static/notebook/js/codemirror-ipython.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/IPython/html/static/notebook/js/codemirror-ipython.js b/IPython/html/static/notebook/js/codemirror-ipython.js index 575abad29..351c98f4e 100644 --- a/IPython/html/static/notebook/js/codemirror-ipython.js +++ b/IPython/html/static/notebook/js/codemirror-ipython.js @@ -15,7 +15,12 @@ CodeMirror.requireMode('python',function(){ } pythonConf.name = 'python'; pythonConf.singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\\?]"); - pythonConf.identifiers = new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*"); + if (pythonConf.version === 3) { + console.log('setting up for python 3'); + pythonConf.identifiers = new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*"); + } else if (pythonConf.version === 2) { + pythonConf.identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); + } return CodeMirror.getMode(conf, pythonConf); }, 'python'); From bdb5481a1e62fbe78a3a9e1eb9f6d3433e64f149 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Tue, 9 Sep 2014 12:47:02 -0700 Subject: [PATCH 5/5] Remove leftover debugging --- IPython/html/static/notebook/js/codemirror-ipython.js | 1 - 1 file changed, 1 deletion(-) diff --git a/IPython/html/static/notebook/js/codemirror-ipython.js b/IPython/html/static/notebook/js/codemirror-ipython.js index 351c98f4e..d01abe9e8 100644 --- a/IPython/html/static/notebook/js/codemirror-ipython.js +++ b/IPython/html/static/notebook/js/codemirror-ipython.js @@ -16,7 +16,6 @@ CodeMirror.requireMode('python',function(){ pythonConf.name = 'python'; pythonConf.singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\\?]"); if (pythonConf.version === 3) { - console.log('setting up for python 3'); pythonConf.identifiers = new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*"); } else if (pythonConf.version === 2) { pythonConf.identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");