Search code examples
c++visual-studio-codecmakeenvironmentdevelopment-environment

vscode remembers selected cmake kit of deleted folder


So if I make a completely new folder, open it in vscode, and run 'cmake configure' for the first time - the cmake extension asks me to select a kit. Note how this happens only on the first time 'cmake configure' is run.

Here is what's weird: If I close vscode, delete the folder (and all of it's content), re-create this folder, re-open it with vscode and run 'cmake configure' again - this time I am not asked to select a kit for cmake.

I would expect that anything related to the workspace of this new directory will be stored within that directory, so when I delete the folder - any hidden files used by vscode to remember things like selected kits should be deleted. This is obviously not the case... So how does vscode remember things like selected cmake kits for certain workspaces?


Solution

  • I had a similar issue. Vscode stores global settings and information in:

    • Windows %APPDATA%\code
    • MacOS $HOME/Library/Application Support/Code
    • Linux $HOME/.config/Code

    From this 'code' directory, I did a recursive grep for the directory name that I was having issues with e.g.:

    grep -r --exclude-dir "logs" "testproj" .

    For me, this grep returned a couple of .json files and several state.vscdb binary files. I inspected the json files and corrected some pathing issues within them. This did not fix my issue however. The binary files returned by grep appear to be some vscode database files. With vscode closed, I removed (temp name changed) the state.vscdb and state.vscdb.backup files in all directories that were returned by the grep, then relaunched vscode.

    Vscode prompted me to do a clean cmake configure, which did work and gave me a clean build of my troubled directory. This admittedly is very brute-force, but worked for me. I only had a couple of projects that I had to rebuild. After rebuilding I did notice that some of the state.vscdb files had been re-created, but not all.

    It would be nice if this type of "deep clean" build were possible within vscode itself, but I couldn't find any info on this anywhere.