rust-lang / rust-enhanced

The official Sublime Text 4 package for the Rust Programming Language
MIT License
780 stars 104 forks source link

Can't build a hello world cargo project #529

Closed Kamek437 closed 2 months ago

Kamek437 commented 2 months ago

Sublime Text Version

ST4 4169

Rust Enhanced Version

2.27.0

Operating system

Windows_NT Spellbook 10.0 22631 x86_64 MS/Windows (Windows 11)

Expected behavior

What should have happened? Project should run cargo build/run if it's setup with cargo, else rustc and run the binary.

Actual behavior

What actually happened?

Exception in thread Cargo Exec:
Traceback (most recent call last):
  File "./python3.3/threading.py", line 901, in _bootstrap_inner
  File "./python3.3/threading.py", line 858, in run
  File "C:\Users\kamek\scoop\persist\sublime-text\Data\Installed Packages\Rust Enhanced.sublime-package\rust/rust_thread.py", line 91, in _thread_run
    self.run()
  File "C:\Users\kamek\scoop\persist\sublime-text\Data\Installed Packages\Rust Enhanced.sublime-package\cargo_build.py", line 199, in run
    self.initial_settings)
  File "C:\Users\kamek\scoop\persist\sublime-text\Data\Installed Packages\Rust Enhanced.sublime-package\rust/cargo_settings.py", line 457, in get_command
    initial_settings=initial_settings)
  File "C:\Users\kamek\scoop\persist\sublime-text\Data\Installed Packages\Rust Enhanced.sublime-package\rust/cargo_settings.py", line 325, in get_merged
    result = self.get_global_default(key, {}).copy()
AttributeError: 'NoneType' object has no attribute 'copy'

Steps to reproduce

  1. cargo init project
  2. subl project
  3. Ctrl+B

Does anyone else get this? I just installed and figured it would be able to build a hello world project but guess I was wrong. I made my own build system to run cargo run/build and works fine, though it could not find cargo even though it was in my path I had to give it the path directly in the new build system I made. So it could be some kind of path problem. Here is my sublime-project file I tried to add a build system in there as well but it did not work at all. Am I doing something wrong? Never had to make a project or build system before it's always just worked with other languages and I'd assume it would be the same for rust but I guess I was wrong. Any help is much appreciated.

{
    "folders":
    [
        {
            "path": ".",
        }
    ],
    "settings":
    {
        "SublimeLinter.linters.clangtidy.compile_commands": "${project_path}/build",
        "cargo_build":
        {
            "paths":
            {
                "C:\\Users\\kamek\\source\\repos\\rust\\study":
                {
                    "variants":
                    {
                        "run":
                        {
                            "target": "--bin study",
                            "no_default_features": false,
                            "features": "ALL",
                        },
                    },
                },
            },
            "default_path": "C:\\Users\\kamek\\source\\repos\\rust\\study",
        },
    },
    "debugger_configurations":
    [
    ],
}
Kamek437 commented 2 months ago

I am stupid, the Rust extension got disabled in sublime-text somehow. Sorry.

Kamek437 commented 2 months ago

My bad.