VSCode extension for MMBasic

I threw together a Visual Studio Code extension to support MMBasic. It has

  • Syntax Highlighting
  • Intellisense support
  • Autocomplete
  • Serial port communication to transfer your code to your device
  • Documentation on hover

If you’re interested to check it out, it’s at GitHub - DNSGeek/vscode-mmbasic: A VSCode Extension to provide support for MMBasic

Please let me know any feedback you might have. Thanks!

5 Likes

Looks good and can be a “game changer” for me, at least comfort-wise.
That said you’re missing the PLAY command, maybe more, IDK.

The file upload does not work. It can see the port and connect but when I try to upload a file all I see is things happening on the PicoCalc screen (to fast to actually understand what) and in the end the file is not there.

I tried to upload to Drive a and b.

I’m not very familiar with VSCode extensions. Would this extension work on the macOS version of VSCode?…..Brian

Try changing your baud rate. It sounds like it connects to the USB serial port.

Yes, I developed it on a Mac.

2 Likes

@regevt Please feel free to create a Pull Request with any keywords I’m missing and Ill merge it.

Hi!
I think it’s an excellent idea—especially because of the possibility of connecting the real device and sending/running programs directly on the hardware.

Unfortunately, I’m not able to create the VSIX file to install it in VS Code. Is there any chance you could share a ready-to-use VSIX file?

Thanks in advance,
Ariel

It’s there. Click on the Releases block in the right column.

1 Like

ups! :slight_smile: Sorry, and thanks!

Thank you so much for this!!! I managed to get a test running. It is extremely satisfying to see the code being uploaded in real time and things happening on the picocalc. Thank you again. Ace work. Bravo!! :clap:

@DNSGeek Do I need to prepare the Pico to communicate with vscode?

I tried following your instructions. VSCode connects to the Pico, but when I send code to the device, on the Pico I see the basic program being typed onto the screen rather than sending a file.

I don’t have experience using VSCode, so I’m sure i’m doing something wrong.

Thank you for the help….Brian

Looks nice. But somehow more complicated than MMEdit5. I don’t really want to learn keyboard shortcuts to transfer the program to the Picocalc and start it. The transfer doesn’t work properly. Only at 115,400 baud do reasonably meaningful characters arrive, and then the Picocalc throws up various error messages because characters are swallowed during the transfer.
This should be transferred:

OPTION EXPLICIT
OPTION DEFAULT NONE

'### Clear screen
cls

'### Define variables
dim intKona as integer
dim intMG4 as integer
dim intPhotovoltaik as integer
dim intWaermepumpe as integer
dim intWallbox as integer
dim strFehler as string
dim strTaste as string

'### Display start screen
gui frame #1, “Input of measured values”, 0, 5, 320, 315, rgb(WHITE)
color rgb(white), rgb(midgreen)
GUI DISPLAYBOX #3, 20, 20, 280, 18,  rgb(WHITE), rgb(fuchsia)
ctrlval(3) = “The measured values”
GUI DISPLAYBOX #4, 20, 45, 280, 18,  rgb(WHITE), rgb (grey)

Instead, this is what arrives:

— Sending program —
NEW

OPTION EXPLICIT

OPTION DEFAULT NONE

cls

dGUI DISPLAYBOX #4, 20, 45, 280, 18, rgb(WHITE), rgb(grey)
Error : Unknown command

Probably needs a delay between lines. Using teratem I always use 20mSec for safety

1 Like

@volker I did this because MMEdit does not work on Mac, so I needed something.

I will check on the error you showed. Thanks!

1 Like

I updated the extension to add remote debugging and file browsing (upload, download, view files, delete files, etc) on both A and B drives and updated the syntax and tooltips for 6.02.00

Thank you for creating this useful VSCode extension.

I tested it with PicoMite V6 / PicoCalc and found that the existing upload workflow is almost correct.

The current uploadFile() flow is:

NEW
sendProgram()
SAVE "filename"

This makes sense for MMBasic.

However, on PicoMite V6, a program sent over the serial console needs to be received using AUTOSAVE mode. Without AUTOSAVE, the incoming program text may be treated as console input instead of being stored correctly as a program.

I modified src/serialPortManager.ts, specifically async sendProgram(), to use:

NEW
AUTOSAVE
program text
Ctrl-Z

After adding AUTOSAVE and ending it with Ctrl-Z, uploadFile() worked correctly on my PicoCalc / PicoMite V6 setup.

The existing fileBrowserProvider.ts uploadFile() workflow did not need to be changed.

The essential change is like this:

// PicoMite V6 requires AUTOSAVE for serial program upload.
this.port!.write('AUTOSAVE' + lineEnding);
await this.delay(100);

// existing line sending loop...

// End AUTOSAVE mode with Ctrl-Z.
this.port!.write('\x1A');
await this.delay(500);

I hope this helps.
If possible, it would be great if this change could be included in the extension.

Thanks for the detailed report. The extension has been updated.

Thank you very much for taking this into the main branch.

Just to clarify, my proposed fix was intended as a minimal change for PicoMite V6 / PicoCalc.

I have only tested it on PicoMite V6, so I do not know whether this behavior is compatible with other MMBasic systems or older versions.

It may be worth keeping this in mind if compatibility with other MMBasic targets is important.