07 August 2018, 21:47 | #1 |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
|
Visual Studio Code Blitz Basic extension
Visual Studio Code is a light weight, open source IDE for Windows, Mac and Linux. I've started work on a custom extension for Blitz Basic. There's not a lot to it so far - basically just some code highlighting, I'd really like to work out how to add some intellisense or error checking to it.
I'm not that familiar with either textmate or regex so I don't claim it's well made by any means, and I'll accept pull requests if someone wants to improve on it. Instructions:
|
08 August 2018, 00:52 | #2 |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
|
I've started on Intellisense, in a somewhat hacky way - using the "snippets" functionality. With this we can autofill with the required and optional parameters, as well as display text from the manual (albeit with broken linewraps). While you can't just hover over a command to see all the details, you can see all the details of any command just by starting to type it in - or at least, once I've implemented every single command, thus far only the commands in the "Program Flow" section of the manual are there. When it's done, this should be pretty useful - I can hardly ever remember the syntax for InitCopList! - but it's probably going to take me a month or more to go through it. Edit: Done a few more check-ins, there's now 80 commands represented in autofill. In a couple of places, I've attempted to have useful autofill. Eg, if you want to target CD32 pads, type in "gameb", press tab and you'll get: Code:
CD32_Buttons = GameB(Port) CD32_Play = CD32_Buttons & 1 = 1 CD32_Reverse = CD32_Buttons & 2 = 2 CD32_Forward = CD32_Buttons & 4 = 4 CD32_Green = CD32_Buttons & 8 = 8 CD32_Yellow = CD32_Buttons & 16 = 16 CD32_Red = CD32_Buttons & 32 = 32 CD32_Blue = CD32_Buttons & 64 = 64 Last edited by earok; 08 August 2018 at 11:33. |
08 August 2018, 15:38 | #3 |
Registered User
Join Date: Oct 2008
Location: Finland
Posts: 643
|
Very nice earok! I have to try this out!
|
09 August 2018, 06:19 | #4 |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
|
Thanks mate!
Progress goes on with the Intellisense stuff. Reference sections 1-4 are done (20% of the total commands - eg 100 out of about 500!). HUGE thanks to Darren Chapman for whipping up a text parser to convert the commands in the manual to snippets - it'll make it much faster for bringing the rest of the text across. It should hopefully be all done in a day or two rather than a month! |
09 August 2018, 10:31 | #5 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
Great stuff
Is it possible to make use of MickGyver's work with notepad++ to integrate a compilation option via winuae/arexx? |
09 August 2018, 12:05 | #6 | |
Registered User
Join Date: Oct 2008
Location: Finland
Posts: 643
|
Quote:
Just let me know if I can help with this. The tools and instructions are available in this thread. |
|
09 August 2018, 12:12 | #7 |
Registered User
Join Date: Oct 2008
Location: Finland
Posts: 643
|
Also, it would be very nice to be able to use the code outline view in VS Code:
https://code.visualstudio.com/update...#_outline-view Did you look into this already @earok? Not trying to stress you or anything. I made a function list for my Notepad++ extension (RegEx) but I'm not sure how it's done in VS Code. |
09 August 2018, 12:37 | #8 | |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
|
Quote:
I'm not quite at that level yet! I could maybe look at that in future. What I was hoping to solve next is code formatting (so you can press SHIFT+ALT+F and have all of the scopes properly tab indented) There's two main components to what I've done so far. The first is just syntax highlighting, using Visual Studio Codes' standard colors and definitions. For example, this is in the .tmLanguage file Code:
{ "name": "keyword.control.operator.blitzbasic", "match" : "(?i)\\b(not|bitset|bitclr|bitchg|bittst|lsl|asl|lsr|asr|and|or)\\b" }, The second part is the "snippets" functionality, which is meant to be used for simple code shortcuts but in practice I find it useful as an intellisense alternative. For example: Code:
"ReadFile": { "prefix": "ReadFile", "body": [ "if ReadFile(File#,Filename$)", "\t;Do your file handling here.", "\tCloseFile File#", "else", "\t;The file was not successfully opened. Do your error handling here.", "endif" ], "description": "ReadFile opens an already existing file specified by Filename$ for sequential reading. If the specified file was successfully opened, ReadFile will return true (-1), otherwise ReadFile will return false (0). Once a file is open using ReadFile, FileInput may be used to read information from it." },
The project is open source and I'm happy to accept pull requests, such as WinUAE/ARREX integration if possible OR, I should be able to add others to have full write access to the repo if required? |
|
09 August 2018, 12:58 | #9 |
Registered User
Join Date: Aug 2018
Location: england
Posts: 24
|
when editing on a modern pc does the blitz code get compiled on the pc and turned into an amiga binary file, or does the blitz code get inserted into the amiga compiler?
|
09 August 2018, 13:05 | #10 |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
|
There's currently no way to compile Blitz Basic from a purely PC environment - solutions such as this require WinUAE running the original Blitz Basic compiler to compile the code.
|
09 August 2018, 17:00 | #11 |
Registered User
Join Date: Aug 2018
Location: england
Posts: 24
|
|
09 August 2018, 22:38 | #12 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
I wonder whether one could use something like AWS to remotely start a virtual machine running winuae, compile the software and save it back to the local computer. I'll investigate...
|
10 August 2018, 11:46 | #13 |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
|
I'm done on the project for now - I've finished transferring nearly 550 commands to the intellisense snippets (there's likely to be a few missing commands here and there, and I KNOW that there's AREXX, BREXX and Serial Port commands missing - anyone's welcome to add anything that I've missed).
Next month I'll look at adding intellisense for either library commands or 68K instructions. Definitely very interested to see if anyone comes up with some form of WinUAE integration |
10 August 2018, 11:59 | #14 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
I did many years ago some kind of headless WinUAE mode that boots to remote shell (via telnet I think) with current directory as boot drive. Perhaps it would be useful in this situation? (it most likely isn't working anymore or was not fully implemented)
|
11 August 2018, 11:26 | #15 |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
|
I have a partial solution for building through Visual Studio Code! It's not perfect (yet) but I've found it fairly useful.
On the Visual Studio end -
On the WinUAE end, I have a configuration like so: - DH0 points to a folder that has the Blitz Install, and has a Startup-Sequence that tells it to go to DH1 and run "execute make" - DH1 has the blitz project itself, and make is a script that makes a copy of the source (so that we don't tokenise the original source), and opens that copy in Blitz. To be clear - the DH0 folder is shared between all of my Blitz projects, DH1 is different for each project. There are at least two issues that prevent this from being a fully complete build process: 1. Blitz still requires manual mouse intervention to compile (MickGyver, you solved this through AREXX or the like..?) 2. WinUAE still needs to be manually closed afterwards (Toni, I take it there's no way to tell WinUAE to quit from inside the emulated Amiga environment..?) |
11 August 2018, 11:38 | #16 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Early versions of the Blitz editor don't have an ARexx port. However, Blitz itself has a "BRexx" library that basically fakes Intuition inputs, so it should be possible to write a simple program to do whatever you need.
|
11 August 2018, 12:06 | #17 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
You mean, use blitz to automate blitz? That's brilliantly recursive
|
12 August 2018, 01:37 | #18 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
Just use ARexx. It's super-easy. http://eab.abime.net/showthread.php?t=77610
|
12 August 2018, 03:07 | #19 |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
|
Hey, that's pretty cool. So, I've got my execute script to include
Code:
run blitz2:blitz2 SYS:REXXC/waitForPort TED_REXX1 SYS:REXXC/rx "address TED_REXX1; SHOWSCREEN" SYS:REXXC/rx "address TED_REXX1; ACTIVATE" SYS:REXXC/rx "address TED_REXX1; LOADNEW 'build.bb'" SYS:REXXC/rx "address TED_REXX1; COMPILE 'build.bb'" However, some odd quirks - when I quit the game, I still have the "Okee Dokee" and "!PANIC!" windows open, and I can't seem to dismiss them? |
12 August 2018, 12:06 | #20 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
@earok
thanks for your work. I will use it with VSCode on my Mac It even kinda works now but I still have one issue. After the SuperTED start I can't get rid of the welcome splash window with OKEE DOKEE buton and thus the TED can't load the file. Is there a way to get rid of this window automatically so the file loads? I also don't quite understand how to deal with ascii files and the .xtra config files so I don't have to change number of SHAPES for example in the compiler config. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Amiga Assembly extension for Visual Studio Code | prb28 | Coders. Asm / Hardware | 342 | 15 December 2023 21:22 |
Blitz Basic 2 source code | Retro1234 | Coders. Blitz Basic | 8 | 25 May 2016 05:07 |
very basic C/ASM/Visual Studio hand holding | Sephnroth | Coders. C/C++ | 2 | 08 March 2016 20:15 |
Somebody teach me to code in Blitz Basic, please!!! | Toni Galvez | Coders. Blitz Basic | 18 | 21 May 2015 00:03 |
3D code and/or internet code for Blitz Basic 2.1 | EdzUp | Retrogaming General Discussion | 0 | 10 February 2002 11:40 |
|
|