akvelon / flutter-code-editor

Flutter Code Editor is a multi-platform code editor supporting syntax highlighting, code blocks folding, autocompletion, read-only code blocks, hiding specific code blocks, themes, and more.
https://akvelon.com
Apache License 2.0
197 stars 47 forks source link

[BUG] Code sections isn't working for Javascript language #252

Open TaylorHo opened 1 year ago

TaylorHo commented 1 year ago

I tested with Java, Dart, and Javascript. Javascript was the only one of those languages where the sections didn't work.

I was trying to make the code read-only with controller.readOnlySectionNames = {'section1'};.

Dart example:

final controller = CodeController(
    text: '''
          // [START section1]
          final String test = "testing here";
          // [END section1]
          ''',
    language: dart,
    namedSectionParser: const BracketsStartEndNamedSectionParser(),
  );

Result: Screenshot from 2023-07-25 20-53-40


Javascript example:

final controller = CodeController(
    text: '''
          // [START section1]
          console.log("teste");
          // [END section1]
          ''',
    language: javascript,
    namedSectionParser: const BracketsStartEndNamedSectionParser(),
  );

Result: Screenshot from 2023-07-25 20-52-09