Update src/extensions/jg_debugging/index.js
Browse files
src/extensions/jg_debugging/index.js
CHANGED
|
@@ -3,6 +3,8 @@ const ArgumentType = require('../../extension-support/argument-type');
|
|
| 3 |
const Cast = require('../../util/cast');
|
| 4 |
const xmlEscape = require('../../util/xml-escape');
|
| 5 |
|
|
|
|
|
|
|
| 6 |
/**
|
| 7 |
* @param {string} line The line with the quote
|
| 8 |
* @param {number} index The point where the quote appears
|
|
@@ -174,12 +176,14 @@ class jgDebuggingBlocks {
|
|
| 174 |
{
|
| 175 |
opcode: 'openDebugger',
|
| 176 |
text: 'open debugger',
|
| 177 |
-
blockType: BlockType.COMMAND
|
|
|
|
| 178 |
},
|
| 179 |
{
|
| 180 |
opcode: 'closeDebugger',
|
| 181 |
text: 'close debugger',
|
| 182 |
-
blockType: BlockType.COMMAND
|
|
|
|
| 183 |
},
|
| 184 |
'---',
|
| 185 |
{
|
|
@@ -191,7 +195,9 @@ class jgDebuggingBlocks {
|
|
| 191 |
type: ArgumentType.STRING,
|
| 192 |
defaultValue: "Hello!"
|
| 193 |
}
|
| 194 |
-
}
|
|
|
|
|
|
|
| 195 |
},
|
| 196 |
{
|
| 197 |
opcode: 'warn',
|
|
@@ -202,7 +208,9 @@ class jgDebuggingBlocks {
|
|
| 202 |
type: ArgumentType.STRING,
|
| 203 |
defaultValue: "Warning"
|
| 204 |
}
|
| 205 |
-
}
|
|
|
|
|
|
|
| 206 |
},
|
| 207 |
{
|
| 208 |
opcode: 'error',
|
|
@@ -213,8 +221,15 @@ class jgDebuggingBlocks {
|
|
| 213 |
type: ArgumentType.STRING,
|
| 214 |
defaultValue: "Error"
|
| 215 |
}
|
| 216 |
-
}
|
|
|
|
|
|
|
| 217 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
]
|
| 219 |
};
|
| 220 |
}
|
|
@@ -390,6 +405,10 @@ class jgDebuggingBlocks {
|
|
| 390 |
console.error(text);
|
| 391 |
this._addLog(text, "color: red;");
|
| 392 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
}
|
| 394 |
|
| 395 |
-
module.exports = jgDebuggingBlocks;
|
|
|
|
| 3 |
const Cast = require('../../util/cast');
|
| 4 |
const xmlEscape = require('../../util/xml-escape');
|
| 5 |
|
| 6 |
+
const noopSwitch = { isNoop: true };
|
| 7 |
+
|
| 8 |
/**
|
| 9 |
* @param {string} line The line with the quote
|
| 10 |
* @param {number} index The point where the quote appears
|
|
|
|
| 176 |
{
|
| 177 |
opcode: 'openDebugger',
|
| 178 |
text: 'open debugger',
|
| 179 |
+
blockType: BlockType.COMMAND,
|
| 180 |
+
switches: [ noopSwitch, 'closeDebugger' ]
|
| 181 |
},
|
| 182 |
{
|
| 183 |
opcode: 'closeDebugger',
|
| 184 |
text: 'close debugger',
|
| 185 |
+
blockType: BlockType.COMMAND,
|
| 186 |
+
switches: [ 'openDebugger', noopSwitch ]
|
| 187 |
},
|
| 188 |
'---',
|
| 189 |
{
|
|
|
|
| 195 |
type: ArgumentType.STRING,
|
| 196 |
defaultValue: "Hello!"
|
| 197 |
}
|
| 198 |
+
},
|
| 199 |
+
switches: [ noopSwitch, 'warn', 'error' ],
|
| 200 |
+
switchText: 'log'
|
| 201 |
},
|
| 202 |
{
|
| 203 |
opcode: 'warn',
|
|
|
|
| 208 |
type: ArgumentType.STRING,
|
| 209 |
defaultValue: "Warning"
|
| 210 |
}
|
| 211 |
+
},
|
| 212 |
+
switches: [ 'log', noopSwitch, 'error' ],
|
| 213 |
+
switchText: 'warn'
|
| 214 |
},
|
| 215 |
{
|
| 216 |
opcode: 'error',
|
|
|
|
| 221 |
type: ArgumentType.STRING,
|
| 222 |
defaultValue: "Error"
|
| 223 |
}
|
| 224 |
+
},
|
| 225 |
+
switches: [ 'log', 'warn', noopSwitch ],
|
| 226 |
+
switchText: 'error'
|
| 227 |
},
|
| 228 |
+
'---',
|
| 229 |
+
{
|
| 230 |
+
opcode: 'breakpoint',
|
| 231 |
+
blockType: BlockType.COMMAND,
|
| 232 |
+
}
|
| 233 |
]
|
| 234 |
};
|
| 235 |
}
|
|
|
|
| 405 |
console.error(text);
|
| 406 |
this._addLog(text, "color: red;");
|
| 407 |
}
|
| 408 |
+
|
| 409 |
+
breakpoint() {
|
| 410 |
+
this.runtime.pause();
|
| 411 |
+
}
|
| 412 |
}
|
| 413 |
|
| 414 |
+
module.exports = jgDebuggingBlocks;
|