Some simple changes to package.json make Mojo work better in VSCode

I don’t know, maybe I’m crazy, and maybe it’s just me, but I’ve had a long standing frustration with writing code in Mojo.

Something stupidly simple was just not possible.

I have this really trivial project setup, but since the beginning I have not been able to simply execute the tests from within VSCode. Yes we have been able to execute them form the command line, with the -I flag, but the question why can’t we just run them from within the IDE.

├── Mojo.code-workspace
├── mojoproject.toml
├── pixi.lock
├── pixi.toml
├── src
│   └── import_this_pkg
│       └── __init__.mojo
└── test
    └── import_test
        └── test_import_test.mojo

Searching through the Modular codebase, seemed to mirror a similar project structure, so I was a bit disheartened to find that, the structure is enabled by using Bazel.
Other repos seemed to use shell scripts in order to get the job done, but all I wanted to be able to do was execute my test code from within the IDE. I didn’t want to have to learn another utility, nor manage a set of scripts.

Finally after a bit of backwards-and-forwards with some augmented intelligence, I seem to have discovered the small changed needed for me to satisfy this nagging itch.

I’m placing these two Issues here as to what I’ve found.

All the changes seem to amount to is some small tweaks to the package.json of the VSCode extension.

Hopefully these are not heinous hacks, and they aren’t even complete either, but I thought if there is anyone out there as crazy as I am, then maybe this might help.

Hey Richard, thank you for posting and reporting the issues, and extra thanks for writing detailed and helpful descriptions!

We’ll fix this shortly.

The Mojo vscode extension is open source: GitHub - modular/vscode-mojo: Mojo support for VS Code · GitHub
So in the future feel free to just put up a PR! But it is equally helpful to report problems and create issues.

--Denis

I think both should be fixed now and new VSCode extension uploaded to the VSCode marketplace.