microsoft / microsoft/vscode-cpptools

"configurationProvider" property disappearing

Open
#11,574 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Windows 11 Pro 22H2, build 22621.2428
  • VS Code Version: 1.83.1
  • C/C++ Extension Version: tried both 1.17.5 and 1.18.0
  • If using SSH remote, specify OS of remote machine: tried with both native Windows as well as a WSL remote (WSL 1.2.5.0 running Ubuntu 22.04.2 LTS).
Bug Summary and Steps to Reproduce

Bug Summary:
While editing c_cpp_properties.json, trying to add the "configurationProvider" property results in the current line and existing comments being deleted. Note that properties other than configurationProvider do not seem to have the same behaviour. It could be that this is the intended behaviour, however, it makes it difficult to browse the available values of the property.

Steps to reproduce:

  1. Install the C/C++ extension
  2. Open an empty folder
  3. Use the Edit Configurations (JSON) command to create and open the c_cpp_properties.json configuration file
  4. Try to add the property "configurationProvider", letting it be autocompleted to "configurationProvider": "". Alternatively, type it in manually.
  5. Notice the property as well as any existing comments disappearing. Note that it seems to happen on saving the configuration file.

Expected behaviour:
"configurationProvider": "" and comments not disappearing.

Configuration and Logs
c_cpp_properties.json:
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            // Random comment
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ]
        }
    ],
    "version": 4
}

C/C++ language server debug log:
LSP: cpptools/didChangeCppProperties (id: 46)
LSP: cpptools/didChangeCppProperties (id: 47)
LSP: cpptools/didChangeCppProperties (id: 48)
LSP: cpptools/didChangeCppProperties (id: 49)

C/C++ Configuration Warning:
[10/24/2023, 11:04:39 AM] For C++ source files, the cppStandard was changed from "c++17" to "".
[10/24/2023, 11:04:39 AM] For C source files, the cStandard was changed from "c11" to "".
Other Extensions

All other extensions are disabled, even though disabling them did not change the behaviour.

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the save behavior in c_cpp_properties.json using the Edit Configurations (JSON) command, adding configurationProvider and a comment. Trace the C/C++ extension's configuration-file handling to find where the property and comments are removed. Done means saving preserves both the configurationProvider property and existing comments.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.