BennuGD syntax package for Visual Studio Code IDE

Started by KeiDash, March 07, 2018, 11:08:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

KeiDash

Hello!

This last week I'm working on "the possibility of use Visual Studio Code for write BennuGD code and compile games on it".

I got it finally and I wrote a extension for this IDE for has the syntax highlighting support for BennuGD on this.

If someone wants to use it because they think it might be useful, here are the links to my github repository.

To Improve: block comments, I dont't know how to configure it yet, maybe in the next update.

Download the extension here


warrior_rockk


Yeah!!!! I was thinking on that this week! I think that Visual Studio Code is a powerful tool and maybe well be great for Bennu.
Many thanks man!


JaViS

Nice! I didn't know of the existence of this IDE, I will create a news on the home page linking to your repo.


Thanks!
Working on Anarkade. A couch multiplayer 2D shooter.

JaViS

One Question. How do I compile and run the program from the IDE?
Working on Anarkade. A couch multiplayer 2D shooter.

KeiDash

Quote from: JaViS on March 08, 2018, 01:58:34 PM
One Question. How do I compile and run the program from the IDE?

Hi JaViS , thanks for your comment.

Well it's easy, I'm explain you.

Resumed, it's a simple batch file that comunicates the code and the binary files of bennuGD. You need to do the next:

1. Create a batch file (In my case I called it compile.bat) on the same path of your game code (each game use her own batch file). For example, you game calls "Tetris" and the main.prg file is located on C:\Code\Tetris\ . Put this .bat file in the same folder that your main.prg

2. Get the path of your BennuGD bin folder, in my case C:\BennuGD\bin\

3. Edit the .bat file like this:


@echo off

set "mainPath=C:\Code\Tetris\"
set "bennuPath=C:\BennuGD\bin\"

set "mainFile=main"
set "extension=.prg"

if exist %bennuPath%stderr.txt  del  %bennuPath%stderr.txt
if exist %bennuPath%stdout.txt  del %bennuPath%stdout.txt
if exist %mainPath%*.dcb del %mainPath%*.dcb

pushd %mainPath%

%bennuPath%bgdc.exe %mainPath%%mainFile%%extension%

if exist %bennuPath%stdout.txt  del  %bennuPath%stdout.txt
if exist %bennuPath%stderr.txt  del  %bennuPath%stderr.txt
if exist %bennuPath%stderr.txt  goto salida

%bennuPath%bgdi.exe %mainPath%%mainFile%
if exist %mainPath%stderr.txt  type %mainPath%stderr.txt

:salida
pause


If you need it (or someone) you can download a copy of my .bat file here

This file get the main paths and the main file of your code. Next, send at the compiler bgdc.exe the main.prg file and then, run the game compiled with bgdi.exe

How execute this on Visual Studio Code?

1. Go into your Visual Studio Code and the folder of your game code (C:\Code\Tetris)
2. Doble click on main.prg (now you see the file at the right)
3. Go to menu View > Open debug console and at the botton of your vsc appears a new window. Then, in this window click on Terminal and you will see something like windows command line (it's the same, you can use the commands of cmd like dir, cls, xcopy, etc)
4. This terminal must has your game folder as currect folder.
5. Now, you can write compile.bat here in the terminal, press enter and the code it's executed and any error o something response of the compiler writes here.

 

JaViS

Very detailed explanation!! thank you for taking the time to explain it.


there is already a news on the site about the extension. hope it gets more attention
Working on Anarkade. A couch multiplayer 2D shooter.

warrior_rockk

But, isn`t there a way to integrate the compilation onto the interface?

KeiDash

#8
Quote from: warrior_rockk on March 13, 2018, 09:18:19 AM
But, isn`t there a way to integrate the compilation onto the interface?

Well, yes it's possible, I'm explain you.

You can create a configuration in Debug menu item (create new configuration) but before this, you need to implement bennu language on vscode and for the moment, this doesn't exists (Someone would have to do it)

Once the language exists on vscode, you can create your custom debugs like press F5 an run the code.

in other way, you can create your own task (Task menu) to execute the .bat file directly. For the moment I don't have time to do it

Why use vscode instead of notepad++? For me, the reasons are various.

Visually, it's more comfortable
I can execute the code without open the main.prg file
I can view multiple files at the same time, to see the functions and processes

Notepad++ it's a strong IDE, but for me has a little shortcomings

I'm trying to find the way to execute all with a simple key in vscode

warrior_rockk

I am pretty comfortable with Notepad++ now because I already have the reasons that you noticed:





-I have autocompletion
-I have a script to execute the code without open the main.prg file
-I can view multiple files
-I have a project window, console output window and a process/functions window


My lack, and the reason to look for another editor, is the posiblity of autocompletion , not for the sintax, but for the user variables, user functions, etc..
I want to see if is posible to implement this important feature on Visual Studio Code...

KeiDash

Quote from: warrior_rockk on March 14, 2018, 07:26:16 AM
I am pretty comfortable with Notepad++ now because I already have the reasons that you noticed:





-I have autocompletion
-I have a script to execute the code without open the main.prg file
-I can view multiple files
-I have a project window, console output window and a process/functions window


My lack, and the reason to look for another editor, is the posiblity of autocompletion , not for the sintax, but for the user variables, user functions, etc..
I want to see if is posible to implement this important feature on Visual Studio Code...

Can you explain how to you did it? I never can see the functions/process definitions and never seen a console embeded  on the botton- Can you explain it please?

Regards

warrior_rockk

#11
Of course.




The process/function list is a plugin called SourceCookfier that you can download from plugin manager. It's allow to define a code structure for you custom language. There are my settings for BennuGD:


The console is another plugin called NpExec. It's allow to have a console window to send commands and read output info. It have the possiblity to store scripts to run batch and you can assign a color to error line and doble click in the error goes to the source code line!!


This is my console output filter to do this:





To run my code without the main.prg file opened, i made a NppExec script to compile and run always the main.prg file of the current project directory

SplinterGU

Download Lastest BennuGD Release: http://www.bennugd.org/node/2

warrior_rockk

I just realize that I forgot the main settings of the SourceCookifier process list. I attached the configuration file for BennuGD

darío

Hi Keydash,
It would be great if your README file explained how to install this extension (or if it is a standard VS code procedure, to link the documentation).I'd like to try this as VS Code is a very interesting IDE.

Best Regards,Dario


My sites:
Smart Fpg Editor - Painless FPG Edition for Bennu and PixTudio
fenixlib - .NET support for manipulating PixTudio, Bennu and Div graphic formats