BlitzMax VSCode extension worklog

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

Previous topic - Next topic

Hezkore

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



(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.



These options are of course per-workspace.
Which means that each project of yours can use a different template.
Simplicity is the ultimate sophistication. 🚀
GitHub
BlitzMax for VSCode
BlitzMax for Vim

Hezkore

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

Simplicity is the ultimate sophistication. 🚀
GitHub
BlitzMax for VSCode
BlitzMax for Vim

Hezkore

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


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.


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

DruggedBunny

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!

Hezkore

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

Hezkore

#35
I've been working on a document formatting feature.
Just right click and select "Format Document".
Or select some text and use "Format Selection"



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.



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



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

Derron

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

Hezkore

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

Hezkore

#38
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:



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:



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)



This has already been pushed to the marketplace.
The extension should update on its own.
Simplicity is the ultimate sophistication. 🚀
GitHub
BlitzMax for VSCode
BlitzMax for Vim

Hezkore

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



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.



I've pushed this update to the marketplace as version 1.17.0.
Simplicity is the ultimate sophistication. 🚀
GitHub
BlitzMax for VSCode
BlitzMax for Vim

Derron


DruggedBunny

Oh, that's pretty darn cool. Thanks, Hezkore!

Hezkore

#42
You've been able to insert "Templates" for a while now.
Which have just been simple snippets.



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



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)



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



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

Derron

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

Hezkore

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