microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

Values set in settings are not immediately available for use after changing them #12881

Closed bobbrow closed 3 weeks ago

bobbrow commented 3 weeks ago

Fixes: #12705

We can't use the value of a setting we changed on our side until after an await is processed, or we've finished handling the current event.

thernstig commented 3 weeks ago

@bobbrow although this most likely fixes the problem, does it also handle this?

image

The first time the IntelliSense configuration is changed in a new VS Code window, it will update the workspace settings.json as seen. This is highly unexpected I think?

The C/C++: Select IntelliSense Configuration... command seems to be for c_cpp_properties.json.

Updating the "C_Cpp.default.compilerPath" in settings.json makes more sense to do via the settings.json file manually or via the settings GUI. As there you can also define if it should be workspace settings, multi-root workspace settings.json or otherwise.

bobbrow commented 3 weeks ago

@thernstig it is currently intentional that we set the setting in settings.json. I no longer remember the discussion around why we chose this way (I want to say that the intent was to make it the default compiler but allow for overriding in a configuration in c_cpp_properties.json). We also set it in c_cpp_properties.json if there is a different value set for it because in this case setting the folder setting would have had no effect. An alternate approach might be to set it in c_cpp_properties.json if that file exists, and in settings.json if it doesn't.

thernstig commented 3 weeks ago

@bobbrow I'll ponder if I ever want to setup a separate issue for that one. I'll let it be for now :)

sean-mcmanus commented 3 weeks ago

@thernstig If you do create an issue, if you could explain why the current design behavior is insufficient that could help.

thernstig commented 3 weeks ago

@sean-mcmanus Will do! I think it is quite easy to reason around, if I opt to do this. But it is not a huge issue so not too tempted to write one since there are more important things you have at hand I am sure :)