PluginProbe ʕ •ᴥ•ʔ
SiteOrigin CSS / 1.3.2
SiteOrigin CSS v1.3.2
1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.10 1.5.11 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0
so-css / lib / codemirror / addon / hint / anyword-hint.js
so-css / lib / codemirror / addon / hint Last commit date
anyword-hint.js 10 years ago anyword-hint.min.js 6 years ago css-hint.js 11 years ago css-hint.min.js 6 years ago html-hint.js 11 years ago html-hint.min.js 6 years ago javascript-hint.js 9 years ago javascript-hint.min.js 6 years ago show-hint.css 9 years ago show-hint.js 9 years ago show-hint.min.js 6 years ago sql-hint.js 9 years ago sql-hint.min.js 6 years ago xml-hint.js 11 years ago xml-hint.min.js 6 years ago
anyword-hint.js
42 lines
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 var WORD = /[\w$]+/, RANGE = 500;
15
16 CodeMirror.registerHelper("hint", "anyword", function(editor, options) {
17 var word = options && options.word || WORD;
18 var range = options && options.range || RANGE;
19 var cur = editor.getCursor(), curLine = editor.getLine(cur.line);
20 var end = cur.ch, start = end;
21 while (start && word.test(curLine.charAt(start - 1))) --start;
22 var curWord = start != end && curLine.slice(start, end);
23
24 var list = options && options.list || [], seen = {};
25 var re = new RegExp(word.source, "g");
26 for (var dir = -1; dir <= 1; dir += 2) {
27 var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir;
28 for (; line != endLine; line += dir) {
29 var text = editor.getLine(line), m;
30 while (m = re.exec(text)) {
31 if (line == cur.line && m[0] === curWord) continue;
32 if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) {
33 seen[m[0]] = true;
34 list.push(m[0]);
35 }
36 }
37 }
38 }
39 return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)};
40 });
41 });
42