mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 15:24:00 +01:00
Jump to Definition variations setup
If something is selected and we have an orig cursor pos, set it back to that. If not, we set the orig cursor pos, define an array of possible definition matches and attempt to find them one after another in a for loop, escaping when we do. Altered findReplace function to provide a return of true or false depending on if anything is found.
This commit is contained in:
@@ -412,11 +412,22 @@ var ICEcoder = {
|
||||
|
||||
// Jump to and highlight the function definition current token
|
||||
jumpToDefinition: function() {
|
||||
var cM, tokenString;
|
||||
var cM, tokenString, defVars;
|
||||
|
||||
cM = ICEcoder.getcMInstance();
|
||||
tokenString = cM.getTokenAt(cM.getCursor()).string;
|
||||
top.ICEcoder.findReplace("function "+tokenString,false,true);
|
||||
|
||||
if (cM.somethingSelected() && top.ICEcoder.origCurorPos) {
|
||||
cM.setCursor(top.ICEcoder.origCurorPos);
|
||||
} else {
|
||||
top.ICEcoder.origCurorPos = cM.getCursor();
|
||||
defVars = ["var "+tokenString, "function "+tokenString, tokenString+"=function", tokenString+"=new function", tokenString+":", "def "+tokenString, "class "+tokenString];
|
||||
for (var i=0; i<defVars.length; i++) {
|
||||
if (top.ICEcoder.findReplace(defVars[i],false,true)) {
|
||||
i=defVars.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// ==============
|
||||
@@ -966,8 +977,10 @@ var ICEcoder = {
|
||||
cM.focus();
|
||||
top.ICEcoder.findMode = true;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
results.innerHTML = "No results";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// Show the relevant multiple results popup
|
||||
|
||||
Reference in New Issue
Block a user