AlloyTools / org.alloytools.alloy

Alloy is a language for describing structures and a tool for exploring them. It has been used in a wide range of applications from finding holes in security mechanisms to designing telephone switching networks. This repository contains the code for the tool.
Other
694 stars 123 forks source link

Model not processed with dash header #259

Closed nmacedo closed 2 months ago

nmacedo commented 2 months ago

.als models starting with a long --- are not processed and interpreted as empty. I think this has to do with markdown models (I though these needed an .md extension?), but there is no visual indication in the editor.

Screenshot 2024-04-11 at 15 33 12

In fact, even with exactly --- the syntax highlighting seems to be buggy.

Screenshot 2024-04-11 at 15 36 35
awwaiid commented 2 months ago

Even a single - or -- should be a syntax error too, right? When not in markdown-mode, that is.

awwaiid commented 2 months ago

As you suspected, a file stating with --- is switched into markdown mode here, https://github.com/AlloyTools/org.alloytools.alloy/blob/master/org.alloytools.alloy.core/parser/Alloy.cup#L300

Would you like me to remove that so that it strictly goes off of the file extension?

awwaiid commented 2 months ago

Well over in org.alloytools.alloy.core/src/main/java/edu/mit/csail/sdg/alloy4/OurSyntaxDocument.java it also assumes this behavior. I opened up https://github.com/AlloyTools/org.alloytools.alloy/pull/265 as what I think is a correct compromise -- strictly allowing ---\n (with a newline) to indicate that it is a markdown file.

pkriens commented 2 months ago

this should be fixed nu #265