Bug 446866

Summary: KDevelop should warn user if they open a single C++ file without a project manager
Product: kdevelop Reporter: Thiago Sueto <herzenschein>
Component: generalAssignee: kdevelop-bugs-null
Status: REPORTED ---    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Thiago Sueto 2021-12-12 07:16:17 UTC
I'd like KDevelop to warn the user when they open a single C++ file that is not bound to any project. QtCreator does this:

"Warning: This file is not part of any project. The code model might have issues parsing this file properly."

While the "code model" part is kinda obscure, it conveys the right idea: "hey user, if you edit just this file this IDE will error out and you won't be able to build and execute it, you should use a project instead". Indeed, the build and execute buttons are greyed out when that is the case.

KDevelop however *can* build and execute in these cases, just not from the expected Build and Execute buttons. Long time ago, the first time I tried KDevelop, dumb old me was learning C++ and got rather frustrated attempting to compile via those buttons; As a C++ newbie, I originally thought the best way would be to use the "just works" nature of IDEs to run a single file instead of a full-blown project. I didn't realize there was a blatantly simple option for my use case on my right pane.

So I'd also like for that warning to advertise that solution. KDevelop already provides by default a simple way to compile single, plain C++ files: the External Scripts pane on the right contains a Quick Compile button.

As such, I'd like to see something like this:

"Warning: This file is not part of any project, you won't be able to use the Build and Execute buttons unless you create a project using something like CMake or QMake. If you just want to compile a a single C++ file, you can use the Quick Compile option on the External Scripts toolview instead."

Such a message is non-cryptic, the warning can be shown only the first time if it's too intrusive, it invites the user to check out KDevelop functionality and ensures the user will know about using project files.