BlitzMax VSCode extension worklog

Started by Hezkore, June 29, 2019, 20:11:31

Previous topic - Next topic

DruggedBunny

That looks pretty cool, especially the per-program switching.

Hezkore

#61
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".



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



This is already available in version 1.25.0.
VSCode should automatically update the extension for you.
Simplicity is the ultimate sophistication. 🚀
GitHub
BlitzMax for VSCode
BlitzMax for Vim

Hezkore

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.



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!



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

Anyways, the update is already available as version 1.26.0.
Simplicity is the ultimate sophistication. 🚀
GitHub
BlitzMax for VSCode
BlitzMax for Vim

Derron

300 total or for latest release?

Good job.

Bye
Ron

DruggedBunny

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

Hezkore

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
(But here is also fine)
I've pushed a new update (1.26.1) which hopefully fixes your issue.
Simplicity is the ultimate sophistication. 🚀
GitHub
BlitzMax for VSCode
BlitzMax for Vim

DruggedBunny

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!

Hezkore

#67
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 so that we can track down the problem in a contained conversation. :)

Version 1.26.2 has been pushed to the marketplace.
Simplicity is the ultimate sophistication. 🚀
GitHub
BlitzMax for VSCode
BlitzMax for Vim

Hezkore

#68
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.



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



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



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:



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

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.
Simplicity is the ultimate sophistication. 🚀
GitHub
BlitzMax for VSCode
BlitzMax for Vim

Brucey

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... :-)

Derron

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

Hezkore

#71
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.



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.



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.
Simplicity is the ultimate sophistication. 🚀
GitHub
BlitzMax for VSCode
BlitzMax for Vim

Derron

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

Hezkore

#73
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. ¯\_(ツ)_/¯
Simplicity is the ultimate sophistication. 🚀
GitHub
BlitzMax for VSCode
BlitzMax for Vim

Brucey

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)