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