2021-10-30

Monaco Editor + Blockly: highlight new code [closed]

Is it possible, with Monaco editor, to hightlight new code injected in editor ? I see everywhere how to highlight lines, how to use diffEditor, but I want to highlight any modification, even a value, and not all the line where the modification occurs. I'm developping another tool helping newbies programm graphically microntrollers (https://github.com/BlocklyDuino/BlocklyDuino-v2), so any new block on workspace creates an event that parse all blocks, that translation in code and inject it in Monaco eitor. In older project, everything was created "manually" with HTML fields (https://code.kniwwelino.lu/ or https://ardublockly.embeddedlog.com/demo/index.html), comparaison of old and new code listening each new block on workspace.

I found something about modifying text edited (Monaco Editor: only show part of document), but I need something more precise, only each word and not all the line.

From https://jsfiddle.net/renatodc/s6fxedo2/, what is interecting is the modification and I tried to modify:

let didScrollChangeDisposable = editor.onDidScrollChange(function() {
    didScrollChangeDisposable.dispose();
    setTimeout(function() {
      $(".monaco-editor .view-lines > div").each(function(i) {
        if(linesToDisable.includes(i+1)) {
          $(this).css("background-color", "#FFFF00");
          //$(this).css("pointer-events","none");
        }
      });
    },1000);
  }); 

But all the line has background, how can I change it to have backgournd on text only?



from Recent Questions - Stack Overflow https://ift.tt/314JMyK
https://ift.tt/eA8V8J

No comments:

Post a Comment