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

Cargo.toml file if mains to ".rs" rust analyzer doesn't work, changine main file to "_.rs" solves it. #19181

Open
hq-zyrosk opened this issue Feb 18, 2025 · 5 comments
Labels
C-bug Category: bug

Comments

@hq-zyrosk
Copy link

rust-analyzer version: rust-analyzer version: 0.4.2309-standalone

rustc version: rustc 1.86.0-nightly (ef148cd7e 2025-02-12)

editor or extension: VSCode

relevant settings: none

repository link (if public, optional): (eg. rust-analyzer)

code snippet to reproduce:

// any code of rust doesn't show editor token colors or hints if the Cargo.toml file has a lib which mains to ".rs" file, if I use "_.rs" as main file it works, next code if the Cargo.toml file I used.
[lib]
path = ".rs"
doctest = false

[package]
name = "en"
version = "1.1.1"
edition = "2024"
license = "MIT OR Apache-2.0"

[dependencies]
libc = "0.2.169"
@hq-zyrosk hq-zyrosk added the C-bug Category: bug label Feb 18, 2025
@ChayimFriedman2
Copy link
Contributor

This is probably because VSCode doesn't send us the file, because it doesn't consider it a Rust file.

@Veykril
Copy link
Member

Veykril commented Feb 19, 2025

Might also be our VFS not recognizing that as a file. What even is .rs? An empty file name with an rs extension or a file named .rs with no extension?

@lnicola
Copy link
Member

lnicola commented Feb 19, 2025

IIRC those don't even work on Windows. Could be VS Code, could be our bug.

@hq-zyrosk
Copy link
Author

hq-zyrosk commented Feb 19, 2025

VSCode detects it as a Rust file—confirmed via the status bar.

Using .rs as the main file is unconventional, but hey, we already chose Rust over the usual suspects—might as well embrace being different.

@hq-zyrosk
Copy link
Author

hq-zyrosk commented Feb 19, 2025

Might also be our VFS not recognizing that as a file. What even is .rs? An empty file name with an rs extension or a file named .rs with no extension?

A blank file name with .rs extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

4 participants