Skip to content

The main.rs file is not actually created after calling rust-playground #14

Open
@zino23

Description

@zino23

After executing rust-playground, only an emacs buffer is created for main.rs, not the physical file. This will make lsp server like rust-analyzer unable to start cause it expects "either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present".

The full error is like this:

[stderr]  rust-analyzer failed to load workspace: Failed to load the project at /tmp/rust-playground/at-2025-01-05-153947/Cargo.toml: Failed to read Cargo metadata from Cargo.toml file /tmp/rust-playground/at-2025-01-05-153947/Cargo.toml, Some(Version { major: 1, minor: 76, patch: 0 }): Failed to run `cd "/tmp/rust-playground/at-2025-01-05-153947" && "cargo" "metadata" "--format-version" "1" "--manifest-path" "/tmp/rust-playground/at-2025-01-05-153947/Cargo.toml" "--filter-platform" "aarch64-apple-darwin"`: `cargo metadata` exited with an error: error: failed to parse manifest at `/tmp/rust-playground/at-2025-01-05-153947/Cargo.toml`
[stderr]  
[stderr]  Caused by:
[stderr]    no targets specified in the manifest
[stderr]    either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present

Seems like we should save the buffer to make sure the corresponding file is sinked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions