Showing with 2,396 additions and 1,023 deletions.
  1. +5 −0 AUTHORS
  2. +3 −0 addon/comment/comment.js
  3. +3 −0 addon/comment/continuecomment.js
  4. +3 −0 addon/dialog/dialog.js
  5. +3 −0 addon/display/fullscreen.js
  6. +3 −0 addon/display/placeholder.js
  7. +16 −6 addon/display/rulers.js
  8. +3 −0 addon/edit/closebrackets.js
  9. +28 −3 addon/edit/closetag.js
  10. +3 −0 addon/edit/continuelist.js
  11. +3 −0 addon/edit/matchbrackets.js
  12. +3 −0 addon/edit/matchtags.js
  13. +3 −0 addon/edit/trailingspace.js
  14. +3 −0 addon/fold/brace-fold.js
  15. +3 −0 addon/fold/comment-fold.js
  16. +36 −8 addon/fold/foldcode.js
  17. +3 −0 addon/fold/foldgutter.js
  18. +3 −0 addon/fold/indent-fold.js
  19. +3 −0 addon/fold/markdown-fold.js
  20. +4 −1 addon/fold/xml-fold.js
  21. +3 −0 addon/hint/anyword-hint.js
  22. +3 −0 addon/hint/css-hint.js
  23. +3 −0 addon/hint/html-hint.js
  24. +7 −2 addon/hint/javascript-hint.js
  25. +3 −0 addon/hint/python-hint.js
  26. +74 −36 addon/hint/show-hint.js
  27. +3 −0 addon/hint/sql-hint.js
  28. +3 −0 addon/hint/xml-hint.js
  29. +3 −0 addon/lint/coffeescript-lint.js
  30. +3 −0 addon/lint/css-lint.js
  31. +3 −0 addon/lint/javascript-lint.js
  32. +3 −0 addon/lint/json-lint.js
  33. +3 −0 addon/lint/lint.js
  34. +3 −0 addon/lint/yaml-lint.js
  35. +0 −50 addon/merge/dep/diff_match_patch.js
  36. +3 −0 addon/merge/merge.js
  37. +3 −0 addon/mode/loadmode.js
  38. +3 −0 addon/mode/multiplex.js
  39. +3 −0 addon/mode/multiplex_test.js
  40. +12 −3 addon/mode/overlay.js
  41. +3 −0 addon/runmode/colorize.js
  42. +4 −1 addon/runmode/runmode-standalone.js
  43. +4 −1 addon/runmode/runmode.js
  44. +4 −1 addon/runmode/runmode.node.js
  45. +3 −0 addon/scroll/scrollpastend.js
  46. +6 −2 addon/search/match-highlighter.js
  47. +3 −0 addon/search/search.js
  48. +3 −0 addon/search/searchcursor.js
  49. +3 −0 addon/selection/active-line.js
  50. +3 −0 addon/selection/mark-selection.js
  51. +1 −0 addon/tern/tern.css
  52. +23 −16 addon/tern/tern.js
  53. +3 −0 addon/tern/worker.js
  54. +3 −0 addon/wrap/hardwrap.js
  55. +1 −1 demo/anywordhint.html
  56. +1 −1 demo/folding.html
  57. +1 −1 demo/merge.html
  58. +2 −7 demo/rulers.html
  59. +2 −0 demo/theme.html
  60. +11 −0 demo/vim.html
  61. +4 −5 demo/xmlcomplete.html
  62. +40 −3 doc/compress.html
  63. +35 −22 doc/manual.html
  64. +5 −0 doc/realworld.html
  65. +17 −0 doc/releases.html
  66. +1 −1 index.html
  67. +4 −7 keymap/emacs.js
  68. +11 −8 keymap/sublime.js
  69. +92 −33 keymap/vim.js
  70. +133 −58 lib/codemirror.js
  71. +3 −0 mode/apl/apl.js
  72. +3 −0 mode/asterisk/asterisk.js
  73. +3 −0 mode/clike/clike.js
  74. +3 −0 mode/clojure/clojure.js
  75. +3 −0 mode/cobol/cobol.js
  76. +3 −0 mode/coffeescript/coffeescript.js
  77. +3 −0 mode/commonlisp/commonlisp.js
  78. +13 −14 mode/css/css.js
  79. +3 −0 mode/css/less_test.js
  80. +3 −0 mode/css/scss_test.js
  81. +13 −0 mode/css/test.js
  82. +146 −0 mode/cypher/cypher.js
  83. +63 −0 mode/cypher/index.html
  84. +3 −0 mode/d/d.js
  85. +3 −0 mode/diff/diff.js
  86. +3 −0 mode/django/django.js
  87. +3 −0 mode/dtd/dtd.js
  88. +15 −0 mode/dylan/dylan.js
  89. +3 −0 mode/ecl/ecl.js
  90. +3 −0 mode/eiffel/eiffel.js
  91. +3 −0 mode/erlang/erlang.js
  92. +3 −0 mode/fortran/fortran.js
  93. +3 −0 mode/gas/gas.js
  94. +9 −1 mode/gfm/gfm.js
  95. +24 −0 mode/gfm/test.js
  96. +3 −0 mode/gherkin/gherkin.js
  97. +3 −0 mode/go/go.js
  98. +3 −0 mode/groovy/groovy.js
  99. +3 −0 mode/haml/haml.js
  100. +3 −0 mode/haml/test.js
  101. +3 −0 mode/haskell/haskell.js
  102. +5 −1 mode/haxe/haxe.js
  103. +3 −0 mode/htmlembedded/htmlembedded.js
  104. +3 −0 mode/htmlmixed/htmlmixed.js
  105. +3 −0 mode/http/http.js
  106. +1 −0 mode/index.html
  107. +6 −2 mode/jade/index.html
  108. +569 −81 mode/jade/jade.js
  109. +5 −0 mode/javascript/javascript.js
  110. +3 −0 mode/javascript/test.js
  111. +3 −0 mode/jinja2/jinja2.js
  112. +3 −0 mode/julia/julia.js
  113. +17 −17 mode/livescript/livescript.js
  114. +0 −266 mode/livescript/livescript.ls
  115. +3 −0 mode/lua/lua.js
  116. +5 −3 mode/markdown/markdown.js
  117. +30 −0 mode/markdown/test.js
  118. +4 −0 mode/meta.js
  119. +3 −0 mode/mirc/mirc.js
  120. +3 −0 mode/mllike/mllike.js
  121. +3 −0 mode/nginx/nginx.js
  122. +3 −0 mode/ntriples/ntriples.js
  123. +3 −0 mode/octave/octave.js
  124. +3 −0 mode/pascal/pascal.js
  125. +3 −0 mode/pegjs/pegjs.js
  126. +5 −0 mode/perl/perl.js
  127. +5 −2 mode/php/php.js
  128. +3 −0 mode/php/test.js
  129. +3 −0 mode/pig/pig.js
  130. +3 −0 mode/properties/properties.js
  131. +3 −0 mode/puppet/puppet.js
  132. +284 −328 mode/python/python.js
  133. +3 −0 mode/q/q.js
  134. +3 −0 mode/r/r.js
  135. +3 −0 mode/rpm/rpm.js
  136. +3 −0 mode/rst/rst.js
  137. +3 −0 mode/ruby/ruby.js
  138. +3 −0 mode/ruby/test.js
  139. +3 −0 mode/rust/rust.js
  140. +3 −0 mode/sass/sass.js
  141. +3 −0 mode/scheme/scheme.js
  142. +9 −2 mode/shell/shell.js
  143. +58 −0 mode/shell/test.js
  144. +3 −0 mode/sieve/sieve.js
  145. +3 −0 mode/smalltalk/smalltalk.js
  146. +3 −0 mode/smarty/smarty.js
  147. +3 −0 mode/smartymixed/smartymixed.js
  148. +3 −0 mode/solr/solr.js
  149. +3 −0 mode/sparql/sparql.js
  150. +3 −0 mode/sql/sql.js
  151. +3 −0 mode/stex/stex.js
  152. +3 −0 mode/stex/test.js
  153. +3 −0 mode/tcl/tcl.js
  154. +3 −0 mode/tiddlywiki/tiddlywiki.js
  155. +3 −0 mode/tiki/tiki.js
  156. +3 −0 mode/toml/toml.js
  157. +3 −0 mode/turtle/turtle.js
  158. +3 −0 mode/vb/vb.js
  159. +3 −0 mode/vbscript/vbscript.js
  160. +3 −0 mode/velocity/velocity.js
  161. +3 −0 mode/verilog/test.js
  162. +3 −0 mode/verilog/verilog.js
  163. +3 −0 mode/xml/test.js
  164. +4 −1 mode/xml/xml.js
  165. +3 −0 mode/xquery/test.js
  166. +3 −0 mode/xquery/xquery.js
  167. +3 −0 mode/yaml/yaml.js
  168. +3 −0 mode/z80/z80.js
  169. +1 −1 package.json
  170. +4 −4 test/emacs_test.js
  171. +2 −0 test/index.html
  172. +6 −1 test/lint/lint.js
  173. +13 −0 test/mode_test.css
  174. +42 −20 test/mode_test.js
  175. +6 −0 test/sublime_test.js
  176. +13 −0 test/test.js
  177. +53 −2 test/vim_test.js
  178. +40 −0 theme/neo.css
5 changes: 5 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Amy
Ananya Sen
anaran
AndersMad
Anders Nawroth
Anderson Mesquita
Andre von Houck
Andrey Lushnikov
Expand All @@ -44,6 +45,7 @@ AtomicPages LLC
Atul Bhouraskar
Aurelian Oancea
Bastian Müller
Bem Jones-Bey
benbro
Beni Cherniavsky-Paskin
Benjamin DeCoste
Expand Down Expand Up @@ -73,6 +75,7 @@ CodeAnimal
ComFreek
Curtis Gagliardi
dagsta
daines
Dan Heberden
Daniel, Dao Quang Minh
Daniel Faust
Expand All @@ -82,6 +85,7 @@ Daniel Neel
Daniel Parnell
Danny Yoo
Darius Roberts
Dave Myers
David Mignot
David Pathakjee
deebugger
Expand Down Expand Up @@ -263,6 +267,7 @@ Nikolay Kostov
nlwillia
pablo
Page
Panupong Pasupat
paris
Patil Arpith
Patrick Strawderman
Expand Down
3 changes: 3 additions & 0 deletions addon/comment/comment.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
3 changes: 3 additions & 0 deletions addon/comment/continuecomment.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
3 changes: 3 additions & 0 deletions addon/dialog/dialog.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

// Open simple dialogs on top of an editor. Relies on dialog.css.

(function(mod) {
Expand Down
3 changes: 3 additions & 0 deletions addon/display/fullscreen.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
3 changes: 3 additions & 0 deletions addon/display/placeholder.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
22 changes: 16 additions & 6 deletions addon/display/rulers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down Expand Up @@ -34,15 +37,22 @@
var minH = cm.display.scroller.offsetHeight + 30;
for (var i = 0; i < val.length; i++) {
var elt = document.createElement("div");
var col, cls = null;
if (typeof val[i] == "number") {
col = val[i];
elt.className = "CodeMirror-ruler";
var col, cls = null, conf = val[i];
if (typeof conf == "number") {
col = conf;
} else {
col = val[i].column;
col = conf.column;
if (conf.className) elt.className = " " + conf.className;
if (conf.color) elt.style.borderColor = conf.color;
if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle;
if (conf.width) elt.style.borderLeftWidth = conf.width;
cls = val[i].className;
}
elt.className = "CodeMirror-ruler" + (cls ? " " + cls : "");
elt.style.cssText = "left: " + (left + col * cw) + "px; top: -50px; bottom: -20px; min-height: " + minH + "px";
elt.style.left = (left + col * cw) + "px";
elt.style.top = "-50px";
elt.style.bottom = "-20px";
elt.style.minHeight = minH + "px";
cm.display.lineSpace.insertBefore(elt, cm.display.cursorDiv);
}
}
Expand Down
3 changes: 3 additions & 0 deletions addon/edit/closebrackets.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
31 changes: 28 additions & 3 deletions addon/edit/closetag.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

/**
* Tag-closer extension for CodeMirror.
*
Expand Down Expand Up @@ -55,6 +58,7 @@
var pos = ranges[i].head, tok = cm.getTokenAt(pos);
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
if (inner.mode.name != "xml" || !state.tagName) return CodeMirror.Pass;

var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html";
var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
Expand All @@ -68,8 +72,7 @@
tok.type == "tag" && state.type == "closeTag" ||
tok.string.indexOf("/") == (tok.string.length - 1) || // match something like <someTagName />
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
CodeMirror.scanForClosingTag && CodeMirror.scanForClosingTag(cm, pos, tagName,
Math.min(cm.lastLine() + 1, pos.line + 50)))
closingTagExists(cm, tagName, pos, state, true))
return CodeMirror.Pass;

var indent = indentTags && indexOf(indentTags, lowerTagName) > -1;
Expand Down Expand Up @@ -100,7 +103,8 @@
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
if (tok.type == "string" || tok.string.charAt(0) != "<" ||
tok.start != pos.ch - 1 || inner.mode.name != "xml" ||
!state.context || !state.context.tagName)
!state.context || !state.context.tagName ||
closingTagExists(cm, state.context.tagName, pos, state))
return CodeMirror.Pass;
replacements[i] = "/" + state.context.tagName + ">";
}
Expand All @@ -113,4 +117,25 @@
if (collection[i] == elt) return i;
return -1;
}

// If xml-fold is loaded, we use its functionality to try and verify
// whether a given tag is actually unclosed.
function closingTagExists(cm, tagName, pos, state, newTag) {
if (!CodeMirror.scanForClosingTag) return false;
var end = Math.min(cm.lastLine() + 1, pos.line + 500);
var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);
if (!nextClose || nextClose.tag != tagName) return false;
var cx = state.context;
// If the immediate wrapping context contains onCx instances of
// the same tag, a closing tag only exists if there are at least
// that many closing tags of that type following.
for (var onCx = newTag ? 1 : 0; cx && cx.tagName == tagName; cx = cx.prev) ++onCx;
pos = nextClose.to;
for (var i = 1; i < onCx; i++) {
var next = CodeMirror.scanForClosingTag(cm, pos, null, end);
if (!next || next.tag != tagName) return false;
pos = next.to;
}
return true;
}
});
3 changes: 3 additions & 0 deletions addon/edit/continuelist.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
3 changes: 3 additions & 0 deletions addon/edit/matchbrackets.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
3 changes: 3 additions & 0 deletions addon/edit/matchtags.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
Expand Down
3 changes: 3 additions & 0 deletions addon/edit/trailingspace.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
3 changes: 3 additions & 0 deletions addon/fold/brace-fold.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
3 changes: 3 additions & 0 deletions addon/fold/comment-fold.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
44 changes: 36 additions & 8 deletions addon/fold/foldcode.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand All @@ -9,10 +12,14 @@
"use strict";

function doFold(cm, pos, options, force) {
var finder = options && (options.call ? options : options.rangeFinder);
if (!finder) finder = CodeMirror.fold.auto;
if (options && options.call) {
var finder = options;
options = null;
} else {
var finder = getOption(cm, options, "rangeFinder");
}
if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
var minSize = options && options.minFoldSize || 0;
var minSize = getOption(cm, options, "minFoldSize");

function getRange(allowFolded) {
var range = finder(cm, pos);
Expand All @@ -29,14 +36,17 @@
}

var range = getRange(true);
if (options && options.scanUp) while (!range && pos.line > cm.firstLine()) {
if (getOption(cm, options, "scanUp")) while (!range && pos.line > cm.firstLine()) {
pos = CodeMirror.Pos(pos.line - 1, 0);
range = getRange(false);
}
if (!range || range.cleared || force === "unfold") return;

var myWidget = makeWidget(options);
CodeMirror.on(myWidget, "mousedown", function() { myRange.clear(); });
var myWidget = makeWidget(cm, options);
CodeMirror.on(myWidget, "mousedown", function(e) {
myRange.clear();
CodeMirror.e_preventDefault(e);
});
var myRange = cm.markText(range.from, range.to, {
replacedWith: myWidget,
clearOnEnter: true,
Expand All @@ -48,8 +58,8 @@
CodeMirror.signal(cm, "fold", cm, range.from, range.to);
}

function makeWidget(options) {
var widget = (options && options.widget) || "\u2194";
function makeWidget(cm, options) {
var widget = getOption(cm, options, "widget");
if (typeof widget == "string") {
var text = document.createTextNode(widget);
widget = document.createElement("span");
Expand Down Expand Up @@ -114,4 +124,22 @@
if (cur) return cur;
}
});

var defaultOptions = {
rangeFinder: CodeMirror.fold.auto,
widget: "\u2194",
minFoldSize: 0,
scanUp: false
};

CodeMirror.defineOption("foldOptions", null);

function getOption(cm, options, name) {
if (options && options[name] !== undefined)
return options[name];
var editorOptions = cm.options.foldOptions;
if (editorOptions && editorOptions[name] !== undefined)
return editorOptions[name];
return defaultOptions[name];
}
});
3 changes: 3 additions & 0 deletions addon/fold/foldgutter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("./foldcode"));
Expand Down
3 changes: 3 additions & 0 deletions addon/fold/indent-fold.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
3 changes: 3 additions & 0 deletions addon/fold/markdown-fold.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
5 changes: 4 additions & 1 deletion addon/fold/xml-fold.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down Expand Up @@ -173,6 +176,6 @@
// Used by addon/edit/closetag.js
CodeMirror.scanForClosingTag = function(cm, pos, name, end) {
var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null);
return !!findMatchingClose(iter, name);
return findMatchingClose(iter, name);
};
});
3 changes: 3 additions & 0 deletions addon/hint/anyword-hint.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
3 changes: 3 additions & 0 deletions addon/hint/css-hint.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../../mode/css/css"));
Expand Down
3 changes: 3 additions & 0 deletions addon/hint/html-hint.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
9 changes: 7 additions & 2 deletions addon/hint/javascript-hint.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down Expand Up @@ -108,7 +111,8 @@
if (obj.type && obj.type.indexOf("variable") === 0) {
if (options && options.additionalContext)
base = options.additionalContext[obj.string];
base = base || window[obj.string];
if (!options || options.useGlobalScope !== false)
base = base || window[obj.string];
} else if (obj.type == "string") {
base = "";
} else if (obj.type == "atom") {
Expand All @@ -128,7 +132,8 @@
// (reading into JS mode internals to get at the local and global variables)
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name);
gatherCompletions(window);
if (!options || options.useGlobalScope !== false)
gatherCompletions(window);
forEach(keywords, maybeAdd);
}
return found;
Expand Down
3 changes: 3 additions & 0 deletions addon/hint/python-hint.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down
Loading