Atom Package for Monkey2
April 4, 2017 at 10:04 pm #7712
matParticipant123456--langdef=Monkey2--langmap=Monkey2:.monkey2--regex-Monkey2=/(^|=[ \t])*Class ([A-Za-z_][A-Za-z0-9_]+\.)*([A-Za-z_][A-Za-z0-9_]+)( Extends ([A-Za-z][A-Za-z0-9_.]*)+)?$/\3/c,class/--regex-Monkey2=/(^|=[ \t])*Method ([A-Za-z_][A-Za-z0-9_]+\.)*([A-Za-z_][A-Za-z0-9_]+).*$/- m: \3/o,other/--regex-Monkey2=/(^|=[ \t])*Function ([A-Za-z_][A-Za-z0-9_]+\.)*([A-Za-z_][A-Za-z0-9_]+).*$/\3/f,function/--regex-Monkey2=/(^|=[ \t])*'-(.*)$/'-\2/o,other/
I’m sure the regex is terrible there (it was a hacky copy and paste job and probably doesn’t even cover all Monkey 2 syntax…) 🙂
I couldn’t get the collapsible classes to work that are shown on the package page screenshot, so the methods indented with a hyphen were a hacky way of getting them a little more readable.
I added ‘- as a way of adding custom comments to the outline, such as to do notes.
It’s all a bit messy but it is working ok here. If anyone has any improvements, please do share!April 6, 2017 at 6:26 pm #7740
@mat, cool, thanks for sharing, I will give that a try. It definitely looks useful.
I’ve just published v1.3 of the addon. Changes include:
* Added new target options to compiler toolbar (ios, android, etc)
* Added code folding for property/setter
* Fixed syntax highlighting for property/setter
* Added syntax highlighting for lambdas
I am working on improving autocompletion for lambda functions, but it’s not quite ready yet.April 12, 2017 at 4:15 am #7866
v1.4 is up, added syntax highlighting and autocompletion for Enums.April 12, 2017 at 5:14 pm #7872
I think the highlighter gets confused when you use IF inside another IF.April 12, 2017 at 5:35 pm #7873
Thanks, just taking a look now. It seems related to the Then keyword. When removed, it seems to highlight properly, eg.123456If TrueElseIf FalseEndIfEndIf
I’ll see if I can get it working with Then as well.April 12, 2017 at 8:37 pm #7876
Ok, I’ve published v1.4.2, which has some fixes in for If statement highlighting. I’m still having trouble getting the more terse form of one line if statements working, eg.1If True Print "Yes this is true"
I can’t figure out a way to make it not pick up the next closing ‘End’, meaning it will usually take a closing End keyword from it’s containing method, function, class etc., which throws everything off. I need a regular expression that can exclusively match that form of if statement.
Everything else seems ok, including one line if statements with a Then in them (see attached screenshot). There’s still some inconsistency (some of the True keywords are colored differently in the screenshot, for example), but I think it’s mostly there. Let me know how it works for you.
Attachments:April 21, 2017 at 4:07 pm #7985
v1.4.3 is up with a bug fix for Atom 1.16. The addon would crash when ‘auto-save on build’ was enabled and new, unsaved files were open.
While fixing this I also noticed that Atom 1.17 is adding support for a new interface element called a Dock:
Docks are an extension of Atom’s pane system designed to hold interface elements that you want to quickly toggle into and out of view. This is a common pattern for tool panels such as the tree view, debugger controls, terminals, consoles, regex railroad diagrams, etc.
It looks like it might give a simpler, native way to do the output panel. Once 1.17 is out I will take a closer look at it.
You must be logged in to reply to this topic.