On Tue, Sep 17, 2024 at 1:35 AM 'rengel' via leo-editor < [email protected]> wrote:
Reproducing the error is a little tricky, > so this is to clarify how the error can be reproduced. > > - My test file is at location "D:/Downloads/erlang_test.erl". > - From there I import this file with "File->Import Files->Import Any > File...". > - In Leo I get a new node "Imported Files" with the subnode "@auto > D:/Downloads/erlang_test.erl". > - In the subnode, I change "@auto" to "@file". > - Then I press Ctrl+S to save the outline. > - This creates the "undefined section" error. > > If I recreate an "@file D:/Downloads/erlang_test2.erl"" node manually and > copy and paste the Erlang code from the first node into the body of this > node and then save the outline, the ERROR DOES NOT OCCUR. > Interesting. Thanks for these notes. So what is happening when "@auto" is changed to "@file"? > I'm not completely sure and I can't fully explain the behavior you describe. The following table, from the directives reference, <https://leo-editor.github.io/leo-editor/directives.html>shows that Leo writes @auto and @file trees differently. Sections & File data in @<file> kind Sentinels? @others? .leo file? Notes ------------ ---------- ----------- ------------ ----- @asis no no yes @auto no yes no 1, 2 @auto-xx no yes no 1, 2 @clean no yes yes @edit no no no @file yes yes no @nosent no yes yes It's hard to predict what the exact consequences of changing the kind of the @<file> tree will be! *Aha! There is no Erlang importer* This means that *ic.createOutline *will call *ic.scanUnknownFileType*, which adds @language erlang and copies the entire file to the root node. ic.scanUnknownFileType already contains a few special cases. It would be possible to add an @delims directive for .erl files. *Summary* In Erlang, <<...>> may appear in various contexts, so Erlang's syntax clashes with Leo's default syntax for section references. As Thomas points out, using the @section-delims directive is a workaround. @section-delims [[[ ]]] > For the record, I see nothing wrong in using this directive for Erlang. Just make sure that "[[[" doesn't appear anywhere in the code! A cff on "delims" reveals 64 matches, including various unit tests. This code will stay exactly as it is. In particular, Leo's @file read code, fast_at.scan_lines, handles @delims correctly. Leo's unit tests are a bit light on covering @delims, this issue does not suggest that Leo's code is buggy. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/CAMF8tS3_e%2BVkQndQSFF45ozVS9yMJ2is0-mDRdd3y2jmmzVYrw%40mail.gmail.com.
