MCPcopy Index your code
hub / github.com/Moddable-OpenSource/moddable / cmdFrame

Method cmdFrame

tools/xsbug-log/xsbug-debugmachine.js:2029–2055  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

2027 }
2028
2029 cmdFrame(args) {
2030 if (!this.requireBroken()) {
2031 this.showPrompt();
2032 return;
2033 }
2034 if (args.length === 0 || !this.view.frames) {
2035 this.commandError('Syntax: frame <number>');
2036 return;
2037 }
2038 const idx = parseInt(args[0]);
2039 if (isNaN(idx) || idx < 0 || idx >= this.view.frames.length) {
2040 this.commandError(`Frame index out of range (0-${this.view.frames.length - 1})`);
2041 return;
2042 }
2043 const frame = this.view.frames[idx];
2044 this.doSelect(frame.value);
2045 this.currentPath = frame.path || null;
2046 this.currentLine = frame.line || null;
2047 this.listPosition = null;
2048 this.report('frame', { index: idx, frame: { name: frame.name, path: frame.path, line: frame.line, shortPath: this.shortPath(frame.path) } }, undefined, (data) => {
2049 console.log(`Selected frame #${data.index}: ${data.frame.name}`);
2050 if (data.frame.path)
2051 console.log(` ${data.frame.shortPath}:${data.frame.line}`);
2052 this.showPrompt();
2053 });
2054 // doSelect triggers onViewChanged for local/global, prompt will be reshown
2055 }
2056
2057 cmdPrint(args) {
2058 if (!this.requireBroken()) {

Callers 1

handleCommandMethod · 0.95

Calls 7

requireBrokenMethod · 0.95
showPromptMethod · 0.95
commandErrorMethod · 0.95
reportMethod · 0.95
shortPathMethod · 0.95
doSelectMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected