Show More
@@ -8,9 +8,15 b' var IPython = (function (IPython) {' | |||||
8 | // easyier key mapping |
|
8 | // easyier key mapping | |
9 | var key = IPython.utils.keycodes; |
|
9 | var key = IPython.utils.keycodes; | |
10 |
|
10 | |||
11 | // what is the common start of all completions |
|
11 | function _existing_completion(item, completion_array){ | |
12 |
|
12 | for( var c in completion_array ) { | ||
|
13 | if(completion_array[c].substr(-item.length) == item) | |||
|
14 | { return true; } | |||
|
15 | } | |||
|
16 | return false; | |||
|
17 | } | |||
13 |
|
18 | |||
|
19 | // what is the common start of all completions | |||
14 | function shared_start(B) { |
|
20 | function shared_start(B) { | |
15 | if (B.length == 1) { |
|
21 | if (B.length == 1) { | |
16 | return B[0]; |
|
22 | return B[0]; | |
@@ -116,12 +122,19 b' var IPython = (function (IPython) {' | |||||
116 |
|
122 | |||
117 | var cur = this.editor.getCursor(); |
|
123 | var cur = this.editor.getCursor(); | |
118 | var results = CodeMirror.contextHint(this.editor); |
|
124 | var results = CodeMirror.contextHint(this.editor); | |
|
125 | var filterd_results = Array(); | |||
|
126 | //remove results from context completion | |||
|
127 | //that are already in kernel completion | |||
|
128 | for(var elm in results) { | |||
|
129 | if(_existing_completion(results[elm]['str'], matches) == false) | |||
|
130 | { filterd_results.push(results[elm]); } | |||
|
131 | } | |||
119 |
|
132 | |||
120 | // append the introspection result, in order, at at the beginning of |
|
133 | // append the introspection result, in order, at at the beginning of | |
121 | // the table and compute the replacement range from current cursor |
|
134 | // the table and compute the replacement range from current cursor | |
122 | // positon and matched_text length. |
|
135 | // positon and matched_text length. | |
123 | for (var i = matches.length - 1; i >= 0; --i) { |
|
136 | for (var i = matches.length - 1; i >= 0; --i) { | |
124 | results.unshift({ |
|
137 | filterd_results.unshift({ | |
125 | str: matches[i], |
|
138 | str: matches[i], | |
126 | type: "introspection", |
|
139 | type: "introspection", | |
127 | from: { |
|
140 | from: { | |
@@ -136,7 +149,7 b' var IPython = (function (IPython) {' | |||||
136 | } |
|
149 | } | |
137 |
|
150 | |||
138 | // one the 2 sources results have been merge, deal with it |
|
151 | // one the 2 sources results have been merge, deal with it | |
139 | this.raw_result = results; |
|
152 | this.raw_result = filterd_results; | |
140 |
|
153 | |||
141 | // if empty result return |
|
154 | // if empty result return | |
142 | if (!this.raw_result || !this.raw_result.length) return; |
|
155 | if (!this.raw_result || !this.raw_result.length) return; |
General Comments 0
You need to be logged in to leave comments.
Login now