Sublime Text 3 language file and snippets

Home Forums General Programming Discussion Sublime Text 3 language file and snippets

Tagged: 

This topic contains 26 replies, has 5 voices, and was last updated by  wiebow 5 months, 1 week ago.

Viewing 15 posts - 1 through 15 (of 27 total)
  • Author
    Posts
  • #1219

    wiebow
    Participant

    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:
    #1223

    peterigz
    Participant

    Thanks 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.

    #1226

    wiebow
    Participant

    Glad 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 🙂 )

    #1227

    peterigz
    Participant

    Ahh the end if fixed most issues, thanks. It still doesn’t seem to highlight Interface or Class though eg:

    #1238

    wiebow
    Participant

    Ah, 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 🙂

    #1242

    peterigz
    Participant

    That 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…

    #1243

    wiebow
    Participant

    Yes, namespaces should fix potential clashes.

    A linter. Never used it. Is it handy?

    #1250

    papgar
    Participant

    Would it be possible to get an intellisense plugin in Sublime 3 working with Monkey2?  I have trouble learning these api’s without it.

    #1252

    peterigz
    Participant

    I 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

    #1253

    wiebow
    Participant

    papgar: 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?

    #1366

    wiebow
    Participant

    I 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.

    #2096

    wiebow
    Participant

    I 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.

    #2100

    peterigz
    Participant

    Very useful! thanks 🙂

    #2515

    taumel
    Spectator

    Hi 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?

    #2679

    wiebow
    Participant

    I 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 🙂

Viewing 15 posts - 1 through 15 (of 27 total)

You must be logged in to reply to this topic.