{
+ var allVariables = []
+ var tmpVariables = []
+
+ for(var i=0; i < actionlist.length; i++){
+ allVariables.push('$'+actionlist[i].autocomplete.toLowerCase())
+ tmpVariables.push('$'+actionlist[i].autocomplete.toLowerCase())
+
+ var parsedPaths = []
+ if (typeof actionlist[i].example === "object") {
+ parsedPaths = GetParsedPaths(actionlist[i].example, "");
+ }
+
+ for (var key in parsedPaths) {
+ const fullpath = "$"+actionlist[i].autocomplete.toLowerCase()+parsedPaths[key].autocomplete
+ if (!allVariables.includes(fullpath)) {
+ allVariables.push(fullpath)
+ }
+ }
}
- }
- // {actionlist.map((data, index) => {
- // console.log(data)
- // console.log(actionlist.length)
- // console.log(data.autocomplete)
- // allVariable.push('$'+data.autocomplete.substring(0, 25))
- // return (
- //
- //
- //
- // )
- // })}
+ setAvailableVariables(allVariables)
+ setMainVariables(tmpVariables)
+ }, [])
const autoFormat = (input) => {
if (validation !== true) {
@@ -134,7 +114,7 @@ const CodeEditor = (props) => {
}
}
- function findIndex(line, loc) {
+ const findIndex = (line, loc) => {
// var temp_arr = []
// for(var i=0; i {
if(loc === variable_ranges[occ][occ1]){
popup = true
setCurrentLocation([line, dollar_occurences[occ]])
- console.log("Current Location : "+dollar_occurences[occ])
+
try{
setCurrentVariable(variable_occurences[occ])
- console.log("Current Variable : "+variable_occurences[occ])
+
} catch (e) {
// setCurrentVariable("")
// console.log("Current Variable : Nothing")
}
+
occ = Infinity
break
}
@@ -210,7 +191,7 @@ const CodeEditor = (props) => {
// console.log(dollar_occurences)
}
- function highlight_variables(value){
+ const highlight_variables = (value) => {
// value.markText({line:0, ch:2}, {line:0, ch:8}, {"css": "background-color: #f85a3e; border-radius: 4px; color: white"})
// value.markText({line:0, ch:13}, {line:0, ch:15}, {"css": "background-color: #f85a3e; border-radius: 4px; color: white"})
// value.markText({line:0, ch:19}, {line:0, ch:26}, {"css": "background-color: #f85a3e; border-radius: 4px; color: white"})
@@ -230,7 +211,7 @@ const CodeEditor = (props) => {
// console.log(code_variables_loc)
var code_lines = localcodedata.split('\n')
- for (var i = 0; i {
dollar_occurence.push(ch)
}
}
- console.log(dollar_occurence)
+ //console.log(dollar_occurence)
var dollar_occurence_len = []
try{
@@ -262,14 +243,15 @@ const CodeEditor = (props) => {
dollar_occurence_len.push(variable_occurence[occ].length)
}
} catch (e) {}
- console.log(dollar_occurence_len)
+
+ //console.log(dollar_occurence_len)
try{
// console.log(variable_occurence)
- for (var occ = 0; occ action.autocomplete.toLowerCase() === variable_occurence[occ].slice(1,).toLowerCase())
- var correctVariable = allVariable.includes(variable_occurence[occ].toLowerCase())
+ var correctVariable = availableVariables.includes(variable_occurence[occ].toLowerCase())
// console.log(actionlist)
if(!correctVariable) {
value.markText({line:i, ch:dollar_occurence[occ]}, {line:i, ch:dollar_occurence_len[occ]+dollar_occurence[occ]}, {"css": "background-color: rgb(248, 106, 62, 0.9); padding-top: 2px; padding-bottom: 2px; color: white"})
@@ -299,7 +281,7 @@ const CodeEditor = (props) => {
// return ""
// }
- function replaceVariables(swapVariable){
+ const replaceVariables = (swapVariable) => {
// var updatedCode = localcodedata.slice(0,index) + "$" + str + localcodedata.slice(index+currentVariable.length+1,)
// setlocalcodedata(updatedCode)
// setEditorPopupOpen(false)
@@ -321,7 +303,7 @@ const CodeEditor = (props) => {
setlocalcodedata(updatedCode)
}
- function expectedOutput(input) {
+ const expectedOutput = (input) => {
const found = input.match(/[$]{1}([a-zA-Z0-9_-]+\.?){1}([a-zA-Z0-9#_-]+\.?){0,}/g)
//console.log(found)
@@ -359,8 +341,9 @@ const CodeEditor = (props) => {
return
}
- setlocalcodedata(localcodedata+" "+item.value)
+ setlocalcodedata(localcodedata+" | "+item.value+" }}")
setAnchorEl(null)
+ setAnchorEl2(null)
}
return (
@@ -425,41 +408,78 @@ const CodeEditor = (props) => {
-
-
+
+
+
+
+
+