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.
opened 10:55PM - 29 Apr 26 UTC
bug
mojo
Needs Triage
### Bug description
### Actual behavior
To get mojo to include folders outside … of a modules direct relations, you need to use the -I flag, e.g.:
```bash
$ mojo -I ./src ./tests/test_this.mojo
```
To get similar behaviour from the debugger within VSCode you **cannot** merely use the `args` parameter, as these are for your program and not compiler args.
You _can_ however use `buildArgs`, whether this is intentional or not. The problem is that when adding this to the `launch.json` file, it is highlighted and labelled as not allowed.
### Expected behavior
Ignoring the warning from VSCode allows you to include directories in the debugger.
The fix seems to be to include the definition in the `package.json`:
```json
{
"type": "mojo-lldb",
"label": "Mojo",
"configurationAttributes": {
"launch": {
"unevaluatedProperties": false,
"properties": {
//...
"buildArgs": {
"type": [
"array",
"string"
],
"description": "Build arguments when using `mojoFile` instead of `program`.",
"default": []
},
//...
}
}
}
}
```
### Steps to reproduce
A simple folder structure like the following will allow you to replicate the issue.
```bash
├── Mojo.code-workspace
├── mojoproject.toml
├── pixi.lock
├── pixi.toml
├── src
│ └── import_this_pkg
│ └── __init__.mojo
└── test
└── import_test
└── test_import_test.mojo
```
src/import_this_pkg/__init__.mojo
```mojo
fn important() -> Int
return 0
```
test/import_test/test_import_test.mojo
```mojo
import import_this_pkg
def main() raises:
print("Import Successful")
```
### System information
System
------------
Pixi version: 0.67.0
TLS backend: rustls
Platform: linux-64
Virtual packages: __unix=0=0
: __linux=6.17.0=0
: __glibc=2.39=0
: __archspec=1=skylake
Cache dir: /home/insane-alchemist/.cache/rattler/cache
Auth storage: /home/insane-alchemist/.rattler/credentials.json
Config locations: No config files found
Global
------------
Bin dir: /home/insane-alchemist/.pixi/bin
Environment dir: /home/insane-alchemist/.pixi/envs
Manifest dir: /home/insane-alchemist/.pixi/manifests/pixi-global.toml
Workspace
------------
Name: Exploration
Version: 0.1.0
Manifest file: /home/insane-alchemist/mojo/Exploration/pixi.toml
Last updated: 24-04-2026 20:28:53
Environments
------------
Environment: default
Features: default
Channels: https://conda.modular.com/max, conda-forge
Dependency count: 2
Dependencies: modular, pyside6
Target platforms: linux-64
Prefix location: /home/insane-alchemist/mojo/Exploration/.pixi/envs/default
opened 07:51PM - 01 May 26 UTC
bug
mojo
Needs Triage
### Bug description
The setting to include directories so that the LSP can find… modules outside of the direct lineage of the current module is set at the machine level. This means that all projects will use the same set of paths.
```json
"mojo.lsp.includeDirs": {
"scope": "machine",
"type": "array",
"description": "List of directories to append to the search path list used to resolve imported modules in a document.",
"items": {
"type": "string"
}
},
```
### Expected behavior
Ideally this should be set at the workspace level.
```json
"mojo.lsp.includeDirs": {
"scope": "window",
"type": "array",
"description": "List of directories to append to the search path list used to resolve imported modules in a document.",
"items": {
"type": "string"
}
},
```
This single change seems to resolve errors with the LSP unable to find modules.
Along with #6472 I can now keep all my test code in a separate `test/` folder and keep my source in a `src/` folder, and run the tests without needing additional tools/scripts.
### Steps to reproduce
Before the `package.json` change
Adding the following to `workspace/settings.json`
`"mojo.lsp.includeDirs"= ["/fully/qualified/path/src"] // Unsupported property`
Cross-directory imports fail to resolve:
<img width="739" height="37" alt="Image" src="https://github.com/user-attachments/assets/96ac62ec-3e97-41c7-a632-2735f5fc5a76" />
After change
`"mojo.lsp.includeDirs"= ["/fully/qualified/path/src"] // List of directories to append to the search path list ...`
Cross-directory imports resolve without issue:
<img width="398" height="31" alt="Image" src="https://github.com/user-attachments/assets/7bdce6ef-cc09-4ba8-b418-66a24253e285" />
### System information
System
------------
Pixi version: 0.48.2
Platform: linux-64
Virtual packages: __unix=0=0
: __linux=6.6.87.2=0
: __glibc=2.39=0
: __cuda=12.7=0
: __archspec=1=zen2
Cache dir: /home/insane-alchemist/.cache/rattler/cache
Auth storage: /home/insane-alchemist/.rattler/credentials.json
Config locations: No config files found
Global
------------
Bin dir: /home/insane-alchemist/.pixi/bin
Environment dir: /home/insane-alchemist/.pixi/envs
Manifest dir: /home/insane-alchemist/.pixi/manifests/pixi-global.toml
Workspace
------------
Name: mojo-sdl
Version: 0.1.0
Manifest file: /home/insane-alchemist/Mojo/Repos/mojo-sdl/pixi.toml
Last updated: 14-03-2026 15:23:06
Environments
------------
Environment: default
Features: default
Channels: https://conda.modular.com/max, conda-forge
Dependency count: 1
Dependencies: modular
Target platforms: linux-64
Prefix location: /home/insane-alchemist/Mojo/Repos/mojo-sdl/.pixi/envs/default
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.
denis
(Denis Gurchenkov)
May 2, 2026, 8:49pm
2
Hey Richard, thank you for posting and reporting the issues, and extra thanks for writing detailed and helpful descriptions!
denis
(Denis Gurchenkov)
May 2, 2026, 9:14pm
3
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
denis
(Denis Gurchenkov)
May 5, 2026, 4:29pm
4
I think both should be fixed now and new VSCode extension uploaded to the VSCode marketplace.