MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / onFileChanged

Method onFileChanged

tools/xsbug/CodeView.js:255–276  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

253 }
254 }
255 onFileChanged(code) {
256 var path = this.data.path;
257 code.stop();
258 if (path.endsWith(".js") || path.endsWith(".ts") || path.endsWith(".mjs"))
259 code.type = "js";
260 else if (path.endsWith(".json"))
261 code.type = "json";
262 else if (path.endsWith(".xml"))
263 code.type = "xml";
264 else
265 code.type = "text";
266 let string = system.readFileString(path);
267// if (string.length > 0x7FFF)
268// string = string.slice(0, 0x7FFF);
269 code.string = string;
270 this.insertionOffset = -1;
271 this.history = [];
272 this.historyIndex = 0;
273 var lines = this.data.LINES;
274 lines.behavior.onEdited(lines, code);
275 code.container.scrollTo(0, 0);
276 }
277 onReveal(code) {
278 code.container.reveal(code.selectionBounds, true);
279 }

Callers 3

onDisplayingMethod · 0.95
onDirectoryChangedMethod · 0.95
DebugBehavior.jsFile · 0.45

Calls 3

stopMethod · 0.65
scrollToMethod · 0.65
onEditedMethod · 0.45

Tested by

no test coverage detected