Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 06-05-2014, 01:47 PM   #1
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default ReaSyntax: Sublime Text Syntax for JS/EEL/LUA/WALTER

I'm sure some of you here are using the fabulous Sublime Text and are disappointed by the fact that you can't code your favorite JS/EEL scripts and WALTER themes in it!

Well, no more! Proceed here to find out more about ReaSyntax installation and features.
Additionally, you can also get a separate JS Editor theme for Lua scripts here. Big thanks to the user earhax for providing it!

A lot of effort has been invested in this. If you seriously use it, please consider supporting the developer. Thanks!

Some screens:





__________________
REAPER ReWorked: An elegant and self-sufficient all-around REAPER configuration
Other stuff

Last edited by Breeder; 03-06-2021 at 10:43 PM.
Breeder is offline   Reply With Quote
Old 06-05-2014, 01:49 PM   #2
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Btw, don't hesitate to report any bugs!
Also, if somebody wants to create additional color schemes let me know and I can add you to the project (if you're not comfortable with git just PM your contribution and I will add it together with the copyright notice )

If mods could sticky this, it would be appreciated, thanks!
Breeder is offline   Reply With Quote
Old 06-05-2014, 02:02 PM   #3
timlloyd
Human being with feelings
 
Join Date: Mar 2010
Posts: 4,713
Default

Nice one Breeder, looks good
timlloyd is offline   Reply With Quote
Old 06-06-2014, 09:58 PM   #4
cincikat69
Human being with feelings
 
cincikat69's Avatar
 
Join Date: Apr 2012
Location: Cincinnati area...
Posts: 642
Default

So far it's proving very useful for theming...makes the WALTER process more tolerable, lol.

Thank you Breeder...
__________________
Theme Website
cincikat69 is offline   Reply With Quote
Old 06-08-2014, 01:41 AM   #5
TBProAudio
Human being with feelings
 
TBProAudio's Avatar
 
Join Date: May 2014
Location: Germany
Posts: 643
Default

Hey,

this is really great. If you work with big JS files this is a great time saver:-)
But there seems to be a small issue with the syntax detection feature:
opening files inside sublime works, also drag&drop.

But js autodection does not work using command line (windows 7):
typing "sublime_text testjsfx" on command line gives plain text syntax

Any idea? Thanks a lot.

regards
Thomas
__________________
www.tbproaudio.de
TBProAudio is offline   Reply With Quote
Old 06-08-2014, 07:50 AM   #6
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by TBProAudio View Post
But js autodection does not work using command line (windows 7):
typing "sublime_text testjsfx" on command line gives plain text syntax

Any idea? Thanks a lot.

regards
Thomas
Well, that appears to be a bug in Sublime Text...I guess we should report it on their forums or wherever they report bugs
Breeder is offline   Reply With Quote
Old 06-28-2014, 10:58 AM   #7
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Well done !

I had myself done the Syntax Highlighting for Notepad ++ : Walter & ReaperLangPack

Can you make a ReaperLangPack synthax highlight ? It would be awesome !
X-Raym is offline   Reply With Quote
Old 06-28-2014, 12:26 PM   #8
pakkuncung
Human being with feelings
 
pakkuncung's Avatar
 
Join Date: Sep 2012
Location: Indonesia
Posts: 91
Default

sooo great!

IMHO this is much more convenient than using notepad++

i'm quite sure this will also catalyze JS coding addictiveness

thank you Breeder
__________________
JRENG!
EHX
pakkuncung is offline   Reply With Quote
Old 06-28-2014, 12:35 PM   #9
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@pakkuncung : LOL what's SO wrong with using Notepad++ ? I can concieve than you prefer Sublime Text but Notepad++ has a LOTS of good things :P hasn't it ? If no, there is hundreds of plugins than can improve it's functionnalities :P
X-Raym is offline   Reply With Quote
Old 06-28-2014, 01:09 PM   #10
pakkuncung
Human being with feelings
 
pakkuncung's Avatar
 
Join Date: Sep 2012
Location: Indonesia
Posts: 91
Default

Quote:
Originally Posted by X-Raym View Post
@pakkuncung : LOL what's SO wrong with using Notepad++ ? I can concieve than you prefer Sublime Text but Notepad++ has a LOTS of good things :P hasn't it ? If no, there is hundreds of plugins than can improve it's functionnalities :P
nothing's wrong with notepad++, it's great

i've tried customizing and creating JS syntax as user defined language on notepad++, but it was never felt like home (as in JS editor).

in the other hand, my impression using sublime text (with Breeder's Reasyntax) feels much better.

perhaps i care about my feeling too much, yet coding needs more logic hahaha

i'm not a coder nor programmer anyway, i just love to create my own tools for crafting music.
__________________
JRENG!
EHX
pakkuncung is offline   Reply With Quote
Old 06-29-2014, 05:44 AM   #11
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@pakkuncung :
Ok

What I like about sublime text is something a bit special : it's integration with the real-time online collaborative text editor Floobits.

That's said, if I remember well, I think that's the synthax highlight colors for the online version of Floobits uses the Sublime Text system.
Greg from the Floobits told me that he was ok to implement no new languages, but my Notepad ++ UDL files was not supported.

If we can provide him a ReaperLang Sublime Text color file, teams of Reaper translators could work online in a very efficient way
X-Raym is offline   Reply With Quote
Old 06-29-2014, 06:21 AM   #12
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by X-Raym View Post
Can you make a ReaperLangPack synthax highlight
I can stuff it in when I'll be fixing some ReaSyntax bugs - but don't count on it too soon, there are other things requiring my attention
Breeder is offline   Reply With Quote
Old 06-29-2014, 10:51 AM   #13
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

That is a marvellous news
X-Raym is offline   Reply With Quote
Old 07-04-2014, 10:19 PM   #14
ijijn
Human being with feelings
 
ijijn's Avatar
 
Join Date: Apr 2012
Location: Christchurch, New Zealand
Posts: 482
Default

This is outstanding! Because of ReaSyntax it's now a joy to work on my JSFX projects. Thank you Breeder!
ijijn is offline   Reply With Quote
Old 09-20-2014, 10:34 AM   #15
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

ReaSyntax does not have autocomplete, so I started creating my own. But Does Sublimetext NOT have the ability to give you a list of possible inputs for function parameters? Here's my file so far,

PHP Code:
{
    
"scope""source.EEL"
    
"completions"
    [
        {
"trigger""ApplyNudge""contents""ApplyNudge(${0:ReaProjectproject}${1:int nudgeflag}${2:int nudgewhat}${3:int nudgeunits}${4:double value}${5:bool reverse}${6:int copies})"},
        
        {
"trigger""CountSelectedMediaItems""contents""CountSelectedMediaItems(${1:ReaProjectproj})"},
        {
"trigger""GetMediaItem""contents""GetMediaItem(${1:ReaProjectproj}${2:int itemidx})"},
        {
"trigger""GetSelectedMediaItem""contents""GetSelectedMediaItem(${1:ReaProjectproj}${2:int selitem})"},
        {
"trigger""GetMediaItemInfo_Value""contents""GetMediaItemInfo_Value(${1:MediaItemitem}, \"${2:parname}\")"},
        
"I_GROUPID",
        
"B_MUTE",
        
"B_LOOPSRC",
        
"B_ALLTAKESPLAY",
        
"B_UISEL",
        
"C_BEATATTACHMODE",
        
"C_LOCK",
        
"D_VOL",
        
"D_POSITION",
        
"D_LENGTH",
        
"D_SNAPOFFSET",
        
"D_FADEINLEN",
        
"D_FADEOUTLEN",
        
"D_FADEINLEN_AUTO",
        
"D_FADEOUTLEN_AUTO",
        
"C_FADEINSHAPE",
        
"C_FADEOUTSHAPE",
        
"I_GROUPID",
        
"I_LASTY",
        
"I_LASTH",
        
"I_CUSTOMCOLOR",
        
"I_CURTAKE",
        
"IP_ITEMNUMBER",
        
"F_FREEMODE_Y",
        
"F_FREEMODE_H",

        {
"trigger""Main_OnCommand""contents""Main_OnCommand(${1:int command}${2:int flag})"},
        {
"trigger""Main_OnCommandEx""contents""Main_OnCommandEx(${1:int command}${2:int flag}${3:ReaProjectproj})"},

        {
"trigger""Undo_BeginBlock""contents""Undo_BeginBlock()"},
        {
"trigger""Undo_EndBlock""contents""Undo_EndBlock(\"${1:descchange}\", ${2:int extraflags})"},
    ]

extract to: Sublime Text\Data\Packages\User
save as: ANYTHING.sublime-completions

The goal of Sublime Text, I think, is to not have to look at the html API guide every time you want to write a line of code. This gets me a lot closer to that goal, but definitely not all the way, possibly due to Sublime Text lacking in "code helper" features. For example, the "Nudge" function is still difficult to use because you have to look up what numbers do what. Also, for stuff like "I_GROUPID", "B_MUTE", "B_LOOPSRC", they only belong in the "parname" of GetMediaItemInfo_Value, but I don't think there's a way to tell Sublime Text.

I am very new to this and there may be Sublime Text features that I'm not making use of.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 09-20-2014 at 10:47 AM.
Argitoth is offline   Reply With Quote
Old 09-20-2014, 11:02 AM   #16
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by Argitoth View Post
But Does Sublimetext NOT have the ability to give you a list of possible inputs for function parameters?

It does and I'm finishing it up - will push it soon (maybe today, probably tomorrow)
Breeder is offline   Reply With Quote
Old 09-20-2014, 11:30 AM   #17
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

I want it NOWWWWW :'(
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 09-20-2014, 12:02 PM   #18
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

Question: I put sublime text as the external editor for eel files in REAPER preferences. It opened sublimetext where each word of the file was a new tab in Sublime Text, and of course, did not open the intended file. How do I get it to work?
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 09-21-2014, 12:14 PM   #19
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by Argitoth View Post
Question: I put sublime text as the external editor for eel files in REAPER preferences. It opened sublimetext where each word of the file was a new tab in Sublime Text, and of course, did not open the intended file. How do I get it to work?
Yes, that's some kind of bug - hard to tell where the bug is actually - maybe REAPER's passing wrong parameters to sublime_text.exe or Sublime Text's not smart enough to work with parameters passed by REAPER.

In any case, I'm using this to overcome it:
https://github.com/grumpydev/Sublime...ad-Replacement

This way Sublime Text will be launched instead of notepad in all scenarios. So you don't even need to set external editors. Both .EEL and jesusonic files will get opened in Sublime Text by default.
Breeder is offline   Reply With Quote
Old 09-21-2014, 02:58 PM   #20
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Bump for v0.1.0

changelog:
Code:
    [JS, EEL, WALTER] added auto completion for built-in functions (EEL, JS) and keywords (WALTER)
    [JS, EEL] fixed local/global/instance parameters
    [JS, EEL] added support for namespace function parameters (a*)
    [JS] fixed slider description when using various characters that were not letters
    [JS] added support for gfx_ext_retina, import and options:gmem
If you installed the package using Package Manager it should update itself automatically
Breeder is offline   Reply With Quote
Old 09-21-2014, 04:55 PM   #21
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

Breeder, you removed indication of what the parameter type is. Is this just your preference or was this done for a specific reason? For example, parmname of GetMediaItemInfo_Value is not surrounded by quotes when it is autocompleted.

Also, you didn't include parameter hints. How do you implement this? I wouldn't mind implementing it myself, if only I knew how.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 09-22-2014, 04:23 AM   #22
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by Argitoth View Post
Is this just your preference or was this done for a specific reason?
I really don't see much need for types since parameter name usually tells you enough and auto completed function with all the types would just end up too long.
Surronding things with quotes also feels kinda wrong. All parameters are just variables and they don't have to be literals. That would IMHO be better handled in a following way:

Quote:
Originally Posted by Argitoth View Post
Also, you didn't include parameter hints. How do you implement this? I wouldn't mind implementing it myself, if only I knew how.
Sublime text doesn't understand concept of hints, it only has completions and snippets.

I guess you could use it's API (or maybe snippets) to detect if current selection is within the function. If it is, check name of the function ad current parameter - if it matches with something that needs hint you throw it in auto completion (in case of an undo you would name the completion UNDO_STATE_ALL, but insert -1)

I might tackle with it someday, but feel free to experiment - if you come up with something useful I recommend you do a pull request and if it's good enough I'll merge it

Last edited by Breeder; 09-22-2014 at 04:38 AM.
Breeder is offline   Reply With Quote
Old 10-05-2014, 11:17 AM   #23
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

Hey Breeder, I can't comment code in EEL. Are you having problems with this or is it just me?
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 10-05-2014, 11:46 AM   #24
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by Argitoth View Post
Hey Breeder, I can't comment code in EEL.
Huh? Any example?
Breeder is offline   Reply With Quote
Old 10-05-2014, 12:09 PM   #25
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

lol oops, maybe I should have explained.

I can't use the hotkey "comment code" because when I do that (or even when I go to menu --> comment code) nothing happens. I think this is because the "comment" syntax is messed up in the definition files of EEL syntax. I was wondering if you couldn't auto-comment code as well.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 10-05-2014, 01:50 PM   #26
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Confirmed, I think I know what's going on. Thanks for the report!
Breeder is offline   Reply With Quote
Old 10-06-2014, 01:06 AM   #27
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Fixed!

v0.1.1 changelog:
Code:
[JS, EEL, WALTER] fixed toggling comments
[EEL] added SetCursorContext() to completion list
Breeder is offline   Reply With Quote
Old 10-06-2014, 10:05 AM   #28
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

Thank you breeder for the great work on this! Coding is fun with REAPER!
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 10-26-2014, 06:41 AM   #29
Viente
Human being with feelings
 
Viente's Avatar
 
Join Date: Feb 2012
Posts: 1,972
Default

Wow, just found it! Thank you!
Viente is offline   Reply With Quote
Old 11-16-2014, 05:42 PM   #30
Claudiohbsantos
Human being with feelings
 
Join Date: Aug 2014
Location: New York
Posts: 135
Default

This is amazing! Thanks for the hard work
__________________
My Reapack Repo - Reapack Extension
Claudiohbsantos is offline   Reply With Quote
Old 11-23-2014, 04:17 PM   #31
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

OMG. I totally missed that auto-completion stuff.
It is truly amazing. Congratulations !
I installed Sublime Text just for this (I was a lot into Brackets this times :P)
X-Raym is offline   Reply With Quote
Old 01-20-2015, 11:36 AM   #32
matthewjumpsoffbuildings
Human being with feelings
 
Join Date: Mar 2013
Posts: 463
Default

thanks so much! this is fantastic! so glad to be able to stick with sublime to edit ReaScript, JS etc, thank you
__________________
[sun sprites] spotify facebook
matthewjumpsoffbuildings is offline   Reply With Quote
Old 03-20-2015, 08:35 AM   #33
Viente
Human being with feelings
 
Viente's Avatar
 
Join Date: Feb 2012
Posts: 1,972
Default

Should be sticky, no?
Viente is offline   Reply With Quote
Old 03-20-2015, 01:49 PM   #34
ijijn
Human being with feelings
 
ijijn's Avatar
 
Join Date: Apr 2012
Location: Christchurch, New Zealand
Posts: 482
Default

Quote:
Originally Posted by Viente View Post
Should be sticky, no?
Would not disagree, my friend.
ijijn is offline   Reply With Quote
Old 08-09-2015, 12:46 PM   #35
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

I'm slowly preparing next update which should have auto completion for all ReaScript languages (Lua, Python, EEL). I want to try and do it before v5 goes official. Stay tuned
Breeder is offline   Reply With Quote
Old 08-09-2015, 01:43 PM   #36
sfzgeek
Human being with feelings
 
sfzgeek's Avatar
 
Join Date: Feb 2009
Location: Dunedin, New Zealand
Posts: 205
Default

Quote:
Originally Posted by Breeder View Post
I want to try and do it before v5 goes official.
Awesome!
__________________
My rawk band: The Hidden Venture.
sfzgeek is offline   Reply With Quote
Old 09-28-2018, 05:18 PM   #37
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

ReaScript updated for anyone who uses it:

Code:
##### v0.2.0 (September 29 2018)
 * [Lua] Added Lua completion list. All scripts load it - REAPER or not. This can be limited to specific folders through settings
 * [JS, EEL, WALTER] Updated syntax and completion lists to match REAPER 5.96pre12, SWS 2.9.8 and ReaPack 1.2.1
 * [JS, EEL] Fixed indentation

edit:
Had to update to 0.2.1 immediately after this...

It seems the feature to have auto-complete only in REAPER folder is broken due to Sublime Text API bug. So the feature was removed for now and autocomplete will work on all Lua files.

Last edited by Breeder; 09-28-2018 at 09:37 PM.
Breeder is offline   Reply With Quote
Old 09-28-2018, 11:09 PM   #38
Lostz
Human being with feelings
 
Lostz's Avatar
 
Join Date: May 2012
Location: Italy - Austria
Posts: 55
Default

Oh, what a surprise!
Open Sublime Text and ReaSyntax has updated right now!

Thank you.
__________________
Thanks.
Lostz is offline   Reply With Quote
Old 10-02-2018, 11:22 AM   #39
rstockm
Human being with feelings
 
rstockm's Avatar
 
Join Date: May 2012
Location: Berlin, Germany
Posts: 171
Default

This looks very promising, autocomplete for the REAPER/LUA API works like a charm. One suggestion, though: in LUA, there is no different color for the API calls, it's all white. For instance reaper.get_action_context() etc.
It would be very clever to have them colored, too?
rstockm is offline   Reply With Quote
Old 10-02-2018, 12:00 PM   #40
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Is there a way to expand it with syntax-highlighting for my own functions? Or for Lokasenna's Gui-Lib?
Meo-Ada Mespotine is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:08 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.