Old 07-09-2018, 09:14 AM   #1
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,020
Default Reaper tools for Visual Studio Code

After ausbaxter kindly put together a set of snippets for the Reaper API, I figured it would be handy to have one place for collecting any Reaper-related tools/extensions/etc for Visual Studio Code. So, well, here it is:

https://github.com/jalovatt/reaper-vs-code
  • Autocomplete snippets for the API, covering Lua, EEL, and Python:


  • A handful of my own snippets for common tasks such as a ReaPack header, and a wrapper for ShowConsoleMsg

  • Basic language support and syntax highlighting for EEL and Walter:


Installation instructions can be found in each folder's README.

Further contributions are more than welcome - better language definitions, more snippets, etc. PM me, make a pull request on the repo, whatever you want.

Enjoy!
Lokasenna is online now   Reply With Quote
Old 07-23-2018, 09:00 AM   #2
tronce
Human being with feelings
 
Join Date: Oct 2017
Posts: 5
Default

thank you very much Lokasenna!
tronce is offline   Reply With Quote
Old 07-25-2018, 09:55 AM   #3
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 661
Default

Thanks for EEL syntax highlighting! I had been using C# which is kinda-sorta ok enough to be useful, but obviously proper support for the language is much better.

Cheers!
tack is offline   Reply With Quote
Old 07-26-2018, 01:00 PM   #4
Ozman
Human being with feelings
 
Join Date: Feb 2015
Posts: 534
Default

Anyone know how to do quick lua formatting (indentation) in VS Code for some minified lua?
Ozman is offline   Reply With Quote
Old 07-26-2018, 06:28 PM   #5
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,020
Default

What happens if you open the Command Palette and find "Format Document"? Do you have a Lua extension (I like "vscode-lua")?
Lokasenna is online now   Reply With Quote
Old 07-31-2018, 06:46 AM   #6
Ozman
Human being with feelings
 
Join Date: Feb 2015
Posts: 534
Default

Quote:
Originally Posted by Lokasenna View Post
What happens if you open the Command Palette and find "Format Document"? Do you have a Lua extension (I like "vscode-lua")?
I get at the bottom right:
There is no document formatter for 'lua'-files installed.
----------------

Edit..
Ok, installing vscode-lua and running "Format Document" with text selected works.

Much thanks, Lokasenna.

----------------

.. VS Code is my new text editor. Still getting the hang of it.
Ozman is offline   Reply With Quote
Old 07-31-2018, 07:35 AM   #7
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,020
Default

While we're on the topic of extensions, Bracket Pair Colorizer is incredibly helpful.
Lokasenna is online now   Reply With Quote
Old 07-31-2018, 08:13 AM   #8
Ozman
Human being with feelings
 
Join Date: Feb 2015
Posts: 534
Default

Quote:
Originally Posted by Lokasenna View Post
While we're on the topic of extensions, Bracket Pair Colorizer is incredibly helpful.
Ya know what... That is so true.
Matching color brackets can be very helpful!

Thanks again, Lokasenna!
Ozman is offline   Reply With Quote
Old 08-02-2018, 05:36 AM   #9
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,846
Default

I'm using these snippets happily. Thank you.
nofish is offline   Reply With Quote
Old 08-02-2018, 07:20 AM   #10
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,020
Default

Are parameter reminders working for anyone else? They were for me, but I feel like the most recent Code update made them go away.

Side note: There's a known Code bug with autocomplete triggers that contain a period, like reaper. - I think the forthcoming update has a fix.
Lokasenna is online now   Reply With Quote
Old 08-07-2018, 11:58 PM   #11
ausbaxter
Human being with feelings
 
Join Date: Apr 2016
Posts: 39
Default

Hey all, I finally got around to fixing some of the issues when I first converted the api. Lokasenna, I submitted a pull request not too long ago, should be a much nicer conversion.

Fixed:
Some single letter variables not showing up (x, y, etc).
Optional parameters are now notated with brackets
String quotations are now outside the tabable parameter area.
No more broken descriptions.
ausbaxter is offline   Reply With Quote
Old 08-08-2018, 04:15 AM   #12
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,020
Default

Cheers, merged.
Lokasenna is online now   Reply With Quote
Old 08-15-2018, 02:38 PM   #13
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,020
Default

Another handy extension (maybe I should keep a list in the OP) for anyone dual-booting or switching between different machines: https://marketplace.visualstudio.com...-settings-sync

It uses a Github Gist to store all of your settings and snippets so you can (for instance) save them on Windows and grab them on Linux.
Lokasenna is online now   Reply With Quote
Old 09-05-2018, 06:02 AM   #14
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,449
Default

Just wanted to say "thank you" for these snippets, very useful!
And you made me switch to VSC from Notepad++
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 10-02-2018, 05:00 AM   #15
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,846
Default

Just a little heads up of something that gave me a bit of head scratching, maybe useful for someone else...

I wondered why using Lua bitwise operators (&, |, ...) in Code (using vscode-lua extension) always showed an error.
Turned out default Lua version is set to 5.1 and needs to be set to 5.3.

nofish is offline   Reply With Quote
Old 11-15-2018, 08:50 AM   #16
ThrashJazzAssassin
Human being with feelings
 
ThrashJazzAssassin's Avatar
 
Join Date: Oct 2010
Location: Scotland
Posts: 353
Default

Thanks for making a start on this Lokasenna. There's still a lot missing, so to help out, I thought I'd go through some jsfx in the Reaper IDE and record what the colours I see. Not an exhaustive list.

I have no VS Code extension authoring experience, but I'll look in to it. May be a while before I can make a contribution.

Dark Blue
Comments✔


Cyan
:?✔
URL's e.g. http://www.cockos.com
in_pin:
out_pin:
slider1:
@init
@slider
@serialize
@block
@sample
@gfx
filename:
<>=()=+-;[]{}|.
options:


Blue
function✔
local✔
loop✔
this.
instance
globals


Green
#numbers e.g. 1024✔


Pink
"strings"✔


yellow
custom function name allocation✔
custom function calls


Bold yellow
built-in function calls:
midirecv
midisend
memset
gfx_blitext
gfx_getpixel
gfx_rectto
gfx_printf
gfx_set
gfx_setfont
floor
gfx_drawnumber
gfx_drawchar
gfx_lineto
gfx_rectto
min
max
abs


Red
Built-in variables (reserved):
mouse_cap
mouse_x
mouse_y
mouse_wheel
ext_noinit
beat_position
ts_num
play_state
srate
gfx_h
gfx_x
gfx_y
gfx_a
gfx_g
gfx_b
gfx_r
gfx_w
__________________
TJA MIDI JSFX | REAPER-OSC-panels | erthoide
ThrashJazzAssassin is online now   Reply With Quote
Old 11-29-2018, 12:21 PM   #17
inscript
Human being with feelings
 
Join Date: Aug 2018
Posts: 11
Default

I'm new to VSCode. I'm attempting to use a portable installation of VS and I've cloned the folder into Data/Code/Extensions, and pasted the file association into my settings, but I still can't seem to get an option in the bottom left corner for EEL/JSFX file formatting. Also, does anyone know what the acceptable jsfx extension is (assuming its .jsfx), because file associations in VS won't work unless I name my saved effects with their extension, correct?
inscript is offline   Reply With Quote
Old 02-16-2019, 07:44 PM   #18
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,020
Default

Quote:
Originally Posted by inscript View Post
I'm new to VSCode. I'm attempting to use a portable installation of VS and I've cloned the folder into Data/Code/Extensions, and pasted the file association into my settings, but I still can't seem to get an option in the bottom left corner for EEL/JSFX file formatting. Also, does anyone know what the acceptable jsfx extension is (assuming its .jsfx), because file associations in VS won't work unless I name my saved effects with their extension, correct?
This is a ridiculously late reply, but the problem with JSFX is that they don't have a file extension at all; that's why you have to paste that file association code into your settings. It just tells VS Code that any file under your Reaper/Effects folder (where the JSFX all live) is a JSFX.
Lokasenna is online now   Reply With Quote
Old 02-16-2019, 08:02 PM   #19
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,020
Default

Quote:
Originally Posted by ThrashJazzAssassin View Post
Thanks for making a start on this Lokasenna. There's still a lot missing, so to help out, I thought I'd go through some jsfx in the Reaper IDE and record what the colours I see. Not an exhaustive list.
Sorry for such a late reply, and thanks for doing that. I've tossed your list into an issue on the project repository: https://github.com/jalovatt/reaper-vs-code/issues/3

I'm (hopefully) starting to get back into Reaper stuff, so with luck I might be able to take a crack at it. In the meantime, if you're at all interested it's not super complicated:

- in the folder where you installed the EEL2 extension, open syntaxes/eel2.tmLanguage.json. The file is really just a series of tags and regular expressions to tell it what a function is, or what your language's keywords are, etc.

- In VS Code, open the command palette (Cmd+Shift+P or F1, I think) and choose "Inspect TM Scopes". This will show you exactly what the language parser sees for the text at your cursor location.

- Saving the file should automatically update the coloring in VS Code. If it doesn't, re-opening the file or reloading the window will.

- If you do make any progress, you can either submit a pull request with your changes on the project repo or just PM me and I can handle it myself.

Cheers.
Lokasenna is online now   Reply With Quote
Old 06-24-2019, 05:01 AM   #20
n0ne
Human being with feelings
 
Join Date: Jun 2014
Posts: 69
Default

Thanks so much this is amazing! Can't believe I'm only finding this now
n0ne 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 09:08 AM.


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