codemirror-rails 4.8 → 4.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -6
  3. data/lib/codemirror/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/codemirror.js +289 -184
  5. data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +1 -1
  6. data/vendor/assets/javascripts/codemirror/addons/display/panel.js +94 -0
  7. data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +4 -4
  8. data/vendor/assets/javascripts/codemirror/addons/hint/anyword-hint.js +1 -2
  9. data/vendor/assets/javascripts/codemirror/addons/hint/css-hint.js +1 -1
  10. data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +1 -1
  11. data/vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js +8 -3
  12. data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +1 -1
  13. data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +7 -4
  14. data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +3 -4
  15. data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +170 -63
  16. data/vendor/assets/javascripts/codemirror/addons/mode/simple.js +11 -8
  17. data/vendor/assets/javascripts/codemirror/addons/scroll/annotatescrollbar.js +76 -0
  18. data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.js +139 -0
  19. data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.js +90 -0
  20. data/vendor/assets/javascripts/codemirror/addons/search/search.js +9 -4
  21. data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +5 -3
  22. data/vendor/assets/javascripts/codemirror/keymaps/emacs.js +25 -7
  23. data/vendor/assets/javascripts/codemirror/keymaps/vim.js +181 -109
  24. data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +2 -2
  25. data/vendor/assets/javascripts/codemirror/modes/commonlisp.js +5 -3
  26. data/vendor/assets/javascripts/codemirror/modes/cypher.js +1 -1
  27. data/vendor/assets/javascripts/codemirror/modes/dart.js +50 -0
  28. data/vendor/assets/javascripts/codemirror/modes/dockerfile.js +5 -9
  29. data/vendor/assets/javascripts/codemirror/modes/ebnf.js +195 -0
  30. data/vendor/assets/javascripts/codemirror/modes/javascript.js +2 -0
  31. data/vendor/assets/javascripts/codemirror/modes/markdown.js +3 -3
  32. data/vendor/assets/javascripts/codemirror/modes/puppet.js +2 -2
  33. data/vendor/assets/javascripts/codemirror/modes/shell.js +2 -1
  34. data/vendor/assets/javascripts/codemirror/modes/soy.js +198 -0
  35. data/vendor/assets/javascripts/codemirror/modes/spreadsheet.js +109 -0
  36. data/vendor/assets/javascripts/codemirror/modes/stex.js +4 -6
  37. data/vendor/assets/javascripts/codemirror/modes/textile.js +392 -476
  38. data/vendor/assets/javascripts/codemirror/modes/turtle.js +3 -1
  39. data/vendor/assets/stylesheets/codemirror.css +2 -11
  40. data/vendor/assets/stylesheets/codemirror/addons/merge/merge.css +14 -0
  41. data/vendor/assets/stylesheets/codemirror/addons/scroll/simplescrollbars.css +66 -0
  42. data/vendor/assets/stylesheets/codemirror/addons/search/matchesonscrollbar.css +8 -0
  43. data/vendor/assets/stylesheets/codemirror/themes/tomorrow-night-bright.css +35 -0
  44. data/vendor/assets/stylesheets/codemirror/themes/zenburn.css +37 -0
  45. metadata +14 -3
  46. data/vendor/assets/javascripts/codemirror/addons/hint/python-hint.js +0 -102
@@ -151,7 +151,9 @@ CodeMirror.defineMode("turtle", function(config) {
151
151
  return context.col + (closing ? 0 : 1);
152
152
  else
153
153
  return context.indent + (closing ? 0 : indentUnit);
154
- }
154
+ },
155
+
156
+ lineComment: "#"
155
157
  };
156
158
  });
157
159
 
@@ -5,10 +5,6 @@
5
5
  font-family: monospace;
6
6
  height: 300px;
7
7
  }
8
- .CodeMirror-scroll {
9
- /* Set scrolling behaviour here */
10
- overflow: auto;
11
- }
12
8
 
13
9
  /* PADDING */
14
10
 
@@ -151,6 +147,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
151
147
  }
152
148
 
153
149
  .CodeMirror-scroll {
150
+ overflow: scroll !important; /* Things will break if this is overridden */
154
151
  /* 30px is the magic margin used to hide the element's real scrollbars */
155
152
  /* See overflow: hidden in .CodeMirror */
156
153
  margin-bottom: -30px; margin-right: -30px;
@@ -195,7 +192,6 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
195
192
 
196
193
  .CodeMirror-gutters {
197
194
  position: absolute; left: 0; top: 0;
198
- padding-bottom: 30px;
199
195
  z-index: 3;
200
196
  }
201
197
  .CodeMirror-gutter {
@@ -203,9 +199,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
203
199
  height: 100%;
204
200
  -moz-box-sizing: content-box;
205
201
  box-sizing: content-box;
206
- padding-bottom: 30px;
207
- margin-bottom: -32px;
208
202
  display: inline-block;
203
+ margin-bottom: -30px;
209
204
  /* Hack to make IE7 behave */
210
205
  *zoom:1;
211
206
  *display:inline;
@@ -261,10 +256,6 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
261
256
 
262
257
  .CodeMirror-widget {}
263
258
 
264
- .CodeMirror-wrap .CodeMirror-scroll {
265
- overflow-x: hidden;
266
- }
267
-
268
259
  .CodeMirror-measure {
269
260
  position: absolute;
270
261
  width: 100%;
@@ -96,3 +96,17 @@
96
96
  .CodeMirror-merge-l-chunk.CodeMirror-merge-r-chunk { background: #dfd; }
97
97
  .CodeMirror-merge-l-chunk-start.CodeMirror-merge-r-chunk-start { border-top: 1px solid #4e4; }
98
98
  .CodeMirror-merge-l-chunk-end.CodeMirror-merge-r-chunk-end { border-bottom: 1px solid #4e4; }
99
+
100
+ .CodeMirror-merge-collapsed-widget:before {
101
+ content: "(...)";
102
+ }
103
+ .CodeMirror-merge-collapsed-widget {
104
+ cursor: pointer;
105
+ color: #88b;
106
+ background: #eef;
107
+ border: 1px solid #ddf;
108
+ font-size: 90%;
109
+ padding: 0 3px;
110
+ border-radius: 4px;
111
+ }
112
+ .CodeMirror-merge-collapsed-line .CodeMirror-gutter-elt { display: none; }
@@ -0,0 +1,66 @@
1
+ .CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div {
2
+ position: absolute;
3
+ background: #ccc;
4
+ -moz-box-sizing: border-box;
5
+ box-sizing: border-box;
6
+ border: 1px solid #bbb;
7
+ border-radius: 2px;
8
+ }
9
+
10
+ .CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical {
11
+ position: absolute;
12
+ z-index: 6;
13
+ background: #eee;
14
+ }
15
+
16
+ .CodeMirror-simplescroll-horizontal {
17
+ bottom: 0; left: 0;
18
+ height: 8px;
19
+ }
20
+ .CodeMirror-simplescroll-horizontal div {
21
+ bottom: 0;
22
+ height: 100%;
23
+ }
24
+
25
+ .CodeMirror-simplescroll-vertical {
26
+ right: 0; top: 0;
27
+ width: 8px;
28
+ }
29
+ .CodeMirror-simplescroll-vertical div {
30
+ right: 0;
31
+ width: 100%;
32
+ }
33
+
34
+
35
+ .CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler {
36
+ display: none;
37
+ }
38
+
39
+ .CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div {
40
+ position: absolute;
41
+ background: #bcd;
42
+ border-radius: 3px;
43
+ }
44
+
45
+ .CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical {
46
+ position: absolute;
47
+ z-index: 6;
48
+ }
49
+
50
+ .CodeMirror-overlayscroll-horizontal {
51
+ bottom: 0; left: 0;
52
+ height: 6px;
53
+ }
54
+ .CodeMirror-overlayscroll-horizontal div {
55
+ bottom: 0;
56
+ height: 100%;
57
+ }
58
+
59
+ .CodeMirror-overlayscroll-vertical {
60
+ right: 0; top: 0;
61
+ width: 6px;
62
+ }
63
+ .CodeMirror-overlayscroll-vertical div {
64
+ right: 0;
65
+ width: 100%;
66
+ }
@@ -0,0 +1,8 @@
1
+ .CodeMirror-search-match {
2
+ background: gold;
3
+ border-top: 1px solid orange;
4
+ border-bottom: 1px solid orange;
5
+ -moz-box-sizing: border-box;
6
+ box-sizing: border-box;
7
+ opacity: .5;
8
+ }
@@ -0,0 +1,35 @@
1
+ /*
2
+
3
+ Name: Tomorrow Night - Bright
4
+ Author: Chris Kempson
5
+
6
+ Port done by Gerard Braad <me@gbraad.nl>
7
+
8
+ */
9
+
10
+ .cm-s-tomorrow-night-bright.CodeMirror {background: #000000; color: #eaeaea;}
11
+ .cm-s-tomorrow-night-bright div.CodeMirror-selected {background: #424242 !important;}
12
+ .cm-s-tomorrow-night-bright .CodeMirror-gutters {background: #000000; border-right: 0px;}
13
+ .cm-s-tomorrow-night-bright .CodeMirror-guttermarker { color: #e78c45; }
14
+ .cm-s-tomorrow-night-bright .CodeMirror-guttermarker-subtle { color: #777; }
15
+ .cm-s-tomorrow-night-bright .CodeMirror-linenumber {color: #424242;}
16
+ .cm-s-tomorrow-night-bright .CodeMirror-cursor {border-left: 1px solid #6A6A6A !important;}
17
+
18
+ .cm-s-tomorrow-night-bright span.cm-comment {color: #d27b53;}
19
+ .cm-s-tomorrow-night-bright span.cm-atom {color: #a16a94;}
20
+ .cm-s-tomorrow-night-bright span.cm-number {color: #a16a94;}
21
+
22
+ .cm-s-tomorrow-night-bright span.cm-property, .cm-s-tomorrow-night-bright span.cm-attribute {color: #99cc99;}
23
+ .cm-s-tomorrow-night-bright span.cm-keyword {color: #d54e53;}
24
+ .cm-s-tomorrow-night-bright span.cm-string {color: #e7c547;}
25
+
26
+ .cm-s-tomorrow-night-bright span.cm-variable {color: #b9ca4a;}
27
+ .cm-s-tomorrow-night-bright span.cm-variable-2 {color: #7aa6da;}
28
+ .cm-s-tomorrow-night-bright span.cm-def {color: #e78c45;}
29
+ .cm-s-tomorrow-night-bright span.cm-bracket {color: #eaeaea;}
30
+ .cm-s-tomorrow-night-bright span.cm-tag {color: #d54e53;}
31
+ .cm-s-tomorrow-night-bright span.cm-link {color: #a16a94;}
32
+ .cm-s-tomorrow-night-bright span.cm-error {background: #d54e53; color: #6A6A6A;}
33
+
34
+ .cm-s-tomorrow-night-bright .CodeMirror-activeline-background {background: #2a2a2a !important;}
35
+ .cm-s-tomorrow-night-bright .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * "
3
+ * Using Zenburn color palette from the Emacs Zenburn Theme
4
+ * https://github.com/bbatsov/zenburn-emacs/blob/master/zenburn-theme.el
5
+ *
6
+ * Also using parts of https://github.com/xavi/coderay-lighttable-theme
7
+ * "
8
+ * From: https://github.com/wisenomad/zenburn-lighttable-theme/blob/master/zenburn.css
9
+ */
10
+
11
+ .cm-s-zenburn .CodeMirror-gutters { background: #3f3f3f !important; }
12
+ .cm-s-zenburn .CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded { color: #999; }
13
+ .cm-s-zenburn .CodeMirror-cursor { border-left: 1px solid white !important; }
14
+ .cm-s-zenburn { background-color: #3f3f3f; color: #dcdccc; }
15
+ .cm-s-zenburn span.cm-builtin { color: #dcdccc; font-weight: bold; }
16
+ .cm-s-zenburn span.cm-comment { color: #7f9f7f; }
17
+ .cm-s-zenburn span.cm-keyword { color: #f0dfaf; font-weight: bold; }
18
+ .cm-s-zenburn span.cm-atom { color: #bfebbf; }
19
+ .cm-s-zenburn span.cm-def { color: #dcdccc; }
20
+ .cm-s-zenburn span.cm-variable { color: #dfaf8f; }
21
+ .cm-s-zenburn span.cm-variable-2 { color: #dcdccc; }
22
+ .cm-s-zenburn span.cm-string { color: #cc9393; }
23
+ .cm-s-zenburn span.cm-string-2 { color: #cc9393; }
24
+ .cm-s-zenburn span.cm-number { color: #dcdccc; }
25
+ .cm-s-zenburn span.cm-tag { color: #93e0e3; }
26
+ .cm-s-zenburn span.cm-property { color: #dfaf8f; }
27
+ .cm-s-zenburn span.cm-attribute { color: #dfaf8f; }
28
+ .cm-s-zenburn span.cm-qualifier { color: #7cb8bb; }
29
+ .cm-s-zenburn span.cm-meta { color: #f0dfaf; }
30
+ .cm-s-zenburn span.cm-header { color: #f0efd0; }
31
+ .cm-s-zenburn span.cm-operator { color: #f0efd0; }
32
+ .cm-s-zenburn span.CodeMirror-matchingbracket { box-sizing: border-box; background: transparent; border-bottom: 1px solid; }
33
+ .cm-s-zenburn span.CodeMirror-nonmatchingbracket { border-bottom: 1px solid; background: none; }
34
+ .cm-s-zenburn .CodeMirror-activeline { background: #000000; }
35
+ .cm-s-zenburn .CodeMirror-activeline-background { background: #000000; }
36
+ .cm-s-zenburn .CodeMirror-selected { background: #545454; }
37
+ .cm-s-zenburn .CodeMirror-focused .CodeMirror-selected { background: #4f4f4f; }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codemirror-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: '4.8'
4
+ version: '4.9'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Fixler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-22 00:00:00.000000000 Z
11
+ date: 2015-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -213,6 +213,7 @@ files:
213
213
  - vendor/assets/javascripts/codemirror/addons/comment/continuecomment.js
214
214
  - vendor/assets/javascripts/codemirror/addons/dialog/dialog.js
215
215
  - vendor/assets/javascripts/codemirror/addons/display/fullscreen.js
216
+ - vendor/assets/javascripts/codemirror/addons/display/panel.js
216
217
  - vendor/assets/javascripts/codemirror/addons/display/placeholder.js
217
218
  - vendor/assets/javascripts/codemirror/addons/display/rulers.js
218
219
  - vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js
@@ -232,7 +233,6 @@ files:
232
233
  - vendor/assets/javascripts/codemirror/addons/hint/css-hint.js
233
234
  - vendor/assets/javascripts/codemirror/addons/hint/html-hint.js
234
235
  - vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js
235
- - vendor/assets/javascripts/codemirror/addons/hint/python-hint.js
236
236
  - vendor/assets/javascripts/codemirror/addons/hint/show-hint.js
237
237
  - vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js
238
238
  - vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js
@@ -251,8 +251,11 @@ files:
251
251
  - vendor/assets/javascripts/codemirror/addons/runmode/runmode-standalone.js
252
252
  - vendor/assets/javascripts/codemirror/addons/runmode/runmode.js
253
253
  - vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js
254
+ - vendor/assets/javascripts/codemirror/addons/scroll/annotatescrollbar.js
254
255
  - vendor/assets/javascripts/codemirror/addons/scroll/scrollpastend.js
256
+ - vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.js
255
257
  - vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js
258
+ - vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.js
256
259
  - vendor/assets/javascripts/codemirror/addons/search/search.js
257
260
  - vendor/assets/javascripts/codemirror/addons/search/searchcursor.js
258
261
  - vendor/assets/javascripts/codemirror/addons/selection/active-line.js
@@ -273,11 +276,13 @@ files:
273
276
  - vendor/assets/javascripts/codemirror/modes/css.js
274
277
  - vendor/assets/javascripts/codemirror/modes/cypher.js
275
278
  - vendor/assets/javascripts/codemirror/modes/d.js
279
+ - vendor/assets/javascripts/codemirror/modes/dart.js
276
280
  - vendor/assets/javascripts/codemirror/modes/diff.js
277
281
  - vendor/assets/javascripts/codemirror/modes/django.js
278
282
  - vendor/assets/javascripts/codemirror/modes/dockerfile.js
279
283
  - vendor/assets/javascripts/codemirror/modes/dtd.js
280
284
  - vendor/assets/javascripts/codemirror/modes/dylan.js
285
+ - vendor/assets/javascripts/codemirror/modes/ebnf.js
281
286
  - vendor/assets/javascripts/codemirror/modes/ecl.js
282
287
  - vendor/assets/javascripts/codemirror/modes/eiffel.js
283
288
  - vendor/assets/javascripts/codemirror/modes/erlang.js
@@ -331,7 +336,9 @@ files:
331
336
  - vendor/assets/javascripts/codemirror/modes/smarty.js
332
337
  - vendor/assets/javascripts/codemirror/modes/smartymixed.js
333
338
  - vendor/assets/javascripts/codemirror/modes/solr.js
339
+ - vendor/assets/javascripts/codemirror/modes/soy.js
334
340
  - vendor/assets/javascripts/codemirror/modes/sparql.js
341
+ - vendor/assets/javascripts/codemirror/modes/spreadsheet.js
335
342
  - vendor/assets/javascripts/codemirror/modes/sql.js
336
343
  - vendor/assets/javascripts/codemirror/modes/stex.js
337
344
  - vendor/assets/javascripts/codemirror/modes/tcl.js
@@ -356,6 +363,8 @@ files:
356
363
  - vendor/assets/stylesheets/codemirror/addons/hint/show-hint.css
357
364
  - vendor/assets/stylesheets/codemirror/addons/lint/lint.css
358
365
  - vendor/assets/stylesheets/codemirror/addons/merge/merge.css
366
+ - vendor/assets/stylesheets/codemirror/addons/scroll/simplescrollbars.css
367
+ - vendor/assets/stylesheets/codemirror/addons/search/matchesonscrollbar.css
359
368
  - vendor/assets/stylesheets/codemirror/addons/tern/tern.css
360
369
  - vendor/assets/stylesheets/codemirror/modes/tiddlywiki.css
361
370
  - vendor/assets/stylesheets/codemirror/modes/tiki.css
@@ -384,11 +393,13 @@ files:
384
393
  - vendor/assets/stylesheets/codemirror/themes/rubyblue.css
385
394
  - vendor/assets/stylesheets/codemirror/themes/solarized.css
386
395
  - vendor/assets/stylesheets/codemirror/themes/the-matrix.css
396
+ - vendor/assets/stylesheets/codemirror/themes/tomorrow-night-bright.css
387
397
  - vendor/assets/stylesheets/codemirror/themes/tomorrow-night-eighties.css
388
398
  - vendor/assets/stylesheets/codemirror/themes/twilight.css
389
399
  - vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css
390
400
  - vendor/assets/stylesheets/codemirror/themes/xq-dark.css
391
401
  - vendor/assets/stylesheets/codemirror/themes/xq-light.css
402
+ - vendor/assets/stylesheets/codemirror/themes/zenburn.css
392
403
  homepage: https://rubygems.org/gems/codemirror-rails
393
404
  licenses:
394
405
  - MIT
@@ -1,102 +0,0 @@
1
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
- // Distributed under an MIT license: http://codemirror.net/LICENSE
3
-
4
- (function(mod) {
5
- if (typeof exports == "object" && typeof module == "object") // CommonJS
6
- mod(require("../../lib/codemirror"));
7
- else if (typeof define == "function" && define.amd) // AMD
8
- define(["../../lib/codemirror"], mod);
9
- else // Plain browser env
10
- mod(CodeMirror);
11
- })(function(CodeMirror) {
12
- "use strict";
13
-
14
- function forEach(arr, f) {
15
- for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
16
- }
17
-
18
- function arrayContains(arr, item) {
19
- if (!Array.prototype.indexOf) {
20
- var i = arr.length;
21
- while (i--) {
22
- if (arr[i] === item) {
23
- return true;
24
- }
25
- }
26
- return false;
27
- }
28
- return arr.indexOf(item) != -1;
29
- }
30
-
31
- function scriptHint(editor, _keywords, getToken) {
32
- // Find the token at the cursor
33
- var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
34
- // If it's not a 'word-style' token, ignore the token.
35
-
36
- if (!/^[\w$_]*$/.test(token.string)) {
37
- token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
38
- className: token.string == ":" ? "python-type" : null};
39
- }
40
-
41
- if (!context) var context = [];
42
- context.push(tprop);
43
-
44
- var completionList = getCompletions(token, context);
45
- completionList = completionList.sort();
46
-
47
- return {list: completionList,
48
- from: CodeMirror.Pos(cur.line, token.start),
49
- to: CodeMirror.Pos(cur.line, token.end)};
50
- }
51
-
52
- function pythonHint(editor) {
53
- return scriptHint(editor, pythonKeywordsU, function (e, cur) {return e.getTokenAt(cur);});
54
- }
55
- CodeMirror.registerHelper("hint", "python", pythonHint);
56
-
57
- var pythonKeywords = "and del from not while as elif global or with assert else if pass yield"
58
- + "break except import print class exec in raise continue finally is return def for lambda try";
59
- var pythonKeywordsL = pythonKeywords.split(" ");
60
- var pythonKeywordsU = pythonKeywords.toUpperCase().split(" ");
61
-
62
- var pythonBuiltins = "abs divmod input open staticmethod all enumerate int ord str "
63
- + "any eval isinstance pow sum basestring execfile issubclass print super"
64
- + "bin file iter property tuple bool filter len range type"
65
- + "bytearray float list raw_input unichr callable format locals reduce unicode"
66
- + "chr frozenset long reload vars classmethod getattr map repr xrange"
67
- + "cmp globals max reversed zip compile hasattr memoryview round __import__"
68
- + "complex hash min set apply delattr help next setattr buffer"
69
- + "dict hex object slice coerce dir id oct sorted intern ";
70
- var pythonBuiltinsL = pythonBuiltins.split(" ").join("() ").split(" ");
71
- var pythonBuiltinsU = pythonBuiltins.toUpperCase().split(" ").join("() ").split(" ");
72
-
73
- function getCompletions(token, context) {
74
- var found = [], start = token.string;
75
- function maybeAdd(str) {
76
- if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str);
77
- }
78
-
79
- function gatherCompletions(_obj) {
80
- forEach(pythonBuiltinsL, maybeAdd);
81
- forEach(pythonBuiltinsU, maybeAdd);
82
- forEach(pythonKeywordsL, maybeAdd);
83
- forEach(pythonKeywordsU, maybeAdd);
84
- }
85
-
86
- if (context) {
87
- // If this is a property, see if it belongs to some object we can
88
- // find in the current environment.
89
- var obj = context.pop(), base;
90
-
91
- if (obj.type == "variable")
92
- base = obj.string;
93
- else if(obj.type == "variable-3")
94
- base = ":" + obj.string;
95
-
96
- while (base != null && context.length)
97
- base = base[context.pop().string];
98
- if (base != null) gatherCompletions(base);
99
- }
100
- return found;
101
- }
102
- });