|
|
|
07-09-2018, 09:14 AM
|
#1
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
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!
|
|
|
07-23-2018, 09:00 AM
|
#2
|
Human being with feelings
Join Date: Oct 2017
Posts: 18
|
thank you very much Lokasenna!
|
|
|
07-25-2018, 09:55 AM
|
#3
|
Human being with feelings
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,619
|
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!
|
|
|
07-26-2018, 01:00 PM
|
#4
|
Human being with feelings
Join Date: Feb 2015
Posts: 755
|
Anyone know how to do quick lua formatting (indentation) in VS Code for some minified lua?
|
|
|
07-26-2018, 06:28 PM
|
#5
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
What happens if you open the Command Palette and find "Format Document"? Do you have a Lua extension (I like "vscode-lua")?
|
|
|
07-31-2018, 06:46 AM
|
#6
|
Human being with feelings
Join Date: Feb 2015
Posts: 755
|
Quote:
Originally Posted by Lokasenna
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.
|
|
|
07-31-2018, 07:35 AM
|
#7
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
While we're on the topic of extensions, Bracket Pair Colorizer is incredibly helpful.
|
|
|
07-31-2018, 08:13 AM
|
#8
|
Human being with feelings
Join Date: Feb 2015
Posts: 755
|
Quote:
Originally Posted by Lokasenna
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!
|
|
|
08-02-2018, 05:36 AM
|
#9
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
|
I'm using these snippets happily. Thank you.
|
|
|
08-02-2018, 07:20 AM
|
#10
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
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.
|
|
|
08-07-2018, 11:58 PM
|
#11
|
Human being with feelings
Join Date: Apr 2016
Posts: 39
|
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.
|
|
|
08-08-2018, 04:15 AM
|
#12
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Cheers, merged.
|
|
|
08-15-2018, 02:38 PM
|
#13
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
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.
|
|
|
09-05-2018, 06:02 AM
|
#14
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Just wanted to say "thank you" for these snippets, very useful!
And you made me switch to VSC from Notepad++
|
|
|
10-02-2018, 05:00 AM
|
#15
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
|
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.
|
|
|
11-15-2018, 08:50 AM
|
#16
|
Human being with feelings
Join Date: Oct 2010
Location: Scotland
Posts: 422
|
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
|
|
|
11-29-2018, 12:21 PM
|
#17
|
Human being with feelings
Join Date: Aug 2018
Posts: 19
|
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?
|
|
|
02-16-2019, 07:44 PM
|
#18
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by inscript
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.
|
|
|
02-16-2019, 08:02 PM
|
#19
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by ThrashJazzAssassin
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.
|
|
|
06-24-2019, 05:01 AM
|
#20
|
Human being with feelings
Join Date: Jun 2014
Posts: 152
|
Thanks so much this is amazing! Can't believe I'm only finding this now
|
|
|
08-27-2019, 03:39 AM
|
#21
|
Human being with feelings
Join Date: Feb 2017
Location: Belgrade, Serbia
Posts: 338
|
Quote:
Originally Posted by Lokasenna
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!
|
OMG OMG OMG!!!
Thank you for this, you don't know how useful this is for me!
YOU ARE AWESOME!
|
|
|
09-26-2019, 07:25 PM
|
#22
|
Human being with feelings
Join Date: Sep 2018
Location: China
Posts: 565
|
Hi, I'm wondering why when I type "oncommand" in a lua script, it shows "Main_OnCommand" but not "reaper.Main_OnCommand" ?
|
|
|
09-26-2019, 08:20 PM
|
#23
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Not sure.
VS Code has some settings for how it handles code snippets, but I don't remember if any of them would affect that.
|
|
|
09-27-2019, 07:11 AM
|
#24
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,857
|
Quote:
Originally Posted by dsyrock
Hi, I'm wondering why when I type "oncommand" in a lua script, it shows "Main_OnCommand" but not "reaper.Main_OnCommand" ?
|
Just to clarify: - Did you copy the reaper-api.code-snippets file (from the snippets folder of the github download linked in post #1) to the appropriate folder?
- And what operating system are you using in this case?
|
|
|
09-28-2019, 12:26 AM
|
#25
|
Human being with feelings
Join Date: Sep 2018
Location: China
Posts: 565
|
Quote:
Originally Posted by solger
Just to clarify: - Did you copy the reaper-api.code-snippets file (from the snippets folder of the github download linked in post #1) to the appropriate folder?
- And what operating system are you using in this case?
|
Hi, thanks for your reply. I've fixed this issue, but came across a new one.
Can I remove the first option, and left others there? And what does the "abc" icon mean?
|
|
|
09-28-2019, 05:13 AM
|
#26
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,857
|
Quote:
Originally Posted by dsyrock
Can I remove the first option, and left others there? And what does the "abc" icon mean?
|
The icons represent different types of IntelliSense completions: in this case 'abc' for words and the 'rectangle' for snippet prefixes.
It's possible to disable the 'abc' word ones: - by unchecking the Editor: Word Based Suggestion option in the Text Editor > Suggestions page of the settings (File > Preferences > Settings) **
- or by adding the "editor.wordBasedSuggestions": false line in the settings.json file directly
More details here:
** As a side note: it's a good strategy in general to use the search bar at the top of the settings page to find specific options more quickly (in this case, for instance, by searching for 'suggestion' or 'intellisense'):
https://code.visualstudio.com/docs/g...ettings-editor
Last edited by solger; 09-28-2019 at 05:48 AM.
|
|
|
09-28-2019, 06:29 AM
|
#27
|
Human being with feelings
Join Date: Sep 2018
Location: China
Posts: 565
|
[QUOTE=solger;2186176]It's possible to disable the 'abc' word ones: - by unchecking the Editor: Word Based Suggestion option in the Text Editor > Suggestions page of the settings (File > Preferences > Settings) **
- or by adding the "editor.wordBasedSuggestions": false line in the settings.json file directly
Big help for me, thank you solger!
|
|
|
10-05-2019, 06:49 AM
|
#28
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Thanks for the reaper-api snippets, I finally gave VS Code a try (portable install), cool!
Has anyone made snippets for js_ReaScriptAPI?
I'm making a little utility (vb.net) that parses and builds a snippet for me.
Thanks!
Last edited by Edgemeal; 10-05-2019 at 12:25 PM.
|
|
|
10-05-2019, 09:54 AM
|
#29
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Ausbaxter made the snippets with a script that parsed through Reaper's generated API docs, which will include the JS extension if you have it installed. I don't have the script, otherwise I'd be happy to keep things more up-to-date.
|
|
|
10-05-2019, 10:04 AM
|
#30
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Thanks, I was wondering if that was possible, didn't look into parsing the html (yet).
Last edited by Edgemeal; 10-05-2019 at 07:19 PM.
|
|
|
10-05-2019, 10:30 AM
|
#31
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
PMed ausbaxter to see if I can get the script he was using.
|
|
|
10-05-2019, 07:18 PM
|
#32
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
That be great!
Edit, I parsed the html so all code comments are now included, but still only for Lua.
Last edited by Edgemeal; 10-14-2019 at 08:03 PM.
|
|
|
10-06-2019, 01:24 AM
|
#33
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Weee, thanks Edgy!
|
|
|
10-06-2019, 07:49 AM
|
#34
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Are there any settings (font size, wordwrap,etc) for that code info area? It breaks words and can be hard to read.
|
|
|
10-06-2019, 08:30 AM
|
#36
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Added code by ShenHongFei, (/* suggest-widget size */)
https://github.com/microsoft/vscode/issues/53565
At least snippet and description popups are wider now, that helps!
@solger, looks like a similar workaround.
EDIT, with the newer versions of VS CODE you can now just resize the description window with mouse.
Last edited by Edgemeal; 04-10-2021 at 11:38 AM.
|
|
|
10-06-2019, 12:21 PM
|
#37
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Quote:
Originally Posted by _Stevie_
Weee, thanks Edgy!
|
Updated (see post #32), preserved line breaks in code comments, previously I removed them and they were just a single line.
|
|
|
10-06-2019, 05:22 PM
|
#38
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Awesome, getting it, thanks!
|
|
|
10-13-2019, 09:28 AM
|
#39
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Whats up with the reaper-api.code-snippets?, their not even complete. Example I just tried adding GetFocusedFX and all I get is,
Code:
reaper.GetFocusedFX()
That isn't very helpful at all, I was expecting the whole function text with the return params like this,
Code:
integer retval, number tracknumber, number itemnumber, number fxnumber = reaper.GetFocusedFX()
That's how I did the JS_API, Isn't that what you'd expect?
Or maybe I have old snippet file or something?
Last edited by Edgemeal; 10-13-2019 at 09:36 AM.
|
|
|
10-13-2019, 09:42 AM
|
#40
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
No, you are right, they are indeed missing :/
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 04:36 AM.
|