SyntaxBomb - Indie Coders

General Category => Worklogs => Topic started by: Hezkore on June 29, 2019, 20:11:31

Title: BlitzMax VSCode extension worklog
Post by: Hezkore on June 29, 2019, 20:11:31
You can find more info and the release over at:
https://www.syntaxbomb.com/index.php/topic,5771.0.html (https://www.syntaxbomb.com/index.php/topic,5771.0.html)

So I've been working on a VSCode extension that adds BlitzMax and BlitzMax NG support to VSCode.
And instead of posting about every single feature I'm adding in that thread; I figured I'd open a worklog.

Recently, I've managed to parse the `commands.txt` file and add everything to the VSCode auto-complete system:
(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-06-29_21-08-09.png&hash=f9ffd737658db83954be00039c5623d79d19e5ba)

Next; somehow displaying help files associated with each command when the user presses `F1`.
Title: Re: BlitzMax VSCode extension
Post by: Hezkore on July 01, 2019, 09:22:48
VSCode has this thing called a "webview", which should be perfect for displaying the BlitzMax docs (seeing as how they're all HTML anyways).
But it turns out that the webview really only displays things from inside the extensions own workfolder.
That means that it won't display any images or CSS from the BlitzMax documents.

Basically, it ends up like this:
(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2Ffirefox_2019-07-02_16-58-39.png&hash=9c0fff307bf24abb83c3b80e99390a10e834e609)

It also doesn't allow for things like '#Print' at the end of the URL for jumping to sections in the HTML.
And I haven't quite figured out how to work around this...
Two hacky solutions come to mind though.

One: I just copy the docs folder into the extension folder at start and only reference those.
I could check the dates on the files and only copy the files that's been changed.
This doesn't solve the "URL jump to section ('#Print')"-problem though.

Two: I scrape the information from the HTML and display it myself.
This does fix the "URL jump to section ('#Print')"-problem, but it means that you can't navigate the documents like you're used to.

I'll update the extension later today with the new auto-complete stuff anyways, and keep working on the webview some more.
Title: Re: BlitzMax VSCode extension
Post by: Hezkore on July 01, 2019, 21:32:27
I've pushed the auto-complete update.
It features some much better indentation rules as well, making it less of a hassle to actually write code, heh.
VSCode will automatically update the extension for you at startup. (unless disabled)
And I made the auto-complete dialog a little nicer:
(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2019-07-01_23-59-39.png&hash=126984f30fd1c13bd5b59d260e85fa95316562e0)
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 02, 2019, 17:42:47
I noticed some architecture and platform oddities with the extension recently.
So I sat down and updated the build options to include architecture and platform.
The extension will automatically select the ones matching your system though, so you shouldn't have to even think about this.
And I believe these options are specific to BlitzMax NG, but feel free to correct me if I'm wrong.
Oh, and there's a new "Build Docs" command which lets you rebuild the BlitzMax module documentations from inside VSCode.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2019-07-02_18-41-54.png&hash=aa6af3dfe4158b447b5f0e8394d288a2d169c25e)

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2019-07-02_18-42-09.png&hash=748a52a6597e177cd34da49deac789fa4298aca8)
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 04, 2019, 23:06:16
I've pushed a small update which will make the extension less annoying if the BlitzMax path isn't correctly set.
It'll also ask the user to set the path if it's incorrect, instead of only when it's not set at all.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2019-07-05_00-08-17.png&hash=7df6600f437ea0468c474b5539fd41ffeba48ef5)

And I've gotten some requests about "folding".
The funny thing is that it's already supported!
It's just that VSCode doesn't show it unless you hover over it.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-07-05_00-11-07.gif&hash=a1aa31e7de5775f56f6ee2c9d897d8b852f02a71)

So I've now also set the `editor.showFoldingControls` to `always` for the extension.
You can still change it per workspace and user if you prefer the old style.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 05, 2019, 02:14:28
Sadly I've made no progress with the integrated documentations.
Though I've added some "hover information".
Basically if you hover over anything the extension will try to find an explanation for it:
(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-07-05_03-11-36.gif&hash=b8948b6d206f9a9a8e395a7d186ab43b90bae714)

This exposed a very minor bug that I've since fixed.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 05, 2019, 21:45:05
Been a busy day at work, so I've not managed to work a whole lot on the extension.
Did some polishing on the hover tips though.
They now include additional information (if it's been provided by the docs).
(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-07-05_23-00-14.gif&hash=ebe3ff90d0a76699e333058481c722467fc65aa6)

I'm still not sure how to provide the full documentations.
Thinking about just providing the scraped information with any attached example in a custom view.
At least until I can figure out a way to get the webview to work.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 11, 2019, 22:35:04
So I've been working on re-tooling some parts of the extension.
I'm also abandoning the standard BlitzMax documentations.
One thing I didn't like was that the commands.txt file didn't specifically tell me where the functions and all that was specified.
So I'm instead generating my own documentations, but I'm still using the standard bbdocs tags that 'makedocs' uses.
My system will however automatically updated itself if it detects any changes to the modules.
It'll also tell you exactly where each module function, variable, type etc. is defined.
But it's taking a lot longer than expected...

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2019-07-12_01-18-37.png&hash=fd16df671b6a96468505bdadec623e92280dc5b4)

I feel like it'll be worth it in the end though.
And this will of course work for both Legacy and BmxNG.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 15, 2019, 19:33:31
Slow but steady progress!

Dragon Quest Builders 2 has kept me rather busy.
But the module scanner can now go through all modules, plus all the imports and document every 'bbdoc'.
I'm pretty happy with the speed of it.
And it should automatically detect changes to the modules and update itself next start or by forcing a check.
It'll cache everything as well, so if no changes has been made; it'll just load the previous data.

Here's a video of it going through 266 modules.
Then next startup it uses the cached data and goes through 0 modules.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 16, 2019, 00:01:21
So the way the extension detects module changes and updates the docs is by checking each modules folder "last modified" date.
Basically what that means is that if any file is removed, renamed or created inside that directory; the extension will detect it and update the docs.
One problem, and a NTFS file system limitation really, is that modified files inside the folder does NOT update the "last modified" date for the folder.
So if you were to add a new function to your module; the extension would not detect it.
What I've done to fix this is make the extension also look at the "last modified" date on the main .bmx file for that module as well.
One problem however is that imports will not be picked up on by the extension.
That's why something like 'ModuleInfo "Version: 1.00"' is a good idea to have in your modules main .bmx file.
The extension would detect the version changes and update the entire module.

So basically:
Added/removed/renamed any source file - detected
Module main file modified - detected
Imported file modified - not detected

You can also force rebuild the docs yourself by calling a VSCode command!
(which is the only way to do it in MaxIDE)
So if there's anything that doesn't seem right, you can just call that command.
It takes less than 3 seconds to generate docs for all 266 modules on my computer anyways.

It will also, of course, detect any removed modules:
(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2019-07-16_01-08-15.png&hash=27424450defa9f2dd6bcc6fb27864efedab09eef)

Here's some of what the extension generates for the docs and saves as a Json:
(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2019-07-16_01-10-48.png&hash=37bb06f0c4c7fc2f0a5c035898bb19eb698a3c7e)
Title: Re: BlitzMax VSCode extension worklog
Post by: iWasAdam on July 16, 2019, 08:20:51
very impressive stuff and FAST. Great work doing this :)
Title: Re: BlitzMax VSCode extension worklog
Post by: Derron on July 16, 2019, 09:50:00
that last-modified-thing is what BMK has to fight too - if you want to do "quick" builds (only compile changed or never-compiled stuff) then it has to scan through folders too. Especially with wrappers of big libraries and updates of these libraries you might run into stuff not being catched properly.

I think you should have an option which also scans "deeply" for modules without "last modified" changes (for the "last modified" ones we can skip traversing through all the subfolders).
This works well as:
- threaded (you can edit code meanwhile)
- not needed immediately (syntax highlighting can "update" while coding)
- is still done pretty fast (especially with "framework" limiting available modules/files)

BMK cannot do that as for compilation it _needs_ current code compilates right in that moment.



Keep up the work - never thought you will put so much efforts in (I just got my Geany plugin working and ... work pretty much done. Barebone ;-)).


bye
Ron
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 16, 2019, 15:05:57
Thanks everyone!

And yeah, I do have some plans on how to better detect module changes.
But that will have to wait until later. :)

And grats on your Geany plugin!
Maybe Brucey needs to update this list then: https://blitzmax.org/docs/en/community/ides/
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 16, 2019, 18:51:43
One funny thing about making this module scanner is that I get to see all the bbdoc tag typos.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2019-07-16_19-54-22.png&hash=f41e14252764d92f5b1c7566fa03afd25cd6bb5a)

I'll eventually fix the typos and make a pull request... unless Brucey sees this.
Title: Re: BlitzMax VSCode extension worklog
Post by: Derron on July 16, 2019, 19:08:32
 ;D ;D


bye
Ron
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 17, 2019, 01:50:42
Since the modules are all documented now, it's possible to implement some neat features.
Like "jump to definition", which has a very nice "peek" mode.
It won't be very smart, like it won't detect methods and such correctly.
Eventually it might though, but not right now.
But I still find it very useful! Especially when the docs are lacking.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-07-17_02-48-34.gif&hash=04171dce937f46e93c8251fea95ae3509283a778)
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 18, 2019, 01:07:01
Features that were previously implemented had to be removed when I switched to my own documentation scanner.
And due to the missing features; I haven't released new extension versions in a while.
However most of the features (except for hover info) has been implemented again.
I've also implemented a new "signature help provider" which is basically just a fancy way of saying "function parameter hints".
Parameter hints were previously provided via hover information, or by the automatic snippets generated from the docs.
One problem though was that not everyone uses the snippets, so they'd have to hover over the function to see the parameters it took.

This is the old way (which still works just fine):
(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-07-18_01-54-56.gif&hash=99e79ec8f62b5e53cde0091a0d368cc464e869bf)

But you can now also get a real-time preview of what parameter you're editing:
(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-07-18_01-55-07.gif&hash=e573ea6d067f58bb4a95f5f19d51a77dab4a48d3)
(re-trigger parameter hints with Ctrl + Shift + Space in VSCode)
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 27, 2019, 16:17:25
I've finally implemented hover information again.
This time with working links.
(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-07-27_17-14-42.gif&hash=f19d15b1f42c83285faee52863fcc06a6b1ede41)

Still working on showing the docs in a better way.
Right now I generate a .bmx document with the bbdoc, about and return information for the command.
But it looks very basic and boring, so I'm still trying to figure out how to use the VSCode webview to display things like that.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 29, 2019, 23:08:24
I've pushed an actual update to the extension on the Marketplace!
A big chunk of the extension has been redone and reworked to use node.js promises instead of only (yucky) callbacks.
What that means is that you should all be able to use the new features, like the signature help provider, RIGHT NOW!
But it also means that things will most likely be very broken for a while heh.
You'll likely see a lot of 1.7.x versions with small fixes.
And the code needs a lot of clean up, but I'll fix things as I go.
So please bare with me while we work on getting things up to speed together!

Oh and documentation viewing is now in, but very ugly and basic!
I'll work on that for sure, both on how it works, but also on how it looks.
Though, I've come to realize that it'll never be as pretty or fancy as BlitzMax's default docs.
But I think I'm okay with that.
It should eventually give you about the same information anyways.
And I find "peeking" at the definition WAY more informative than the docs anyways.
And I think I can get "peeking" working pretty well eventually.

I'm also planning on starting some of my own BlitzMax projects.
Which means I'll actually be using the extension!
Up until this point; the only BlitzMax related thing I've worked on is... well this extension.
So me actually using the extension should show me any problems or annoyances with it.

Feel free to give me a shout in this thread, or the official thread for the extension (https://www.syntaxbomb.com/index.php/topic,5771.0.html) if you encounter any issues or have problems installing or setting things up.

Oh and we're almost at 100 installs, and over 150 downloads!  :o
Thanks to everyone for trying it out!

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2Ffirefox_2019-07-31_23-43-54.png&hash=eff390fc1b8bfe59f9333193977a49e75bb835f8)
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on July 31, 2019, 22:41:24
As expected; I've pushed a bunch of bug fixes, improvements and overall polish updates, all found by just using the extension myself.
We're up to to version 1.7.10 now, so 10 updates with several fixes in each.

One pretty embarrassing "bug" was that my cached modules would be included with the extension itself, whoops! :-X
It was just the default modules, so things should be fine.
But if you have any problems related to the modules, such as hover info, peeking, caching/loading, auto-complete etc; what you can do is jump into your extension folder and remove 'modules.json'.
You'll find 'modules.json' at this location:
Windows: %USERPROFILE%\.vscode\extensions\hezkore.blitzmax*
macOS: ~/.vscode/extensions/hezkore.blitzmax*
Linux: ~/.vscode/extensions/hezkore.blitzmax*
I'll implement a command for rebuilding the docs in (hopefully) the next version of the extension, which means you won't have to manually delete the .json file.
And I'll stick a "version" tag in the .json, so that if I change how the modules are loaded; the extension will just update it for you.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-07-31_23-43-35.png&hash=213e2bdeacf3f339e9479fb049b91784f4bc0d1c)
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on August 01, 2019, 20:38:51
Alright, version 1.17.12 is up!

1.17.12 features the new 'Generate Documentations' command.
Just hit Ctrl + Shift + P and type 'Generate' and it should show up.
This command will always generate documentations for all modules, no matter what time-stamp they might have.

And the 'modules.json' file is now replaced by a 'modules-<version>.json' file.
So when I update how the modules are generated internally; the old modules.json file won't be loaded anymore and a new one will be generated.
Which means that you should not have to worry about any of this anymore.
But if you somehow still have issues; just use 'Generate Documentations' and things should be fine.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2019-08-01_21-38-38.png&hash=5cf7ab8c471c0113125a8b0e4003b142e46f2e0e)
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on August 09, 2019, 19:43:32
More work on the extension!
A couple of fixes and changes that probably won't be so noticeable.
But the extension should work a lot better overall now.

One neat feature I'd like to mention is VSCode's "Remote" extensions.
If you're on Windows 10 and using the Windows Subsystem for Linux (https://docs.microsoft.com/en-us/windows/wsl/about); you can use the 'Remote - WSL (https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl)' extension.
You'll instantly jump into Linux and compile your BlitzMax code there!
It also works (almost exactly the same) over SSH by using the 'Remote - SSH (https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh)' extension.
So if you have a Linux machine somewhere; you can use it to compile your code.

Here's a short clip of me on Windows 10 using SSH to compile some BlitzMax code on my server computer running terminal Debian:
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on August 16, 2019, 21:09:26
There was recently a new VSCode update (https://code.visualstudio.com/updates/v1_37) which added support for "task resolving (https://code.visualstudio.com/updates/v1_37#_resolvetask-support)", which is something I've wanted for a long time.
Basically what it means is that I can now let the user modify `tasks.json` and have the extension properly read the modified data.
So I rewrote the build/task system for the 1.8.0 update to support the new features, and I'm pretty happy with the result.
And it should now be a lot less confusing to build and configure your applications.

Basically you just hit F5 or Ctrl + Shift + B to build.
F5 will always execute the newly built application.
While Ctrl + Shift + B will be a "proper" build, something you do when you're making a release.

You'll get to select the kind of application you want to build and a `tasks.json` will be created for you.
You can edit this file yourself and configure your application any way you want.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-08-16_22-03-14.gif&hash=4ff1d5cefa4a3c5eb4068f081b5d101fc881e7da)

You can also have multiple build tasks configured.
If you're building a server and a client; you could have two tasks, one for the client and one for the server.
And you could have a third task that builds AND executes both the server and client.

Give me a shout if you want any other build options implemented.


Oh and we've passed 100 installs and over 250 downloads (https://marketplace.visualstudio.com/items?itemName=Hezkore.blitzmax). :o
That means that over half of the SyntaxBomb forum is using the extension.
Now... I'm 100% sure these numbers are incorrect, but hey, you've got to celebrate something, right? ¯\_(ツ)_/¯

Thanks everyone.
Title: Re: BlitzMax VSCode extension worklog
Post by: iWasAdam on August 17, 2019, 08:21:06
all looks very slick :)

question.
is it available for macos?
Title: Re: BlitzMax VSCode extension worklog
Post by: Qube on August 17, 2019, 09:13:19
Quote from: iWasAdam on August 17, 2019, 08:21:06
all looks very slick :)

question.
is it available for macos?
Agree with all that :) - Really great work.
Title: Re: BlitzMax VSCode extension worklog
Post by: Derron on August 17, 2019, 13:51:36
Yes it looks nice - still awaiting/wishing for  a proper intellisense thing (so scanning your imported files rather than just modules and also knowing the type of the current variable to provide methods/functions/...). Think this is a pretty complex task (you need to create a grammar and so on so that VStudio knows how to tackle stuff).

Keep up with that project as long as you are motivated enough to do that.


bye
Ron
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on August 17, 2019, 15:50:23
Thanks everyone.

@iWasAdam
Yeah both VSCode and the extension is available for macOS.
You can find out more at the release thread: https://www.syntaxbomb.com/index.php/topic,5771.0.html (https://www.syntaxbomb.com/index.php/topic,5771.0.html)
I haven't actually tested it on macOS (not used my Mac in a long time...), but I am following all the rules with the extension heh.

@Derron
Yeah that is the dream!
Sadly there's no way of just telling VSCode how the language works and have it to do the work.
I'd have to manually parse all the BMX code (imports, modules etc.) and build some sort of tree structure myself.
Then when the user writes something I'd have to check what they're writing and reference the tree.
There's no automatic process for it sadly.

Another thing I'm hoping I can add in the future is proper debugging.
But the debugging example is so over engineered and specific that I'm not even able to modify it to use the BMK compiler.
But we'll see what happens. :)
Title: Re: BlitzMax VSCode extension worklog
Post by: Derron on August 17, 2019, 17:56:33
https://en.wikipedia.org/wiki/Language_Server_Protocol

This is what Studio supports. So in essence you would write a piece of code which returns all the required information of your source to Studio (or other Editors supporting LSP). Brucey once wrote he played a bit with it but for now there is no repository to sneak peak ;-)

So instead of writing something specific to Studio it would be better to support that whole thing in a way that allows to use it even with other editors.


bye
Ron
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on August 18, 2019, 20:24:34
For sure!
It'd be awesome if Brucey finally finished it.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on September 16, 2019, 01:04:17
Lately I've been working on a network module that comes with a server and client.
However modules need to be inside the BlitzMax 'mod' folder, but I instead wanted to work from my normal projects folder that contains all of my BlitzMax code.
Thankfully VSCode has some pretty nice dependency management for tasks!

Just by pressing F6 (Run previous task) in VSCode; the module will be moved over to my BlitzMax 'mod' folder.
When the move is complete; both the server and client -- which uses the module -- will be built simultaneously inside my normal project folder.
And when the build process is complete; both the client and server will be started simultaneously, nicely displayed next to each other.

This is achieved by having some compound tasks in the 'tasks.json'.
You can read more about them here: https://code.visualstudio.com/docs/editor/tasks#_compound-tasks (https://code.visualstudio.com/docs/editor/tasks#_compound-tasks)

But basically what you do is setup a normal 'bmx' build task for the server and then another build task for the client.
Then you can do something like this to build both at the same time:
{
"label": "Build Server & Client",
"dependsOrder": "parallel",
"dependsOn": [
"Build Client",
"Build Server"
],
"group": "build"
}

Notice "dependsOrder": "parallel", this can also be "sequence"

And to move the module over to the 'mod' folder; you can just run a normal 'shell' task and something like 'robocopy' to only copy the newer files:
{
"label": "Update Module",
"type": "shell",
"command": "",
"windows": {
"command": "robocopy",
"args": [
"/e",
"/xo",
"${workspaceFolder}\\src",
"${config:blitzmax.bmxPath}\\mod\\hez.mod\\znet.mod"
]
},
"group": "build"
}

Notice '${config:blitzmax.bmxPath}' which always points to your BlitzMax folder

Now I can easily test the module, server and client at the same time, just by pressing F6:
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on November 25, 2019, 05:28:36
I've added a new "Run Selected Text" feature, perfect for testing small code quickly.
Just select a block of text, right click and select "Run Selected Text".

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-11-23_21-59-11.gif&hash=1254b86eaff4023f77bc18de845eedeef31bd09c)

(UPDATE: The below information is no longer relevant, read the next post for more info)
You can also select what Framework and Imports to use by default, as well as if the code needs to be SuperStrict.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-11-25_06-26-34.png&hash=21681ff90d579d033a98ea8974c8702c39320ae9)

These options are of course per-workspace.
Which means that each project of yours can use a different template.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on November 29, 2019, 16:56:59
I had another go at the "Run Selected Text" feature.
Instead of expecting the user to create a template with a framework and imports; I've instead done so that it checks for the framework and imports from the current source file.
Any code that works in your current project will now also work when using "Run Selected Text", no matter what.
It also uses the same Strict mode as your current source file.

There's now also a "Move Selected Text To Own File" feature.
It will also check the current source Strict mode and apply it to the new file automatically.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2019-11-29_18-00-57.gif&hash=973f0e93420937ff67fd9bfb5f1fb6802196baaa)
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on December 16, 2019, 19:14:39
I've had a lot of error reports from people saying that their application works fine in MaxIDE but not when using the extension in VSCode.
They said their application just crashes, complaining about media not loading or existing, but that it works in MaxIDE.
At first I thought I had done something wrong, but I managed to figure out that the reason for every single one of them was that the 'Output' path in VSCode is different than what it is in MaxIDE.

MaxIDE just places your compiled executable next to your source code.
But I wanted things to be clean when I made this extension, so I made sure that every new build tasks sets the 'Output' path to the 'bin' folder.
That means that all the media the user is loading has to exist inside the same 'bin' folder.
This is how a lot of languages work, and I was just so used to it that I forgot that BlitzMax users might not be used to it.

So this new update fixes that by not setting any 'Output' path by default, instead just leaving it blank.
Which makes it behave just like MaxIDE.
(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2019-12-16_20-16-25.png&hash=c3d16f5334860e21b7b537559dffd29f3ba91122)

You can of course still set the 'Output' path yourself to anything you want.
And there's also an option in the extension that restores the original behavior of creating an 'Output' path for you when creating new tasks.
(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2019-12-16_20-11-14.png&hash=fd119dddeb128a447383f9ad4416952f319c3b22)

Also, extra tip!
Setting 'Source' to just "" will make it behave just like setting it to "${relativeFile}".
Meaning; it will compile the .bmx file you're currently viewing.
Title: Re: BlitzMax VSCode extension worklog
Post by: DruggedBunny on January 02, 2020, 03:25:51
Just registered to say I've only just discovered this, trying to locate a decent bmx-ng IDE -- I got too fed-up with MaxIDE after getting used to MX2's (semi-mostly-working) code-completion.

Still getting to grips with VSCode, but it's basically working great for me so far -- thanks for creating this, really liking it!
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on January 06, 2020, 06:44:58
Quote from: DruggedBunny on January 02, 2020, 03:25:51
Just registered to say I've only just discovered this, trying to locate a decent bmx-ng IDE -- I got too fed-up with MaxIDE after getting used to MX2's (semi-mostly-working) code-completion.

Still getting to grips with VSCode, but it's basically working great for me so far -- thanks for creating this, really liking it!

Thanks a lot. :)
I'm not sure why I didn't get a notification about you posting here, but I'm honored that you registered an account just for this!
Code-completion is still very much hit and miss with this extension (also only works for modules), but hopefully we can get the LSP stuff working eventually.
And maybe proper debugging. *fingers crossed*
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on January 06, 2020, 11:46:36
I've been working on a document formatting feature.
Just right click and select "Format Document".
Or select some text and use "Format Selection"

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-06_10-50-16.gif&hash=f03264735597849b9cedc4a6322263da2d0751c2)

It uses the built-in VSCode way of handling document formatting.
Which means that all of the options and shortcuts VSCode has for formatting will work.
For example the "Format On Save" option.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-06_12-35-53.png&hash=369e1dc4e13f046126d19b1e4cae32f56dd08a69)

There's also a "Format On Type" option.
It works by having a few "trigger characters", such as ( [ ] ) and a few others.
So as you type print("Hello World") it will be corrected into Print( "Hello World" ).

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-06_12-30-48.gif&hash=cb60ad3976e00674f108bd83b834e89adec7e25d)

I understand that not everyone will like the formatting it provides.
For example all the type tag shortcuts (% # ! $) are converted into Int, Float etc.
And there's a new line after Functions, Methods, Types etc.
But I do plan on adding options and some customization at a later time.

Hopefully I'll have this ready by the end of the day and push a new release of the extension.
Title: Re: BlitzMax VSCode extension worklog
Post by: Derron on January 06, 2020, 11:52:10
Just make sure you never auto-format stuff when a quotation mark is open - or when writing in comments :D

Limiting as you do (with brackets) is surely the better alternative. Avoids writing something ... then prepending "'" to make it a comment and then see that MaxIDE uppercased the "print" in "'print out current value".


Keep up working on it.


bye
Ron
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on January 07, 2020, 01:23:58
Version 1.15.0 is pushed to the marketplace.
The extension should update automatically.

Quote from: Derron on January 06, 2020, 11:52:10
Just make sure you never auto-format stuff when a quotation mark is open - or when writing in comments :D

Limiting as you do (with brackets) is surely the better alternative. Avoids writing something ... then prepending "'" to make it a comment and then see that MaxIDE uppercased the "print" in "'print out current value".
Yeah, I had two goals when writing this.

First goal was to have it not mess up your code so it won't compile.
Which is exactly what some other VSCode extensions do, and even Blide did when formatting!

Second goal was to have it not edit rem blocks and comments.
Sadly, to have it detect rem blocks requires a lot of extra reading of lines, which is pretty slow.
But I think people will mostly only use the "Format Document" option.
Which is an active action the user has to take, so it won't slow down things when you're writing new code.
Which makes things like the rem block detection "okay", even if it's slow.

Other than that, and things like optimization and minor bugs, I feel are things I can polish as time goes on, as I always do heh. :)

I have some optimizations I can think of, and I've also got some ideas on how to format the documents even better.
Oh and customization will have to be added later.
But I'm pretty happy with its current state.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on January 07, 2020, 12:03:29
The extension has been pretty verbal for a while now.
Whenever you start VSCode and load a BlitzMax source file; the output view appears and the extension starts spitting out lots of information.
This is okay since it's using its own output tab and won't spam away any important information.
But it's still pretty annoying to see each and every time.

The absolute minimum text you'd see would be this:

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-07_05-33-45.png&hash=47f7a9529f18a84801d03ae29326e68c1999e168)

No module updates, just the BCC and BMK version along with how many modules and commands were loaded.
And finally that either BlitzMax Legacy or NG is ready.

But I figured it was time to finally clean things up and hide away some of that info.

I firstly want to say that none of this information is actually going away!
You can still open up the output view manually (Ctrl + Shift + U / View > Output) and view the same information as before.
But the output view will not appear by default anymore.
The only time the output view will appear on its own is if there's some sort of error or you trigger a command like "Generate Documentation" manually.
This is in line with how every other VSCode extension does it. (official ones specifically)
But you'll get this neat little progress information at the bottom of the window telling you what's going on:

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-07_05-56-25.gif&hash=1a186f79cce14a138fe696b009febfba8c6b57ae)

I've also taken the time to update the signature helper triggers.
So hopefully you'll see it more often.
(which you btw can trigger yourself by pressing Ctrl + Shift + Space)

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2020-01-07_07-54-43.png&hash=3a27fdcb7d9583fdfcded4f3dcce42d77e4daf09)

This has already been pushed to the marketplace.
The extension should update on its own.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on January 08, 2020, 17:23:26
Today I added support for the Symbol Provider in VSCode.
It does a few things, but the best part is that the code outliner uses it.
The outliner gives you a quick overview of your code, and can also track your cursor position.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-08_18-13-15.gif&hash=68cbd201917b0656b8747c6dfd9b6a08934f5614)

Notice how the outliner switches selection based on where the cursor is located.
Your current position is also displayed at the top of the text document.
Clicking the path at the top will reveal a drop-down menu as well.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2020-01-08_19-32-40.png&hash=58989166e8d4524b6b7956ae103c37ee64780634)

I've pushed this update to the marketplace as version 1.17.0.
Title: Re: BlitzMax VSCode extension worklog
Post by: Derron on January 08, 2020, 20:01:51
Really nice additions


bye
Ron
Title: Re: BlitzMax VSCode extension worklog
Post by: DruggedBunny on January 08, 2020, 23:20:37
Oh, that's pretty darn cool. Thanks, Hezkore!
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on January 12, 2020, 15:43:44
You've been able to insert "Templates" for a while now.
Which have just been simple snippets.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-12_16-21-33.gif&hash=ff1ecc630aee1417941368701fa9550ec20bf498)

And if you have any text selected; that text will be part of the new template.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-12_16-23-33.gif&hash=fb129a0b0b924789061d69751474c99355583511)

But these have been fairly simple.
They've also been somewhat "hidden".
And I've never really thought that snippets were a good place for the templates.
So I've made a new feature called "Generate BlitzMax Project" which you can reach by just right clicking in the Explorer.
(note; template snippets will still exist)

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-12_16-11-12.gif&hash=0b5de804da8259d4bcaebfaf7a77cb83be6903b2)

These template projects can be a lot more complex, and include sub folders and files.
They also come with their own tasks.
For example the "Basic Module" project has a task for moving the module into your BlitzMax 'mod' folder.
(only supported on Windows atm.)
And if your project folder has '.mod' at the end of its name; the template will be setup as a BlitzMax Module.

A 'README.md' file is also created.
It will include the project name (in this case "Empty") and will either say "A BlitzMax NG..." or "A BlitzMax Legacy..." depending on what BlitzMax version you're using.
The template name will also be appended at the end, which in this case is "MaxGUI Canvas Application".

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-12_16-29-46.png&hash=33c9cc695437e183d8f6a7d5fe71d3dfd6907f50)

These template projects are still in an early stage.
And if you have any suggestions or possibly even your own template projects you'd like to include; do send me a line!

But starting a new BlitzMax project will hopefully be less of a chore from now on.

I'll push a new version with this feature later today hopefully.
Title: Re: BlitzMax VSCode extension worklog
Post by: Derron on January 12, 2020, 16:25:57
Maybe you could also create a basic file containing the Windows-Application-Information (title, author, ...) / to use a manifest.
Of course a macro/thingy could extract that dynamically from some header thing in the main file

'@bmk manifest appauthor="bla"
or so


bye
Ron
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on January 12, 2020, 19:53:31
Quote from: Derron on January 12, 2020, 16:25:57
Maybe you could also create a basic file containing the Windows-Application-Information (title, author, ...) / to use a manifest.

I'm not really comfortable with the Windows manifest files, at least not enough to provide a template for them.
But I can at least provide a '.settings' file and your rocket icon as a default icon.
There's now also a basic '.gitignore' file that should work well in most cases.
This will ensure that the project is ready for Git right from the start.

This has now been pushed to the marketplace as version 1.18.0.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on January 18, 2020, 10:06:47
I've always wanted to make the BlitzMax VSCode extension the only thing the user has to install.
When I say "only thing the user has to install" I basically mean that the extension should install and setup BlitzMax NG for you if you don't currently have it.
It should also notify you of any future updates, and ask if it should download and apply this new update for you.
(BlitzMax Legacy is never being updated, so it doesn't need any of this)

But I'm not quite there yet.
Especially since there's a whole slew of considerations to be made regarding cross-platform compatibility.

I have however made the extension notify you when there's a new BlitzMax NG release available.
It won't download and patch things for you, but it'll at least point you in the right direction.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-18_01-32-57.png&hash=f80b8aebad46fc289370ed4f4fa15b032fe97d14)

Pressing 'Yes' will launch the default browser and take you to the download page for BlitzMax NG.
'No' or pressing the X will just close the info window.
And pressing 'Never' will disable the update check at startup.

You can of course disable this any time you'd like by going into settings.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2FCode_2020-01-18_01-36-57.png&hash=d6df5375aea1ea74d703a1b9d3fcb5a2fb5aa538)

You can also trigger a manual check by using the command (Ctrl + Shift + P) Check for BlitzMax NG Updates.

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-18_01-40-57.png&hash=15224bffc5c5d5ad8f47cf5e72e20fef0fa156f0)

This update is already out as version 1.20.0.
Title: Re: BlitzMax VSCode extension worklog
Post by: DruggedBunny on January 18, 2020, 13:56:34
That's working well here, thanks Hezkore!
Title: Re: BlitzMax VSCode extension worklog
Post by: iWasAdam on January 19, 2020, 06:40:16
Agreed  - excellent work - this just get better and better
Title: Re: BlitzMax VSCode extension worklog
Post by: DruggedBunny on March 13, 2020, 05:08:26
Hi Hezkore, is it possible to turn off, or customise, auto-formatting? I've never liked the 'standard' style, like so:

TGLFWWindow.Hint( GLFW_CONTEXT_VERSION_MAJOR, 3 )


... preferring instead a more 'real English' punctuation, like so:

TGLFWWindow.Hint (GLFW_CONTEXT_VERSION_MAJOR, 3)


... but even if I manually change what it's done, it immediately auto-formats it back on the fly! I couldn't see a setting in tasks.json, but I have to admit I don't really know WTF I'm doing!

Also, is there a simple shortcut to run in release mode? I thought I had that working at one point, but can now only do the awkward two-step Ctrl-Shift-B and selecting the build task. I realise these may be limits of the editor, though...

Many thanks!
Title: Re: BlitzMax VSCode extension worklog
Post by: DruggedBunny on March 13, 2020, 05:41:34
Also not a fan of the enforced newlines after Function/Method! For a single-line function I would typically use this:

Method OnFrameBufferSize( width: Int, height: Int )
glViewport( 0, 0, width, height )
EndMethod


... rather than this:

Method OnFrameBufferSize( width: Int, height: Int )

glViewport( 0, 0, width, height )
EndMethod


Just looks weirdly-spaced to me! Too picky?  :P

Just wondering if there might be a way to customise these things.
Title: Re: BlitzMax VSCode extension worklog
Post by: Derron on March 13, 2020, 06:16:18
Think "autoformat" is a VS Code setting, not an extension one.


bye
Ron
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on March 13, 2020, 07:22:28
Yes, as Derron says; you'll have to jump into VSCode settings and disable the auto format options.
Which should be disabled by default actually...
I suspect it's either "Format on save" or "Format while typing" you have enabled.

Also just to clear up some confusion...
tasks.json is only used when you run a "task" such as compiling your application.
The two shortcut buttons in the corner (and also F5) just uses your default set task in tasks.json.

And regarding building and releasing; the "Quick build and run" button in the corner (or F5) always does a quick console debug build, but listens to your settings in tasks.json otherwise.
Use the "Build" button in the corner (or Ctrl Shift B) to fully listen to the tasks.json settings, such as release and GUI app.

This will eventually change with the newer build system and proper debugging though.

And just a tip!
If you don't like Ctrl Shift B for compiling; just change the button for it in key settings.
Also, F6 will run the last task.
So if you just hit Ctrl Shift B once you can use F6 after that.
Title: Re: BlitzMax VSCode extension worklog
Post by: DruggedBunny on March 13, 2020, 08:11:03
Ah, thanks, guys, will dig into all that tonight then! Much appreciated!
Title: Re: BlitzMax VSCode extension worklog
Post by: DruggedBunny on March 15, 2020, 20:25:32
I got the auto-formatting sorted (thanks!), but any idea if there's a way to get the highlighting while having spaces before brackets? I couldn't find a setting in VSCode, so not sure where this is decided.

See screenshot -- note the second line gets highlighted only when the function name has no space after it.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on March 16, 2020, 05:19:47
The syntax highlighting works by some fairly simple regex patterns and does not actually parse any of your code.
And I've tried to follow the same rules and coding style that the default modules use when designing these patterns.
But I/you could change the pattern and make the function name detection allow for whitespaces.
However, there might be some unforeseen issues in doing so since ( ) might be used in other places as well, which in turn would make any text before that act as a function name.

If you do change the regex to allow for whitespaces; please tell me how that works out.
Otherwise I'll have a look at it myself sometime in the future.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on March 27, 2020, 15:59:39
@DruggedBunny
I've updated the language regex syntax to better suit your coding style.

And in general I've polished up the task system quite a bit.
There will certainly be lots of issues with this new system as it's almost completely re-written and bound to have some bugs.
But hopefully it will be easier to understand and we can work on fixing the bugs as we go.

The two buttons in the corner should now take care of all your building needs.
(Especially good for those of you having problem remembering the keyboard shortcuts)
The left one builds and runs the app, the second one just builds it.
(https://hezkore.com/captures/2020-03-27_16-50-21.gif)
And it will now always follow your building (`tasks.json`) rules, instead of trying to be smart and setting some stuff automatically.

You can now also build without actually having a task configured, as I'm supplying a default build task if no task is found.
And if the file you're trying to build isn't part of the workspace; it will also use that default task.
Which should work a lot nicer than having to change "source" in `tasks.json` if you just quickly want to build some external file.

The update is already available, VSCode should as always automatically update it for you.
Title: Re: BlitzMax VSCode extension worklog
Post by: Derron on March 27, 2020, 16:17:58
Quote from: Hezkore on March 27, 2020, 15:59:39
(Especially good for those of you having problem remembering the keyboard shortcuts)

Dunno whom this might be targeting :)


bye
Ron
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on March 27, 2020, 18:37:38
Quote from: Derron on March 27, 2020, 16:17:58
Dunno whom this might be targeting :)

I won't name any names but it's you. :))
You aren't the only one though.
Title: Re: BlitzMax VSCode extension worklog
Post by: DruggedBunny on March 27, 2020, 23:03:30
Wow, thanks for that -- it's looking good here, much nicer with the highlighting back in!

QuoteYou aren't the only one though.

Oi!

:D

Thanks again!
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on March 28, 2020, 12:29:41
I've started work on a unique BlitzMax view container.
(https://hezkore.com/captures/Code_2020-03-28_13-18-52.png)

I'll slowly add new things to the view container over time, but I've at least started work on a "Build Options" tree view.
(https://hezkore.com/captures/2020-03-28_13-15-35.gif)

It should make things easier for those of you who don't like editing the raw `tasks.json` file.
It also makes it pretty clear what options you're editing, as it will display "Workspace: NAME" or "File: NAME" for files that aren't part of the actual workspace.
(https://hezkore.com/captures/2020-03-28_13-23-34.gif)

I've also found a bunch of minor problems with the previous version I pushed.
So I'll hopefully push a new version today, which will also contain this new view container.
Title: Re: BlitzMax VSCode extension worklog
Post by: DruggedBunny on March 28, 2020, 20:26:11
That looks pretty cool, especially the per-program switching.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on April 02, 2020, 16:07:44
I've added a "samples tree" to the view container.
It'll make viewing the BlitzMax samples a lot easier.
It also lists samples for any module by looking in folders named "samples", "examples", "tests" and "docs".

(https://hezkore.com/captures/Code_2020-04-02_17-02-27.png)

And for those of you who don't want anything extra visible in the view container; you can just right click and hide it.

(https://hezkore.com/captures/Code_2020-04-02_17-10-51.png)

This is already available in version 1.25.0.
VSCode should automatically update the extension for you.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on April 12, 2020, 18:59:11
The BlitzMax view container got some polished this weekend.
It now has a new welcome screen (a new VSCode feature!).
And the samples tree will now load even if there's no BlitzMax project/file open.

(https://hezkore.com/captures/Code_2020-04-12_19-40-22.png)

The 'Appstub' option in the Build Options view now actually scans all of your modules for available appstub modules.
It will then present them in a quick pick list.
Which is a lot easier than having to remember and manually write those module names in!

(https://hezkore.com/captures/Code_2020-04-12_19-41-26.png)

Oh and we've somehow managed to surpass 300 downloads. 🤔

Anyways, the update is already available as version 1.26.0.
Title: Re: BlitzMax VSCode extension worklog
Post by: Derron on April 12, 2020, 20:13:48
300 total or for latest release?

Good job.

Bye
Ron
Title: Re: BlitzMax VSCode extension worklog
Post by: DruggedBunny on April 12, 2020, 20:53:17
I just updated (VSCode also updated today) and I don't get the blue Open Folder/File buttons, and my Samples/Modules dropdowns are both empty. It was showing an error about checking a log, but not where the log was -- but it's no longer giving me that message either.

I noticed the missing Samples/Modules thing after the last update but forgot to post! But it hasn't just started with this update, that's never worked for me.

If it helps, my samples are at: D:\DevTools\Blitz\BlitzMaxNG\samples and you can see in the screenshot that it finds Blitz no problem (and runs fine!) -- it is running the right copy too.

I also have BlitzMax in my %PATH% at: D:\DevTools\Blitz\BlitzMaxNG\bin
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on April 12, 2020, 21:54:18
Quote from: Derron on April 12, 2020, 20:13:48
300 total or for latest release?
Total downloads.

Quote from: DruggedBunny on April 12, 2020, 20:53:17
I just updated (VSCode also updated today) and I don't get the blue Open Folder/File buttons
You'll only get the welcome view if you have no workspace, files or folders open.
I have very little control (read 'no control') over that welcome view though, so very little can go wrong.
I just write the plain text in the extension info and VSCode presents it when it's needed (when Build Options is empty).
So I'm guessing you're just not in a state right now where VSCode would present that welcome view.
You'll see it eventually. :)

Quote from: DruggedBunny on April 12, 2020, 20:53:17
my Samples/Modules dropdowns are both empty
Thanks for letting me know!
You can post all your issues over at GitHub: https://github.com/Hezkore/vscode-blitzmax-support/issues (https://github.com/Hezkore/vscode-blitzmax-support/issues)
(But here is also fine)
I've pushed a new update (1.26.1) which hopefully fixes your issue.
Title: Re: BlitzMax VSCode extension worklog
Post by: DruggedBunny on April 12, 2020, 23:10:41
Hmm, still no joy! On looking up where the log file is, I found the VSC developer tools thing, which does show this:


EntryNotFound (FileSystemError):
at massageError (c:\Users\James\.vscode\extensions\hezkore.blitzmax-1.26.1\out\samplesTree.js:35:43)
at handleResult (c:\Users\James\.vscode\extensions\hezkore.blitzmax-1.26.1\out\samplesTree.js:27:20)
at c:\Users\James\.vscode\extensions\hezkore.blitzmax-1.26.1\out\samplesTree.js:66:51
at FSReqCallback.oncomplete (fs.js:153:23)


I see the sample scanning code in c:\Users\James\.vscode\extensions\hezkore.blitzmax-1.26.1\out\samplesTree.js, but can't really follow it!

The error seems to be pointing to handleResult(resolve, reject, error, normalizeNFC(children))) in function readdir(path). At least, that seems to be what sits at samplesTree.js:66:51.

No idea if that's any use!
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on April 13, 2020, 02:14:19
Alright, so the VSCode 'FileSystemProvider' is unnecessarily over-engineered.
(especially for our samples tree)
Most of the issues with the samples tree comes from that code.
I've converted the samples tree to use a custom tree data provider, which should be much easier to understand and debug.
The whole thing got about 170 lines thinner while removing methods we don't even use, and the tree even loads faster.
Hopefully your issue has also been fixed DruggedBunny.
If not; please post the issue on GitHub (https://github.com/Hezkore/vscode-blitzmax-support/issues) so that we can track down the problem in a contained conversation. :)

Version 1.26.2 has been pushed to the marketplace.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on April 13, 2020, 21:04:48
I've done some more work on the welcome screen.
There's now a new message/button if the user hasn't yet set his BlitzMax path.

(https://hezkore.com/captures/Code_2020-04-13_21-37-59.png)

The normal 'Open Folder/File' screen is shown after a path has been set.

(https://hezkore.com/captures/Code_2020-04-12_19-40-22.png)

But once an empty folder has been opened you'll have the option to generate a new project.

(https://hezkore.com/captures/Code_2020-04-13_21-39-00.png)

Any time your workspace/folder is empty you'll have the 'Generate Project' button.
But you can of course still generate a project the old way, which is by right clicking in your explorer:

(https://www.syntaxbomb.com/proxy.php?request=http%3A%2F%2Fhezkore.com%2Fcaptures%2F2020-01-12_16-11-12.gif&hash=0b5de804da8259d4bcaebfaf7a77cb83be6903b2)

Or by using the command palette (Ctrl Shift P) and typing 'Generate Project'.
You can read more about generating projects in one of my older posts:
https://www.syntaxbomb.com/index.php/topic,5824.msg33514.html#msg33514 (https://www.syntaxbomb.com/index.php/topic,5824.msg33514.html#msg33514)

But overall I feel like this streamlines the whole thing nicely.
Basically our unique BlitzMax view container will now guide you through the entire process.

Version 1.27.1 has been pushed to the marketplace.
Title: Re: BlitzMax VSCode extension worklog
Post by: Brucey on April 14, 2020, 09:36:26
Is the BlitzMax path workspace specific?  i.e. I work with *at least* two versions of BlitzMax (so I generally have a couple of MaxIDEs open at the same time each pointing to their own local BlitzMax)

So obviously it would be nice if I could accomplish the same in VSCode... :-)
Title: Re: BlitzMax VSCode extension worklog
Post by: Derron on April 14, 2020, 09:48:32
To avoid having to setup these paths each time it should have a "default BlitzMax Path" which it uses for new workspaced but could be adjusted (dropdown, settings dialogue...)


bye
Ron
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on April 14, 2020, 14:08:14
Quote from: Brucey on April 14, 2020, 09:36:26
Is the BlitzMax path workspace specific?  i.e. I work with *at least* two versions of BlitzMax (so I generally have a couple of MaxIDEs open at the same time each pointing to their own local BlitzMax)

You have a bunch of options to get this working Brucey.

If you want to switch BlitzMax installation on the fly; I would recommend just using the 'setPath' command and bind it to a key.
Just jump into 'Preferences' > 'Keyboard Shortcuts' and then click the little icon in the corner to edit the raw JSON file.
You can then add something like:
{
"key": "ctrl+numpad1",
"command": "blitzmax.setPath",
"args": "D:\\Applications\\BlitzMaxNG"
},
{
"key": "ctrl+numpad2",
"command": "blitzmax.setPath",
"args": "D:\\Applications\\BlitzMaxLegacy"
}

Pressing 'Ctrl Num1' will now switch the extension over the NG, while pressing 'Ctrl Num2' would switch to Legacy.
And if you instead use the 'selectPath' command you'll get a popup asking for the path to your BlitzMax folder.
(which could be useful sometimes)

Since it's just a command; you can use it however you want, but I feel like a keyboard shortcut is the simplest.
You could also create a new separate VSCode extension that organizes all of your BlitzMax installations.
It could then use the 'setPath' command to switch automatically for you.
Which is kind of what Derron is talking about.
(Go make that extension now Derron :P)

Your second option would be to use a different BlitzMax installation based on folder.
All of your VSCode/extension settings are stored globally, but you can overwrite them per workspace/folder.
So if you just open a folder containing your source files, then jump into 'Settings', you'll see the 'Workspace' tab in your settings window.

(https://hezkore.com/captures/Code_2020-04-14_14-32-15.png)

Any changes there will overwrite your existing settings and will only apply for that workspace.

There's also a third way to handle this, which is by having a "multi-root workspace".
I'll admit that it's highly experimental and not a lot of extensions supports it, but I at least try to support it.
Basically you open a folder, like always, but then go into 'File' and select 'Add Folder to Workspace...'.
This will create a proper and real workspace. (everything else is just a folder in reality)
And at that point you'll get another tab in your settings window where you can select things per workspace folder.
So you could at that point work on a NG and Legacy application at the same time, inside the same window, without having to switch around.

(https://hezkore.com/captures/2020-04-14_14-17-09.gif)

Things like the samples tree will get confused and not know which version to use.
But you should still be able to compile just fine using any number of BlitzMax versions.
Title: Re: BlitzMax VSCode extension worklog
Post by: Derron on April 14, 2020, 15:01:24
Weren't these workspaces a bit troublesome in the past (the ones in which I was not able to compile something and you wrote about them not being supported for now)?

It looks at least like a good way to allow multiple "blitzmax setups". Maybe the extension could store the last used X paths inserted there? So that you either enter a new one or use a dropdown to select a previous one. Maybe easier to do than to properly manage/configure different setups via dialogues ?


bye
Ron
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on April 14, 2020, 15:56:38
Quote from: Derron on April 14, 2020, 15:01:24
Weren't these workspaces a bit troublesome in the past (the ones in which I was not able to compile something and you wrote about them not being supported for now)?
They've always been supported. :)
What I wrote to you about them was "...it could potentially go very wrong and be very confusing if you're new to VSCode".
And that's still partly true because each root folder inside your workspace will have its own 'tasks.json' and settings.
Managing one 'tasks.json' has been very confusing for some people, so having multiple ones would make things a lot more complex.
But I feel like the Build Options view has somewhat mitigated this issue and made things a lot clearer for everyone.
I'd still suggest you don't use them if you don't have to, mainly to keep things simple.
A simple folder will be good enough in most cases.

Quote from: Derron on April 14, 2020, 15:01:24
Maybe the extension could store the last used X paths inserted there? So that you either enter a new one or use a dropdown to select a previous one. Maybe easier to do than to properly manage/configure different setups via dialogues ?
I could certainly let you enter multiple paths for your BlitzMax installations, then have a button somewhere (or have a keyboard shortcut) display a quick pick list of all available BlitzMax installations.
But I feel like this whole thing is somewhat of a niche feature that not a lot of people would use...
It might even potentially confuse new users, especially if they've managed to switch without knowing how to switch back or something.
And I'm not sure I want to spend any more time on features that anyone hardly uses. :(

Which is why I feel like a separate extension, specifically made for this, might be a better idea.

The extension could display a nice HTML view for adding and selecting BlitzMax installations.
And allow for keyboard shortcuts and quick buttons somewhere on the UI.
It would just need to use our 'setPath' command and it'll instantly work.
But it's a lot of work for something that only one or two users might actually use. ¯\_(ツ)_/¯
Title: Re: BlitzMax VSCode extension worklog
Post by: Brucey on April 14, 2020, 16:15:42
QuoteBut it's a lot of work for something that only one or two users might actually use.
Pfff. That's pretty much all I do with BlitzMax - make stuff that possibly only one or two users might actually use. So I'm not sure what you are trying to say, exactly?  8)
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on April 16, 2020, 13:35:10
I caved to peer pressure and added some basic "version switching".

All information i previously posted here (https://www.syntaxbomb.com/index.php/topic,5824.msg347041680.html#msg347041680) is still true.
You can still switch by a keyboard shortcut or based on workspace.
But this new method lists all of your BlitzMax installations and lets you quickly switch between them at any time.
(easier than trying to remember keyboard shortcuts!)
The switch is a permanent change to your global setting, so it'll keep using that version until you switch to another one.
Any workspace specified BlitzMax path will override your global setting.

The new 'Versions' view is of course found in our BlitzMax view container, and comes with its own welcome message.

(https://hezkore.com/captures/Code_2020-04-16_00-56-51.png)

Adding a new BlitzMax version is easy.
Just press the "Add BlitzMax Version" button, or click the little + in the corner.
Select your folder and enter a name for this BlitzMax version.
And there's no limited to the number of versions you can add, so go crazy.

(https://hezkore.com/captures/Code_2020-04-16_00-56-17.png)

You can also right click a version for more options.

(https://hezkore.com/captures/Code_2020-04-16_01-19-47.png)

Hovering over a BlitzMax version will reveal its location.

(https://hezkore.com/captures/Photoshop_2020-04-16_00-55-40.png)

Then just double click or click the little rocket icon to switch to that version.

(https://hezkore.com/captures/Code_2020-04-16_00-58-28.png)

The extension will have to load for a bit to switch everything over.
I'll probably cache the modules based on version later on, which should make it a bit quicker.
But for now it works pretty well!

For those of you that have no interest in version switch; you can just hide the 'Versions' view.

(https://hezkore.com/captures/Code_2020-04-16_01-26-44.png)

This has been pushed to the marketplace as version 1.28.0.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on May 26, 2020, 10:22:12
A long time ago (second post in this thread actually) I talked about the web view in VSCode being perfect for the BlitzMax documentation.
I couldn't quite figure out how to get it working back then though.
But I recently spent some time on trying to get that implemented again and I've managed to get some decent results.
Hovering over something defined in a module and clicking "More info" (or pressing F1) will now bring up the new web view.

(https://hezkore.com/captures/Code_2020-05-26_11-07-54.png)

It'll give you all the information MaxIDE gives you, along with some extra info like where it's defined.
(click 'Source' to directly jump to that line)
It'll also match your current VSCode theme!

I've also fixed a bunch of issues regarding the documentation and how it's all linked together.
So it should make a tiny bit more sense from now on.
Oh and the "Samples" view has been replaced by a new "Help" view.
It quickly gives you an overview of all the modules and examples.

(https://hezkore.com/captures/Code_2020-05-26_11-19-45.png)

A few extra tips!
If you hover over a word, like "Print" and click the module name; you'll instantly jump to where Print is defined.
(https://hezkore.com/captures/Code_2020-05-26_11-14-11.png)

And if you click on the module name while reading the documentation; you'll instantly open up that module.
(https://hezkore.com/captures/Code_2020-05-26_11-16-04.png)

The exampel can also be directly opened by clicking on the example title.
(https://hezkore.com/captures/Code_2020-05-26_12-17-19.png)

This has been pushed to the marketplace as version 1.30.0.
VSCode should automatically update the extension for you.
Title: Re: BlitzMax VSCode extension worklog
Post by: DruggedBunny on May 26, 2020, 10:28:26
Just tried it -- that is f***ing awesome! Well done and many thanks!
Title: Re: BlitzMax VSCode extension worklog
Post by: iWasAdam on May 26, 2020, 14:39:45
is there a VERY simple explanation of how to actually compile and run something. Let's say the breakout demo?

I just cant for the life of me work out how to do it :(
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on May 26, 2020, 14:59:52
File > Open File... > breakout.bmx > Press F5.
(or one of the build buttons in the upper right corner)
Title: Re: BlitzMax VSCode extension worklog
Post by: iWasAdam on May 27, 2020, 12:16:45
Nice n simple :)
Last question. When you run (F5,etc) the app launches below Code. Is there a way to force the running app to be the top most window?
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on May 27, 2020, 17:32:13
Hmm not had that happen on any OS yet.
It's been tested on MacOS High Sierra, Linux(elementary.io (http://elementary.io)) and Windows 10.
I can't promise that VSCode acts nicely on other Linux distros though.

The terminal in VSCode is your actual terminal, which is also what launches your app (and compiles your app!).
So what you could do is change which one it uses by default:
(https://hezkore.com/captures/Code_2020-05-27_18-30-21.png)

Another one might work better for you.
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on June 04, 2020, 19:15:59
It's now been exactly one year since the first version was released.
(I've worked on it behind the scenes for even longer)

There's been over 380 downloads, which means an average of just over 1 download per day.
It may not be much compared to most other extensions heh.
But I'm still very happy that over 300 people have downloaded the extension.

So a big thank you to everyone for trying out the extension!
And here's to another year of updates! :D
Title: Re: BlitzMax VSCode extension worklog
Post by: Hezkore on August 15, 2021, 15:27:27
Another year, over 900 downloads, and another update I suppose.
I haven't really posted much here in the last year, but that doesn't mean progress hasn't been made.
If anything, it's the other way around.

The extension has been rewritten from scratch since version 2.0.0.
The new extension is ready for the work-in-progress LSP: https://github.com/blitzmax-itspeedway-net/Blitzmax-Language-Server (https://github.com/blitzmax-itspeedway-net/Blitzmax-Language-Server)
And also features a fully functional debugger:

(https://raw.githubusercontent.com/Hezkore/vscode-blitzmax-support/master/media/debug_interface.gif)

The official BlitzMax documentation is now supported and coloured to match your VS Code theme:

(https://raw.githubusercontent.com/Hezkore/vscode-blitzmax-support/master/media/quick_help.gif)

And most of the old features and menus have been overhauled, like the build menu:

(https://raw.githubusercontent.com/Hezkore/vscode-blitzmax-support/master/media/build_options.png)

And hover information:

(https://raw.githubusercontent.com/Hezkore/vscode-blitzmax-support/master/media/help_hover.png)

There's also a brand new walkthrough guide right inside of VS Code!
You can view it by going to Help > Welcome > Configuring BlitzMax.
I suggest everyone reads through it as it gives a pretty decent overview of how things work.

There's just too much new stuff for me to post here!

Regarding forum updates
I'm not a "forum guy", and I don't think I'll be posting here much more.
Of course, work still continues on the extension, and you can view the marketplace changelog (https://marketplace.visualstudio.com/items/Hezkore.blitzmax/changelog) for updates.
The official GitHub repo (https://github.com/Hezkore/vscode-blitzmax-support) can be used for discussions (https://github.com/Hezkore/vscode-blitzmax-support/discussions), issues (https://github.com/Hezkore/vscode-blitzmax-support/issues) and to get a glimpse of any WIP features.
My GitHub (https://github.com/Hezkore) is also a great way to see what else I'm working on, for example the BlitzMax GitHub action (https://github.com/marketplace/actions/setup-blitzmax-ng), which lets you compile your BlitzMax code "in the cloud" (for free!) for any platform.
My BlitzMax Vim plugin (https://github.com/Hezkore/vim-blitzmax) and upcoming Atom (https://atom.io/) plugin.
I'm also active on Discord (https://discord.gg/yF6PMaY5aE) in the dedicated #vscode-extension channel, posting about updates, new features, VS Code and just about anything really heh.

The downside to all of this is of course that this worklog will get pushed further and further back into the forum archive.
That means that people will have a harder time finding the extension.
The original post about the extension - found here: https://www.syntaxbomb.com/index.php/topic,5771.0.html (https://www.syntaxbomb.com/index.php/topic,5771.0.html) - is already so far back that it's almost impossible to find.
But I guess that's just something I'll have to live with. 🤷‍♂️
And I guess I'll have to trust the existing VS Code users to spread the word if anyone's looking for an alternative BlitzMax IDE.

And that's about it I guess...
Toodles 👋