rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
13.8k stars 1.53k forks source link

Rust Analyzer Warning in VS Code for Non-Rust Projects #15068

Open aamironline opened 1 year ago

aamironline commented 1 year ago

Dear Support Team,

I am writing to report a persistent issue I am facing with Rust Analyzer in Visual Studio Code (VS Code). Whenever I open a non-Rust project in VS Code, I consistently receive the following warning:

image

This warning message appears every time I work on a project that is unrelated to Rust development. Although I understand that Rust Analyzer primarily caters to Rust projects, the constant recurrence of this warning for non-Rust projects is highly disruptive and hinders my workflow significantly.

While I understand that Rust Analyzer is primarily designed for Rust projects, the presence of this warning for non-Rust projects can be bothersome. If other language servers were to adopt a similar behavior and display warnings for unsupported languages, it would greatly impede productivity and make working on different projects frustrating.

I kindly request your assistance in resolving this matter promptly. It would be greatly appreciated if you could provide guidance on how to disable or suppress this warning specifically for non-Rust projects in VS Code. By doing so, we can create a more seamless and efficient development environment, allowing users to work without unnecessary interruptions.

Should you require any additional information or clarification from my end, please do not hesitate to let me know. I eagerly await your response and appreciate your attention to this matter.

Thank you for your understanding and support.

Sincerely, Aamir

lnicola commented 1 year ago

rust-analyzer is not supposed to start unless you have a Rust file, one called Cargo.toml or rust-project.json: https://github.com/rust-lang/rust-analyzer/blob/master/editors/code/package.json#L66.

Can you check you don't have any of these in your project? And also if it happens somewhere else, like in a directory with just one or two files that's not under D:\Projects.

bromzh commented 1 year ago

I have same trouble. I've created empty dir with only package.json:

> ls -all
total 8
drwxr-xr-x   3 me  staff    96  3 июл 16:56 .
drwxr-xr-x  42 me  staff  1344  3 июл 16:55 ..
-rw-r--r--   1 me  staff   199  3 июл 16:56 package.json

And rust-analyzer trying to start. I'm on MacOS Ventura 13.3.1 (a). Bug reproducing on both rust-analyzer v0.4.1574 and rust-analyzer v0.3.1575

Veykril commented 1 year ago

That doesn't reproduce for me on windows. Can you check with all your extension but rust-analyzer disabled?

bromzh commented 1 year ago

Yep, when I disable all extensions, rust-analyzer begin to work correctly. Hoing to turn on one by one and search which one will cause problem.

bromzh commented 1 year ago

And I found a cause - this extension. @aamironline do you use this ext too? UPD it seems, another similar extension also affects this.

Veykril commented 1 year ago

relevant marketplace link: https://marketplace.visualstudio.com/items?itemName=actboy168.tasks

bn-l commented 6 months ago

This happens when I trigger my run task by pressing ctrl+alt+enter (but only when doing this). I looked at the default key bindings and there's no reason why it should. I have none of the extensions mentioned installed.

Veykril commented 6 months ago

Some extension of yours most likely queries the all your extensions' tasks which triggers the task activation event for all of them, there is no much we can do about that as VSCode is the one sending rust-analyzer the activation event due to that.

evrensen467 commented 4 days ago

I'm on macOS 14.5 and rust-analyzer constantly starts up with an error in my swift projects.

Screenshot 2024-07-01 at 19 00 25