MCPcopy Index your code
hub / github.com/Macuyiko/minecraft-python / addSnippet

Function addSnippet

ServerEditorWeb/ace/ext-language_tools.js:482–511  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

480 }
481
482 function addSnippet(s) {
483 if (!s.scope)
484 s.scope = scope || "_";
485 scope = s.scope;
486 if (!snippetMap[scope]) {
487 snippetMap[scope] = [];
488 snippetNameMap[scope] = {};
489 }
490
491 var map = snippetNameMap[scope];
492 if (s.name) {
493 var old = map[s.name];
494 if (old)
495 self.unregister(old);
496 map[s.name] = s;
497 }
498 snippetMap[scope].push(s);
499
500 if (s.tabTrigger && !s.trigger) {
501 if (!s.guard && /^\w/.test(s.tabTrigger))
502 s.guard = "\\b";
503 s.trigger = lang.escapeRegExp(s.tabTrigger);
504 }
505
506 s.startRe = guardedRegexp(s.trigger, s.guard, true);
507 s.triggerRe = new RegExp(s.trigger, "", true);
508
509 s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
510 s.endTriggerRe = new RegExp(s.endTrigger, "", true);
511 }
512
513 if (snippets && snippets.content)
514 addSnippet(snippets);

Callers 1

Calls 1

guardedRegexpFunction · 0.70

Tested by

no test coverage detected