mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-07 21:46:12 +08:00
代码提示调整
This commit is contained in:
parent
4ac8652cbe
commit
53a106702b
@ -27,7 +27,9 @@
|
||||
var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir;
|
||||
for (; line != endLine; line += dir) {
|
||||
var text = editor.getLine(line), m;
|
||||
while (m = re.exec(text)) {
|
||||
while (m = re.exec(text)) {
|
||||
// fix
|
||||
if (!curWord) continue;;
|
||||
if (line == cur.line && m[0] === curWord) continue;
|
||||
if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) {
|
||||
seen[m[0]] = true;
|
||||
|
@ -67,8 +67,8 @@
|
||||
})
|
||||
}
|
||||
// add specialVars
|
||||
var specialVars = localStorage['specialVars'].split(',')
|
||||
specialVars.forEach(s => {
|
||||
var specialVars = localStorage['specialVars']
|
||||
if(specialVars) specialVars.split(',').forEach(s => {
|
||||
if (s.toUpperCase().slice(2, token.string.length + 2) == token.string.toUpperCase()) hints.push(s)
|
||||
})
|
||||
}
|
||||
@ -123,7 +123,8 @@
|
||||
|
||||
// builtInFns and builtInObjs
|
||||
var builtInFns = ["Infinity", "NaN", "undefined", "globalThis", "eval", "isFinite", "isNaN", "parseFloat", "parseInt", "decodeURI", "decodeURIComponent",
|
||||
"encodeURI", "encodeURIComponent", "escape", "unescape", "RegExp", "Promise", "Generator", "GeneratorFunction", "AsyncFunction", "arguments", "require"]
|
||||
"encodeURI", "encodeURIComponent", "escape", "unescape", "RegExp", "Promise", "Generator", "GeneratorFunction", "AsyncFunction", "arguments", "require",
|
||||
"console.log", "console.error"]
|
||||
var builtInObjs = {
|
||||
Object: Object,
|
||||
Function: Function,
|
||||
@ -140,7 +141,6 @@
|
||||
JSON: JSON,
|
||||
String: String,
|
||||
Array: Array,
|
||||
console: { log: () => { }, error: () => { }}
|
||||
}
|
||||
|
||||
function forAllProps(obj, callback) {
|
||||
@ -162,7 +162,7 @@
|
||||
function maybeAdd(str) {
|
||||
// fix 2
|
||||
if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) {
|
||||
if(token.string != str) found.push(str);
|
||||
found.push(str);
|
||||
}
|
||||
}
|
||||
function gatherCompletions(obj) {
|
||||
|
@ -291,7 +291,7 @@
|
||||
menuSize: function() { return widget.screenAmount(); },
|
||||
length: completions.length,
|
||||
close: function() { completion.close(); },
|
||||
pick: function() { widget.pick(); },
|
||||
pick: function() { window.editor.off("change", showHint); widget.pick(); window.editor.on("change", showHint);},
|
||||
data: data
|
||||
}));
|
||||
|
||||
@ -320,7 +320,11 @@
|
||||
var t = getHintElement(hints, e.target || e.srcElement);
|
||||
if (t && t.hintId != null) {
|
||||
widget.changeActive(t.hintId);
|
||||
if (completion.options.completeOnSingleClick) widget.pick();
|
||||
if (completion.options.completeOnSingleClick) {
|
||||
window.editor.off("change", showHint);
|
||||
widget.pick();
|
||||
window.editor.on("change", showHint);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -450,7 +454,7 @@
|
||||
for (var i = 0; i < options.words.length; i++) {
|
||||
var word = options.words[i];
|
||||
if (word.slice(0, tokenstring.length) == tokenstring)
|
||||
if(word != tokenstring && !found.includes(word)) found.push(word);
|
||||
if(!found.includes(word)) found.push(word);
|
||||
}
|
||||
if (!term) {
|
||||
if (!tokenstring) return { list: {} }
|
||||
@ -463,8 +467,8 @@
|
||||
})
|
||||
}
|
||||
// add specialVars
|
||||
var specialVars = localStorage['specialVars'].split(',')
|
||||
specialVars.forEach(s => {
|
||||
var specialVars = localStorage['specialVars']
|
||||
if(specialVars) specialVars.split(',').forEach(s => {
|
||||
if (s.toUpperCase().slice(2, tokenstring.length + 2) == tokenstring.toUpperCase()) found.push(s)
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user