Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] VSCode extension doesn't run simple file after switch to magic #3560

Open
kishmakov opened this issue Sep 28, 2024 · 13 comments
Open

[BUG] VSCode extension doesn't run simple file after switch to magic #3560

kishmakov opened this issue Sep 28, 2024 · 13 comments
Assignees
Labels
Area: IDEs bug Something isn't working mojo-repo Tag all issues with this label

Comments

@kishmakov
Copy link

kishmakov commented Sep 28, 2024

Bug description

I am trying to run simplest file:

fn main():
    var a = 1
    print(a)

within project set up by magic init mojo-examples --format mojoproject

The result is it looks like Mojo extension is not aware of anything:

Failed to initialize Crashpad.  Crash reporting will not be available.  Cause: while locating crashpad handler: unable to locate crashpad handler executable
/home/kishmakov/Documents/mojo-examples/7.mojo:1:1: error: unable to locate module 'stdlib'
fn main():
^
/home/kishmakov/Documents/mojo-examples/7.mojo:1:4: error: unable to locate module 'builtin'
fn main():
   ^
/home/kishmakov/Documents/mojo-examples/7.mojo:2:1: error: 
    var a = 1
^
/home/kishmakov/Documents/mojo-examples/7.mojo:2:13: error: could not find an 'IntLiteral' type
    var a = 1
            ^
/home/kishmakov/Documents/mojo-examples/7.mojo:3:5: error: use of unknown declaration 'print'
    print(a)
    ^~~~~
/home/kishmakov/.config/Code/User/globalStorage/modular-mojotools.vscode-mojo/magic-data-home/envs/max/bin/mojo: error: failed to parse the provided Mojo source module

Though it works through console as follows:

$ magic run mojo 7.mojo 
1

Steps to reproduce

  • Include relevant code snippet or link to code that did not work as expected.
  • If applicable, add screenshots to help explain the problem.
  • If using the Playground, name the pre-existing notebook that failed and the steps that led to failure.
  • Include anything else that might help us debug the issue.

System information

$ magic --version
magic 0.3.0

Mojo VSCode extension: v24.5.2

$ echo $MODULAR_HOME
/home/kishmakov/.modular

$ tree $MODULAR_HOME
/home/kishmakov/.modular
├── bin
│   └── magic
└── webUserId
@kishmakov kishmakov added bug Something isn't working mojo-repo Tag all issues with this label labels Sep 28, 2024
@walter-erquinigo walter-erquinigo self-assigned this Sep 30, 2024
@walter-erquinigo
Copy link
Contributor

Could you try again but removing the $MODULAR_HOME environment completely out of your system?
With magic and the new conda-based SDK, users shouldn't set this variable on their own, which might confuse automated tools like VS Code.

@antonl321
Copy link

I have uninstall modular and vs code for good measure to no avail.
On a simple hello world I got the output from the screen shot from below.
After I do magic shell MODULAR_HOME points inside hello-world dir:
$ echo $MODULAR_HOME
/home/syla/Apps/mojo/hello-world/.magic/envs/default/share/max

But VS code in the log window shows a strange path : /home/~/.modular/pkg/packages.modular.com_max/venv/bin/python

/home and ~ don't go together!

image

Copy link
Contributor

Would you be up to some zoom call any time this week to try to debug this? I might be able to figure out a solution that way. Otherwise, I'm kind of lost :(

@antonl321
Copy link

antonl321 commented Oct 2, 2024 via email

Copy link
Contributor

Cool, feel free to schedule a 15 min meeting on my calendar. My work email is walter@modular.com. I leave on the US East Coast

@antonl321
Copy link

antonl321 commented Oct 2, 2024 via email

@martinvuyk
Copy link
Contributor

martinvuyk commented Oct 3, 2024

Having a similar issue since a while ago and was too lazy to try and solve it. I've been programming like a caveman having to use control f to jump to function definitions ever since magic 0.3.0 update that broke something (used to work with 0.2.3) :(

Getting an error Couldn't install the MAX SDK for VS Code every time I open VSCode.

I tried removing every declaration regarding Mojo from my ~/.bashrc file and even deleted the whole ~/.modular/ folder and reinstalled magic to no avail.

Tried executing from the command palette select default MAX SDK and i get No MAX SDKs were found.

magic --version: 0.3.0
code --version: 1.93.1
mojo nightly extension: v2024.10.205

~$ tree ~/.modular
$HOME/.modular
├── bin
│   └── magic
└── webUserId

1 directory, 2 files

Current workaround

Downgrading with magic self-update --version 0.2.3
Upgraded again with magic self-update, restarted VSCode, waited for a while and the LSP worked again 🤷‍♂️

No idea if you just fixed it and that's why it worked..

PS: I thing formatting and basic docstring rendering and jumping to function definitions should still work even if there is no MAX SDK since these are all Mojo standards... And keep in mind I also would like to be able to develop software without an internet connection or a slow one, I still dislike bundling MAX and Mojo together since MAX is a library that I am not using so why punish with 300 megabytes that my 1-3 MiB/s connection takes minutes to download...

Copy link
Contributor

I have a fix in mind for this, which will also stop forcing downloading the SDK over the internet all the time. Please give me a couple of days.

@kishmakov
Copy link
Author

@walter-erquinigo Thank you, clearing $MODULAR_HOME solved the issue.

There is still a message about broken Crashpad:

Failed to initialize Crashpad. Crash reporting will not be available. Cause: while locating crashpad handler: unable to locate crashpad handler executable

But besides this everything is fine.

@josiahls
Copy link

josiahls commented Oct 5, 2024

I also still see:

Failed to initialize Crashpad.  Crash reporting will not be available.  Cause: while locating crashpad handler: unable to locate crashpad handler executable 

This is a fresh docker image also. MODULAR_HOME is completely removed

@soraros
Copy link
Contributor

soraros commented Oct 5, 2024

I also still see:

Failed to initialize Crashpad.  Crash reporting will not be available.  Cause: while locating crashpad handler: unable to locate crashpad handler executable 

Disable telemetry and this goes away:

magic telemetry --disable

@JamesNewborn
Copy link

Downgrading with magic self-update --version 0.2.3
Upgraded again with magic self-update, restarted VSCode, waited for a while and the LSP worked again 🤷‍♂️

Did not help. Still getting No MAX SDKs were found. and Couldn't install the MAX SDK for VS Code waiting for a fix ASAP, cause I have some ideas to make a pure-mojo implementation of postgresql driver.... 🙄 And little time to do it)

Copy link
Contributor

Hi everyone. I'm the maintainer of the VS Code extension. I'm sorry for responding a bit late, but I live in Florida and these past 2 weeks have been very complicated because of the hurricane, but I'm back at work finally.
I have come up with a new design for SDK handling that will make the VS Code extension less reliant on downloads, while at the same time making downloads more robust. I also plan to have the extension use the SDK provided by each individual MAX project, which would make the LSP work accurately.
Please give me a few days to fix this.

@walter-erquinigo walter-erquinigo closed this as not planned Won't fix, can't repro, duplicate, stale Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: IDEs bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

7 participants