About Monkey 2 › Forums › General Programming Discussion › Sublime Text 3 language file and snippets
Tagged: sublime text
This topic contains 26 replies, has 5 voices, and was last updated by
wiebow
2 years ago.
-
AuthorPosts
-
June 25, 2016 at 8:17 am #1219
Hello all,
I am using ST3 to code Monkey 2 stuff, and as my language file is behaving fairly well, I’ve put it on github:
https://github.com/mutatedmonkey/sublimetext3
I also added handy snippets. Give it a go if you want to and let me know what you think.
Example:
Attachments:
June 25, 2016 at 4:52 pm #1223Thanks for this
For some reason sometimes things don’t get highlighted (see attched), any idea why that might be? Sometimes other things like Method or Class don’t get highlighted either.
Attachments:
June 25, 2016 at 9:19 pm #1226Glad you like it! I’ll take a look tomorrow and see if I can fix those points. If you can attach some sample code, that would help.
One tip: close If blocks always with an Endif. If you use only End, it will think the Method, Function or Class you are in is ended :/ The troubles come from Mark allowing a simple End to end loads of different blocks and definitions, but the main reason is that there are a few different If definitions, like single line, with a Then, without a Then, with Elseif, etc… Not much I can do about that, unless some code convention can be agreed upon.
Another tip: if a definition of an area is not highlighted, it is usually because of a premature closure of a code block definition earlier in the code. So always look up: go to the last code that was highlighted properly and see if you can find areas that are closed of too early, or in an unexpected way (unexpected by me
)
June 25, 2016 at 11:10 pm #1227Ahh the end if fixed most issues, thanks. It still doesn’t seem to highlight Interface or Class though eg:
Monkey12345678Interface tlQuadTreeEventMethod doAction:Void(ReturnedObject:Object, Data:Object)Method doAction:Void(ReturnedObject:Object, Data:Object, Result:tlCollisionResult)EndClass tlQuadTreeEndJune 26, 2016 at 7:15 am #1238Ah, yes, I have ASSUMED people use a capital letter for interface names, for example IMyInterface. So fixed that. The same for methods. Fixed that as well. I also added parameters to interface bodies, so should work with all other parameter definitions as well.
I’ve uploaded a new version. Give it a go
June 26, 2016 at 11:58 am #1242That actually raises an interesting point, I always used a prefix for classes to avoid potential clashes with other mods, but now we have namespaces I guess that’s not so necessary.
Thanks for the new version
I wonder how easy a monkey2 Linter would be to make…
June 26, 2016 at 12:38 pm #1243Yes, namespaces should fix potential clashes.
A linter. Never used it. Is it handy?
June 27, 2016 at 3:24 pm #1250Would it be possible to get an intellisense plugin in Sublime 3 working with Monkey2? I have trouble learning these api’s without it.
June 27, 2016 at 6:23 pm #1252I use a javascript linter which basically underlines syntax and other common errors like undefined variables (picks out typos), and it also alerts to bad coding practices, like only putting an “end” instead of “end if” as I’ve been doing
There’s some more info about the SublimeLinter here http://www.sublimelinter.com/en/latest/about.html
June 27, 2016 at 6:30 pm #1253papgar: Yes, it is a pain without it. I have a browser open with a link to the local docs, but it can be better. In BlitzMax I had made snippets for almost every command or function, so getting the right parameters was a breeze. I might do that again with M2, but I’m not that desperate yet
Peterigz: I’ll give that a look, who knows?
June 30, 2016 at 9:18 am #1366I updated this file a few times already, adding fixing small bits and bobs… I still see some errors with some of the extern block declarations and stuff so I will try to fix that soon.
July 13, 2016 at 6:21 pm #2096I made a blog post about my development setup with ST3 and Gradle: http://devdef.blogspot.nl/2016/07/monkey2-development-setup.html
I hope it’s of value to someone.
July 13, 2016 at 7:46 pm #2100Very useful! thanks
July 29, 2016 at 8:10 am #2515Hi wiebow, first of all thanks for your work. Secondly as far as i can remember, there have been a number of people offering Sublime support for Max, Monkey and now monkey2 throughout the years. Sadly none of them was fully working/up to date.
Are you interested in doing a full implementation, so that the syntax highlighting works on everything (also just end) and you can build fine together with the color highlighter, the linter and provide an official package?
August 2, 2016 at 8:39 am #2679I want to work towards a full package, definitely.
Syntax highlighting works on all End cases, but not for If blocks atm. I will need some clever look-ahead regex to support that. I’ll give it a go, as you show interest.
If you know any issues with the highlighter, mention it here or on the github page and i’ll fix it. There have been several updates over the past weeks so always grab the latest one
-
AuthorPosts
You must be logged in to reply to this topic.


