MCPcopy Create free account
hub / github.com/bigcode-project/jupytercoder / generateCompareCodesText

Function generateCompareCodesText

src/utility.js:414–436  ·  view source on GitHub ↗
(codeFormat, suggestion)

Source from the content-addressed store, hash-verified

412
413
414const generateCompareCodesText = (codeFormat, suggestion) =>{
415 const { Diff } = window;
416 const preCodeMesageSplit = codeFormat.split("<commit_msg>")
417 const preCode = preCodeMesageSplit[0].slice(15)
418
419 let html = []
420 const diff = Diff.diffChars(preCode, suggestion)
421
422 diff.forEach((part) => {
423 let blockContent = part.value
424
425 if (part.added){
426 html.push(`<span style="color: green;">${blockContent}</span>`)
427 }else if(part.removed){
428 html.push(`<span style="color: red;">${blockContent}</span>`)
429 }else{
430 html.push(`<span style="color: grey;">${blockContent}</span>`)
431 }
432
433 });
434
435 return html.join('')
436}
437
438utility.viewCodeResult = (suggestion, animationElement, codeFormat, requestType, activeRequestTextarea) => {
439 switch (requestType) {

Callers 1

utility.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected