New Javascript-based Xojo syntax highlighter

  1. 5 weeks ago

    Garry P

    Feb 19 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)

    Hi,

    I've just recently switched from PrismJS to Rainbow for highlighting code on web pages. I've released a plugin for the library to allow highlighting of Xojo code. I've also included CSS/SASS files for a light and dark theme which match the default colours used by the Xojo IDE. Hopefully someone will find it useful.

    GitHub Repo .

  2. Martin T

    Feb 19 Pre-Release Testers Germany

    Hi Garry,

    great job, thanks. What I notice, colors are not yet recognized. Do you see a possibility to modify your code, so that colors according to the pattern "&cFFFFFF00" (RRGGBBAA) will be displayed the same way as in the Xojo?

  3. Garry P

    Feb 19 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)

    @MartinTrippensee Hi Garry,

    great job, thanks. What I notice, colors are not yet recognized. Do you see a possibility to modify your code, so that colors according to the pattern "&cFFFFFF00" (RRGGBBAA) will be displayed the same way as in the Xojo?

    Ah my oversight. Sorry. Sure, I’ll do that this evening.

  4. Garry P

    Feb 19 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)
    Edited 5 weeks ago

    @MartinTrippensee: I've updated the repo. The plugin now correctly highlights Color literals just like the IDE does. Light and dark colour scheme added too.

  5. Garry P

    Feb 19 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)
    Edited 5 weeks ago

    Hmm. I think the ampersand needs to be HTML encoded to &. Does that work?

  6. Martin T

    Feb 19 Pre-Release Testers Germany
    Edited 5 weeks ago

    Nope. Colors should also be matched, if optional alpha values are used (&cFB010600). Pattern should look like this one:

    /(&c)([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})?\b/gi
  7. Garry P

    Feb 19 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)

    Ah, my bad. I had updated the SASS files but I hadn't re-built the CSS files. The Repo has been updated now.

  8. Garry P

    Feb 19 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)

    Right. I think that's done now. Could you check?

  9. Martin T

    Feb 19 Pre-Release Testers Germany

    The alpha value is optional, otherwise colors without alpha value won't match. You forgot the question mark in the pattern.

  10. Garry P

    Feb 19 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)

    Done now. I think.

    Blimey - I need to test more!

  11. scott b

    Feb 19 Pre-Release Testers, Xojo Pro local coffee shop

    @Garry P Blimey - I need to test more!

    I think we all need to do more of that.

  12. Dave S

    Feb 19 San Diego, California USA

    @scott b I think we all need to do more of that.

    Hey.. You talking to ME? :)

  13. scott b

    Feb 19 Pre-Release Testers, Xojo Pro local coffee shop

    @Dave S Hey.. You talking to ME? :)

    I wasnt speaking to anyone in particular (well outside of myself!). But how many of us programmers like writing test code and write test code for everything? that would be a very small number, approaching zero. I try to write 10 (arbitary number I pulled out of my backside) UnitTests for every method I write. dont get me wrong, i dont. I try. then when I (or someone else) finds a bug/issue/edge-case that the code doesnt work, I write a UnitTest (or several) around that, and add them to the UnitTests.

    and I know your comment was in good spirits/jokingly but for some that read our banter might not have seen it that way.

    back to coding! maybe today I can actually write some Xojo code.

  14. Dave S

    Feb 19 San Diego, California USA

    @scott b I know your comment was in good spirits/jokingly

    It was :) [in relation to another on-going topic]

or Sign Up to reply!