July 06, 2020, 09:24:11 AM

Author Topic: BlitzMax VSCode extension  (Read 4280 times)

Offline LT

  • Jr. Member
  • **
  • Posts: 35
Re: BlitzMax VSCode extension
« Reply #30 on: May 13, 2020, 07:00:40 AM »
Derron, in another thread, also told me about it.  Left that part out.
I don't have time to experiment right now, but later I might like to take a look and was unaware of where to find it.
Yeah, I made the mistake of looking at the BMX github because I forgot about Brucey's other repository.

Thanks for the link, though.  At least you didn't just tell me to Google it.

Offline Hezkore

  • Full Member
  • ***
  • Posts: 129
  • Juicy 🍑
Re: BlitzMax VSCode extension
« Reply #31 on: May 13, 2020, 04:26:38 PM »
The link posted by Skaven is the correct one.
You'll have to "compile" (transpile I guess) it yourself, which is super easy but understandable confusing if you're new to VSCode.
Some related info can be found here: https://code.visualstudio.com/api/get-started/your-first-extension
The goal is to eventually integrate it into my extension, and at that point it should "just work".
But I'm working on documentations right now, so it's not something you'll see happen anytime soon.
Keep it simple. 🚀
GitHub
BlitzMax for VSCode

Offline Lavalamp

  • Jr. Member
  • **
  • Posts: 10
Re: BlitzMax VSCode extension
« Reply #32 on: May 17, 2020, 09:22:43 PM »
Hi, can we have the default BlitzMax colour theme please?

Offline Hezkore

  • Full Member
  • ***
  • Posts: 129
  • Juicy 🍑
Re: BlitzMax VSCode extension
« Reply #33 on: May 18, 2020, 03:49:57 AM »
Hi, can we have the default BlitzMax colour theme please?

I don't really have time to manage a theme extension for VSCode. :(
Most of my free time is already taken up by this extension.

But there are thousands of themes available for VSCode!
And you should definitely try searching for a theme that suites you.
Just jump over to the 'Extensions' tab (Ctrl Shift X on Windows) and type @category:themes
You'll get a long list of all the themes available, and one is bound to be in your taste.
(here's an online view)

Alternatively you could make your own theme extension.
More info about that can be found here:
https://code.visualstudio.com/docs/getstarted/themes#_creating-your-own-color-theme
Keep it simple. 🚀
GitHub
BlitzMax for VSCode

Offline Yellownakji

  • Sr. Member
  • ****
  • Posts: 253
  • No.
Re: BlitzMax VSCode extension
« Reply #34 on: May 23, 2020, 06:01:39 AM »
How do you create a 'solution' or 'project' in VSCode, in the way BLide does?  I usually stray away from Microsoft stuff, so this is new to me;  Loooong time user of BLide, so it's really annoying how VSCode makes me set my NG preferences each time I open a file.   I'm using the x86 version of NG, and by default VSCode targets x64.

Secondly, can VSCode embed an Icon/Meta into the project, like BLide?  Or is it one of those painful Macintosh situations where I need a 'post' script....

Digging the red theme in VSCode, as well as the mini-map in the top right that shows the whole source as you scroll, but I really need a 'solution' to making a solution/project.  :P :-X

Offline Hezkore

  • Full Member
  • ***
  • Posts: 129
  • Juicy 🍑
Re: BlitzMax VSCode extension
« Reply #35 on: May 23, 2020, 12:56:15 PM »
How do you create a 'solution' or 'project' in VSCode, in the way BLide does?  I usually stray away from Microsoft stuff, so this is new to me;  Loooong time user of BLide, so it's really annoying how VSCode makes me set my NG preferences each time I open a file.   I'm using the x86 version of NG, and by default VSCode targets x64.
There's so much VSCode can do to help you manage your project, I couldn't possibly tell you everything here.
I would instead recommend that you read through some of the "Get Started" help for VSCode:
https://code.visualstudio.com/docs

What I can say though is that VSCode is made for very large projects.
Projects that span across multiple computers with different architectures, hard drives, networks and operative systems.
Things that MaxIDE and BLide could only dream of.

But because of that; VSCode isn't the best when it comes to just opening a single file.
So what you'll want to do is select "Open Folder...".
VSCode will then threat that folder as your very simple "workspace" and save any related settings in the new ".vscode" folder.
You can at that point configure VSCode to act, look or behave in a certain way just for that workspace.
For example; the simplest thing would be to just select which '.bmx' file to use as the main entry point when compiling.
You could also do things like use a special custom version of BlitzMax.
Or just use a different VSCode theme when working in that folder.
So always selecting "Open Folder..." is probably best for new users.

There's also a more advanced workspace called a "multi-root workspace".
This would create an actual ".code-workspace" file.
(pro tip: if there's a .code-workspace file in a folder; then "Open Folder..." will still open the .code-workspace file)
This more advanced workspace will allow you to grab source folders from many different locations.
But the "downside" is that you might have to start working with the task system, because VSCode won't know what to do with your new huge project.
The task system is great and I strongly recommend that you learn how to use it, instead of relying on the extensions default task.
https://code.visualstudio.com/docs/editor/tasks
For example; you could have a server and client as two separate projects in a multi-root workspace and have VSCode compile the server and client, then fire up the server for you, then start the client and connect to the server.
Or perhaps you're working a BlitzMax module while also working on a game that uses that module.
You could then use a mutli-root workspace to easily edit both projects and then configure a task to move the module into BlitzMax's "mod" folder, then compile the game and eventually run the game as well.

Secondly, can VSCode embed an Icon/Meta into the project, like BLide?  Or is it one of those painful Macintosh situations where I need a 'post' script....
I'm not sure exactly how BlitzMax NG handles icons on Mac.
On Windows I know you place an ".ico" with the same name in your folder.
So I'm afraid you might have to use some sort of black magic on Mac.
However, if there is a reliable way to do it on Mac that Brucey endorses; I could integrate that into the extension.

Digging the red theme in VSCode, as well as the mini-map in the top right that shows the whole source as you scroll, but I really need a 'solution' to making a solution/project.  :P :-X
I'm glad you've found a theme you enjoy. :)
Remember that there are several thousands of themes, and that you can customize things like how the mini-map looks to suite you even better!
Dig through those settings, and remember that you can configure VSCode globally, or for your current folder/workspace.
Keep it simple. 🚀
GitHub
BlitzMax for VSCode

Offline Holzchopf

  • Full Member
  • ***
  • Posts: 141
Re: BlitzMax VSCode extension
« Reply #36 on: June 02, 2020, 03:23:27 PM »
the simplest thing would be to just select which '.bmx' file to use as the main entry point when compiling.

How do I do this? I don't have the "Set as workspace source file" option, when I right click the file =/ Or is this now "Set as default task source file"?

Offline Hezkore

  • Full Member
  • ***
  • Posts: 129
  • Juicy 🍑
Re: BlitzMax VSCode extension
« Reply #37 on: June 02, 2020, 04:36:24 PM »
Or is this now "Set as default task source file"?

That's correct.
Use "Set as default task source file" whenever you want to defined your entry point.

For any of you wondering why it's called that and not something like "workspace source file", it's because VSCode heavily relies on tasks.
A task is really just a simple JSON document with some pre-defined variables you change around based on your needs.
And when you press Ctrl Shift B, F5 or click one of the build buttons in the corner; you're really just executing a task, which in this case, happens to build your application.
Normally you'd have to create a task yourself, but this extension will make up a basic task for you if one isn't found.
But the idea is that you'd have a couple of tasks that all do different things.
Like for example if you're building a game that has a set of tools you're also developing on the side, you could have tasks that builds one of those and launches them.
Or if you need to do some batch work stuff, then you'd have a bunch of tasks for that.
Or perhaps you just want a task that opens up Photoshop and instantly opens your tilemap image.
All of that is done with tasks! Tasks that you can create and setup, just the way you want.
So there's not really a "single workspace task", no "one task to do it all".
But! You can select which task runs by default, your so called "default task".
And BlitzMax specific tasks has a variable called "source", which will be your entry point.
So "Set as default task source file" really does make sense.
Keep it simple. 🚀
GitHub
BlitzMax for VSCode

Offline Holzchopf

  • Full Member
  • ***
  • Posts: 141
Re: BlitzMax VSCode extension
« Reply #38 on: June 03, 2020, 07:19:24 AM »
Thanks for the explanation!

Offline Yellownakji

  • Sr. Member
  • ****
  • Posts: 253
  • No.
Re: BlitzMax VSCode extension
« Reply #39 on: June 18, 2020, 09:34:03 PM »
After a few weeks of usage, I can't say VSCode is really offering me anything beneficial aside from a cleaner interface and the minimap.

The tooltips are pretty useless and never show me what I actually want.    They also give me incorrect parameters for functions.

For example, when I store paths, just have a type called 'DIR' and have stuff like Global Data:string = pathhere etc.

Well, the tooltips don't even detect 'DIR' or ANY of my types, frankly.    And when I fully type the type name, no dice on detecting it's functions either.  --  This goes for items declared within the target/source BMX and included external BMXs.

Even variables in my target BMX aren't getting defined.

In fact, the tooltips only list internal BMX/MOD functions;  Even things not declared in my framework.

I don't use the Steam module, yet every tooltip gives me steam related junk.

How do I define the actually useful Necessities to tooltips?   

Offline Derron

  • Hero Member
  • *****
  • Posts: 3033
Re: BlitzMax VSCode extension
« Reply #40 on: June 18, 2020, 10:18:24 PM »
For this you better wait for some kind of "language server"  - some kind of tool which returns all the necessary information about your code (and the modules) to VS Code. The extension here can only "dumb" scan the modules you have and prepare stuff for it.
Dunno - it might be able to scan your code too later on - but I am not sure if it is worth the hassle.

Such a LSP-enabled tool is far far far on the horizon, so nowhere to see in the near future. For now even the basics (communication blitzmax code - vs code stuff) is not working perfectly fine / the way Brucey wanted it do be. Debugging all the stuff seems to be a hassle too (as VS Code and other "full feature IDEs" are complex code beasts on their own).

Benefit of the extension is that you can add some other conveniencies later on - project setup (android? manifests?) ...

Also - once Brucey got the debugger stuff working, you might even get dynamic breakpoints etc.


VS Code seems to allow you to code "remotely" (run stuff on your home computer - but code on your laptop while commuting - the beefy computer at home does the number crunching).

bye
Ron

Offline Lavalamp

  • Jr. Member
  • **
  • Posts: 10
Re: BlitzMax VSCode extension
« Reply #41 on: June 21, 2020, 02:46:21 AM »

Quote
I'm not sure exactly how BlitzMax NG handles icons on Mac.
On Windows I know you place an ".ico" with the same name in your folder.
So I'm afraid you might have to use some sort of black magic on Mac.
However, if there is a reliable way to do it on Mac that Brucey endorses; I could integrate that into the extension.


Actually, no black magic, if BlitzMax would simply move the ICNS file it finds in the same directory as the ICO file into the resulting MacOS build package's Resources directory at
Code: [Select]
MyGame.App/Contents/Resources/MyGame.ICNS , done.

BTW I use https://cloudconvert.com/png-to-icns to create the required Mac icon file.


Offline Hezkore

  • Full Member
  • ***
  • Posts: 129
  • Juicy 🍑
Re: BlitzMax VSCode extension
« Reply #42 on: June 22, 2020, 12:12:00 PM »
if BlitzMax would simply move the ICNS file it finds in the same directory as the ICO file into the resulting MacOS build package's Resources directory at
Code: [Select]
MyGame.App/Contents/Resources/MyGame.ICNS , done.

Cool.
Sounds like something you should ask Brucey to implement.
You can make a request here: https://github.com/bmx-ng/bmx-ng/issues

In fact, the tooltips only list internal BMX/MOD functions;  Even things not declared in my framework.

I don't use the Steam module, yet every tooltip gives me steam related junk.

That's correct.
The extension can only scan your modules for the bbdoc REM blocks and store the information given from those.
Then it basically just shows you all the information it has, and you'll have to use the information correctly yourself.
(arrow keys to scroll through tooltips and auto complete lists)
One option is to just disable it all in options and have it act like MaxIDE.
You can use the Modules tree view to view all available functions and such for all modules.

For more correct auto complete and tooltips; I'd have to write a complete BMX parser that works exactly like BlitzMax NG (and BlitzMax Legacy I suppose), in a completely different language.
Which is a lot of work and would take a long time to get done, and I barely have any free time these days.
And as Derron says, it's hardly worth the time.
A LSP (Language Server Protocol) would be the better option and would then work with any IDE that supports it.
Brucey would probably have to write the LSP itself though, so there's not a whole lot I can do.

After a few weeks of usage, I can't say VSCode is really offering me anything beneficial aside from a cleaner interface and the minimap.

This is going to be very subjective as you might not need any of the features VSCode provides, but I personally would never want to use anything but VSCode from now on.
Not only is it a very modern and open source IDE, that uses all the (now standard) default shortcut keys and methods of editing text (multiple cursors, jump to similar word etc.).
It's also got so many great extensions that you can basically do anything with it!
And it supports most languages, so you never have to use anything else.
And the fact that you can do everything Git related inside of VSCode is amazing to me.
Push, Pull, Commit, Review issues, manage branches and merges etc. all from inside VSCode with a super simple and clean interface.

Want to live code with a friend and use voice chat? No problem! - https://visualstudio.microsoft.com/services/live-share
Want to code in Linux on a Windows machine? No problem! - https://code.visualstudio.com/remote-tutorials/wsl/run-in-wsl
Want to code from another machine via SSH? No problem! - https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh
Want a nice Git graph inside VSCode? - No problem! - https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph
Want to see file/line history, when a file/line was changed, who changed what? - No problem! - https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens
Want to easily list/see TODO or FIXME tags? No problem! - https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree
Want to quickly create or view your Gists? No problem! - https://marketplace.visualstudio.com/items?itemName=vsls-contrib.gistfs
(Hit me up if you want more extension suggestions)

Want to have all of these great features in any other language so that you never have to change IDE ever again? No problem! - https://marketplace.visualstudio.com/search?target=VSCode&category=Programming%20Languages&sortBy=Installs

And VSCode is constantly updated with new great features, like this:
https://code.visualstudio.com/updates/v1_46#_pin-tabs
And the Settings Sync option will soon be ready for public release (available in VSCode Insiders version).
Which means that all extensions and settings will sync, seamlessly, across all your devices that uses VSCode.
https://code.visualstudio.com/docs/editor/settings-sync

All open source and for free, on MacOS, Windows and Linux.
Keep it simple. 🚀
GitHub
BlitzMax for VSCode

Offline DerFetteElch

  • Jr. Member
  • **
  • Posts: 3
Re: BlitzMax VSCode extension
« Reply #43 on: June 26, 2020, 01:45:51 PM »
Quote
Sounds like something you should ask Brucey to implement.

I don't think so, since it is already implemented into bmk. I think it was one of the first features offered.
All you need is a post.bmk file in your projects main folder that copies the icon into the compiled bundle before executing it.

Something like:
Code: Lua
  1. # MacOS post build script
  2. @define doPostInstall
  3.         if bmk.Platform() == "macos" then
  4.                 #copy resources
  5.                 sys.CopyDir(%buildpath% .. "/Contents/Resources", %exepath% .. "/../Resources")
  6.                 sys.RenameFile(%exepath% .. "/../Resources/AppIcon.icns", %exepath% .. "/../Resources/" .. %outfile% .. ".icns")
  7.         end
  8.  
  9. @end
  10.  
  11. # run the post install
  12. doPostInstall
  13.  

The folder structure in my "projects" looks like:

Quote
MainProjectDirectory
->Contents
->->Resources
->->->AppIcon.icns
->MainProjectFile.bmx
->post.bmk

edit: Sorry, link to the image was broken somehow added folder structure as quote.

Offline Derron

  • Hero Member
  • *****
  • Posts: 3033
Re: BlitzMax VSCode extension
« Reply #44 on: June 26, 2020, 08:44:00 PM »
You could use a "post.bmk" right in blitzmax/bin

Code: [Select]
' global post process
LoadBMK("post.bmk")

' generic post process
LoadBMK(ExtractDir(app_main) + "/post.bmk")

' project-specific post process
LoadBMK(ExtractDir(app_main) + "/" + StripDir( opt_outfile ) + ".post.bmk")

blitzmax/bin/post.bmk (global)
app/post.bmk (app folder local)
app/myapp.post.bmk (app specific)


bye
Ron

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal