We have a brand-new Mojo VS Code extension that has been rewritten from the ground up to provide a much better experience. Oh, and it’s now open source!
This new VS Code extension has been re-architected to fit how Mojo is distributed today. It detects the Mojo Language Server Protocol (LSP) server that’s present in either a Python virtual environment or a Pixi environment with Mojo installed. It detects the environment to use when you open the directory for your project, making sure that the version of Mojo used in the LSP is the same as when building your project.
This means that we no longer need to have two Mojo VS Code extensions, and will be sunsetting the nightly VS Code extension in favor of the one main Mojo extension. That should hopefully reduce some of the confusion people have experienced when seeing the two extensions, as well as when forgetting to turn one on and the other off.
This VS Code extension has replaced the default Mojo VS Code extension on the VS Code marketplace. We recommend switching to the main Mojo extension, and then installing the update to get this new version. You can freely uninstall the previous Mojo (nightly) extension, as that is no longer needed. This should also be up soon on OpenVSX to support other IDEs like Cursor.
If you want to try out bleeding-edge builds, a new .vsix extension is built on each merged pull request to the mojo-vscode repository. To download the extension, go to the Actions tab at the top of the repo, click on the corresponding “Build extension” action, and then scroll to the bottom to download the zip archive of the .vsix. Unzip this archive and in VS Code you can then go to extensions, choose the three-dot menu at the top and pick “Install from VSIX…”
One thing to be aware of with this new extension: it relies on the Python extension for locating your Python environment. In some cases, this appears to default to your globally-installed environment, even when a virtual environment exists. If the Mojo extension cannot find your SDK installation, try invoking the Python: Set Project Environment
command and selecting your virtual environment.
If you run into significant issues while trying out this new extension, please feel free to file an issue or comment in this thread. I will note that crashes of the LSP, syntax higlighting problems, and similar issues generally aren’t related to the extension itself but to the Mojo LSP. We have efforts underway to make significant improvements to that as well, in parallel to this new extension.