-
Notifications
You must be signed in to change notification settings - Fork 464
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
CMake Tools wants to configure non-CMake projects #2127
Comments
Is there a CMakeLists.txt file buried somewhere deep in your project? Or is the folder you opened very large? VS Code will activate our extension if it finds a CMakeLists.txt anywhere in your folder, or if it "times itself out" looking for one. Because VS Code does not currently tell us why it activated us, we can only assume that it was because a CMakeLists.txt was found or one of our commands was invoked. When you dismissed the prompt, did you click the 'x' or did you click "Don't show again"? We will do our best to be non-invasive if you don't need the CMake stuff turned on, but it sounds like there's one more message we could potentially remove. |
No CMakeLists.txt files in the projects. In one case, on Linux, the folder has only two sub-directories which contain only .tex and .pdf files. In another case, on WIndows 10, the folder the top of a javascript/React project, that has no CMakeLists.txt files. I have been dismissing the prompt via the 'x', because I kept meaning to file this issue and I wanted to be able to re-create it. |
Thanks for the extra info. We don't control the activation of our extension besides declaring to VS Code which events we want to trigger activation. The file based activation events are:
Getting a "reason" for activation is an open request for the VS Code team: microsoft/vscode#44711 I remember reading about one extension author using a workaround for the |
It appears that it is happening every time. I just opened three instances of VSCode, each by opening a folder, and each with TeX-ish projects. The extension wanted to configure all three. Two are flat, containing only If trying a custom build will help you out I'm certainly willing to give it a try. |
I built a new CMake Tools with this logic in it. To install it:
If that fixes it for you, we can commit it to the extension. |
Well, it might have helped a little. This time I launched VSCode and it opened my three tex project instances, and only one of the three prompted me to configure the project. That project, for what it's worth, has no subdirectories. |
Actually, looking at my editors, it probably was two that had CMake prompts. Two of the three instances have the CMake extension information in the status bar. |
That's weird. If you 'x' out of the configure prompt and |
In this case I didn't 'x' out the configure prompt, nor dismiss it at all, which my explain why the status bar stuff remained. I had opened another VSCode instance with a C++ project to make sure the custom extension still worked on that. The prompt dialogs went away on their own while I was doing that. I don't have any multi-root workspaces. The two tex project that showed the prompt are both under a ~/Projects directory, but the directories I actually opened are each a couple of levels down from there. |
On my system, it appears that it is the extension "CMake Test Explorer" that triggers the loading of CMake Tools, even when opening completely empty folders with VSCode. DetailsI have the same issue: Whenever I open a non-CMake folder in VSCode, even a completely empty folder, the plugin gives the message
As far as I am aware, this only started about 1-2 weeks ago, possibly linked to an update of VSCode. I arrived here in an attempt to figure out if there was a new setting introduced in VSCode or cmake-tools that triggers this behavior. While writing this and with the above comments in mind, I started wondering if this can be traced back to global VSCode settings. I found and commented out the following lines in "cmake.configureOnOpen": true,
"[cmake]": {},
"cmake.buildDirectory": "${workspaceRoot}/build/${buildType}",
"cmake.debugConfig": {
"stopAtEntry": false,
"MIMode": "lldb",
"miDebuggerPath": "(...)",
"logging": {
"trace": true,
"engineLogging": true,
"traceResponse": true
}
}, I still get a message when opening an empty folder, but this time it changed to
When I click "Not now", I again get the same message of "CMakeLists.txt was not found...", together with the possibility to set a setting to "Configure projects on opening?". If I click "Never" here, So the intermediate conclusion is that cmake-tools is just always loaded for some reason. I then thought that I would try to un- and reinstall cmake-tools to see what happens. In the process, the extension "CMake Test Explorer" complained that "CMake integration is enabled but the CMake Tools extension is not installed". And indeed, disabling that extension let me open empty folders without loading cmake-tools. After reenabling CMake Test Explorer, the cmake-tools messages reappeared. |
Interesting. In my case, the CMake Test Explorer extension is not installed on any of my systems. |
@DPChristoph it looks like the CMake Test Explorer activates on all events ( @jeffbi you may not have this extension, but do you have any other CMake-related extensions? Does this problem happen when you disable any of those other extensions? |
I have the CMake extension from twxs installed. When I uninstalled CMake Tools prior to installing the custom build that extension was uninstalled as well. Installing the custom build re-installed the CMake extension |
I just disabled the CMake extension and restarted. All three VSCode instances, each with a tex project, were prompted to configure with CMake Tools and all three have the CMake tools items in the status bar. |
What custom build are you referring to? What is the name of the extension? The behavior you're describing sounds like you have an extension that took a dependency on CMake Tools in its manifest. If that is the case, then CMake Tools will be activated any time that extension activates. |
Two days ago you pointed me at a build with some new work-around logic. |
Got it. I misunderstood what you wrote. The CMake extension that co-installs with ours does not activate us. Do you have any other extensions installed? |
Several. C/C++, CMake, CMake Tools, EditorConfig, hexdump, Jupiter, Jupiter Keymap, LaTeX Workshop, Pylance, Python, and vscode-icons. |
I have also been having this annoyance. I don't have a CMakeLists.txt in this Golang project I opened and yet it keeps asking about it. I ended up disabling the extension for each non-C++ vscode workspace, but wish I didn't need to. |
I have been having this issue for years already and I'm getting very tired of this. Is it possible to limit to only the root folder ? |
We used to limit only to the root folder but got feedback that that was not the desired behavior because even if someone set I think it would be fine to limit the search to a few folders, but as @jeffbi points out, the extension is still being activated. And unfortunately we can't add a setting to select the number of folders to search. That is part of the package manifest ( I just discovered the |
So here's the output from freshly opening my Golang project (without a CMakeLists.txt anywhere in sight) that somehow autoactivated the CMake Tools extension: Startup Performance logSystem Info
Performance Marks
Extension Activation Stats
Raw Perf Marks: main
Raw Perf Marks: renderer
Raw Perf Marks: localExtHost
Node Cached Data Statscached data usedcached data missedcached data rejectedcached data created (lazy, might need refreshes) |
Thanks @darkvertex! This log seems to indicate that there was a timeout searching for CMake files and CMake Tools was activated as a result. I think for your case, the patch we are considering will help. If you follow these instructions and reopen your workspace, that should remove CMake Tools as the cause for unexpected activation. If it still activates after that, please send another Startup Performance log and we'll see if another extension is causing the timeout (which in turn activates all extensions). |
This fix is included in the 1.9.0 CMake Tools release. Please upgrade your extension in VSCode and let us know if you encounter any other issues. |
Even after the update I get a workspaceContainsTimeout: Startup Performance## System Info
Performance Marks
Extension Activation Stats
Raw Perf Marks: main
Raw Perf Marks: localExtHost
Raw Perf Marks: renderer
Node Cached Data Statscached data usedcached data missedcached data rejectedcached data created (lazy, might need refreshes)In my workspace I have about 10 folders, each containing I suggest you to exclude these kind of folders with the glob pattern (
But it doesn't seem to have any effect. |
As far as I can tell, vscode is honoring those exclusions for extension activation purposes. I added CMakeLists.txt to |
A week ago I tried to remove those lines in |
A few minutes ago I opened a LaTeX-only directory and got the prompt to configure it. I closed the VS Code window and opened the directory again and there was no prompt. I opened a different LaTeX-only directory that is a sub-directory of a directory that does have a CMakeLists.txt file and while I didn't get the "do you want to configure" prompt, I did get prompted to select a kit. Does the extension go up directory levels even if it's on a directory that has no CMakeLists.txt file? |
It should only activate on the presence of files at the ${workspaceFolder} level and down. The way to know how you were activated is to run the |
OK, I again opened the LaTeX-only directory which is a sub-directory of a CMake directory. I got both the "do you want to configure" prompt and the "didn't find CMakeLists.txt" message. Here is the output from
Name Timestamp Delta Total
Name Timestamp Delta Total
Name Timestamp Delta Total
|
It activates because of a timeout checking the top 3 subfolders: The only other thing that stands out in this log is: I'm not sure how fast your VM is, but if it's slower to enumerate files than your local PC, that could contribute to the timeout. |
Interesting. The folder in question has no sub-folders at all. There are parent folders with |
How many files are in the folder? How long does it take to do an |
There are eight files in the folder. Running |
OK, I'll open an issue with the VS Code team, and likely disable the extension for this workspace. Thanks for looking into this. |
The VS Code team just made a change to stop activating extensions when the search for CMakeLists.txt times out. |
Brief Issue Summary
CMake Tools wants to configure non-CMake projects.
Expected:
CMake Tools should not attempt to inject itself into non-CMake projects.
Apparent Behavior:
When I open a directory in VS Code that is not a CMake project, such as a directory full of .tex files, I get a prompt asking me if I want to configure the project. After dismissing the prompt I get a message saying that the CMakeLists.txt file is missing.
Platform and Versions
The text was updated successfully, but these errors were encountered: