Skip to content

Contents of c_cpp_properties.json file can get irrecoverably deleted #13491

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

Open
ivan-baldin opened this issue Apr 11, 2025 · 0 comments
Open
Labels
Feature: Configuration An issue related to configuring the extension or IntelliSense investigate: repro This issue's repro steps needs to be investigated/confirmed Language Service

Comments

@ivan-baldin
Copy link

ivan-baldin commented Apr 11, 2025

Environment

  • OS and Version: Debian 6.1.0-32-amd64
  • VS Code Version: 1.98.2
  • C/C++ Extension Version: 1.24.5
  • If using SSH remote, specify OS of remote machine: N/A

Bug Summary and Steps to Reproduce

Bug Summary:
After stashing and restoring .vscode/c_cpp_properties.json through git, cpptools will re-populate it's contents with default value deleting old contents.
Also works when temporarily moving or renaming .vscode directory.

Steps to reproduce:

  1. Create empty project and initialize git.
    mkdir -p foo/.vscode
    cd foo
    touch main.c
    git init
    git add main.c
    git commit -m 'Initial commit'
  2. Populate c_cpp_properties.json. Just something that differs from the default.
    echo '{"configurations":[{"name":"Foo"}],"version":4}' > .vscode/c_cpp_properties.json
  3. Open project folder in vscode and edit main.c. You should see C/C++ configuration is "Foo".
  4. Without closing vscode, stash untracked files and then restore them.
    git stash -k -u
    git stash pop
  5. Switch back to main.c. You should see C/C++ configuration has changed to default ("Linux" in my case).
  6. Click C/C++: Edit Configurations (JSON) through bottom right corner or command palette. This action destroys contents of c_cpp_properties.json. If you'd instead close and re-open vscode, you'd be safe.

Configuration and Logs

{"configurations":[{"name":"Foo"}],"version":4}

[C++.log](https://github.com/user-attachments/files/19702057/C%2B%2B.log)
[C++ Diagnostics.log](https://github.com/user-attachments/files/19702056/C%2B%2B.Diagnostics.log)

Other Extensions

  • Vim

Additional context

No response

@bobbrow bobbrow added investigate: repro This issue's repro steps needs to be investigated/confirmed Language Service Feature: Configuration An issue related to configuring the extension or IntelliSense labels Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Configuration An issue related to configuring the extension or IntelliSense investigate: repro This issue's repro steps needs to be investigated/confirmed Language Service
Projects
Status: No status
Development

No branches or pull requests

2 participants