Settings Layers: Solution is getting Naming Style settings on generation that shadow my computer-wide settings
Hello! I'm trying to use Settings Layers in Resharper C++. I have settings that I've enabled for this computer that apply to most of my projects;
These have camel case settings settings for ‘Naming style’;
My problem is that it seems as if my solutions, which are generated from CMake, always get other settings in the solution layer. If I click here
I see that the solution layer got populated with a bunch of snake case settings for some reason;
These take precedent over my camel case settings. If I read the documentation, it seems to imply that the solution layer should be empty, so that my computer-wide settings would take effect and be prioritized over ReSharper C++'s default settings. The only way I can get the computer-wide settings to take effect now, is to manually go in and delete all the settings that the solution layer is populated with, which is annoying, since I frequently re-generate the projects I have.
Is this a bug, or am I misunderstanding something about how layers work? Could the solution layer settings be coming from some source that I haven't understood, like a .clang-format or .editorconfig or so?
Thanks
Please sign in to leave a comment.
Hello Alexander,
Sorry, I don't quite understand the issue yet.
So there are several main layers: solution personal, solution shared, this computer, default settings. When using a setting R# in general goes through the layers one by one, and picks the value of the setting from the first layer that has it defined.
Assuming there's no .sln.DotSettings.User file, when you click “Edit layer” next to the “Solution personal” layer, R# shows you the default settings (with STL naming I think?), because the layer is empty and there are no changed settings. If you change the settings in this dialog, R# will save the changed settings to the .sln.DotSettings.User file and use them next time they are queried.
To look at the actual combined settings from all layers, just open settings with “ReSharper | Options”. Assuming there are no .sln.DotSettings.User and .sln.DotSettings files, R# will use the naming settings from your “This computer” layer, and you should see camel case naming settings.
Naming settings are currently not imported from .clang-format, so it shouldn't affect anything.
Thanks and please let me know if something is still not clear or doesn't work how you expect.
Igor Akhmetov Thank you for the reply!
> Assuming there's no .sln.DotSettings.User file, when you click “Edit layer” next to the “Solution personal” layer, R# shows you the default settings (with STL naming I think?),
Ok, this was my major source of confusion. Thank you for clearing that up!
> To look at the actual combined settings from all layers, just open settings with “ReSharper | Options”. Assuming there are no .sln.DotSettings.User and .sln.DotSettings files, R# will use the naming settings from your “This computer” layer, and you should see camel case naming settings.
Thank you for clearing this up too.
> Naming settings are currently not imported from .clang-format, so it shouldn't affect anything.
Great to know, thank you!
With all your useful info, I realized that my original theory was wrong, and I went looking in other places. The settings that were actually shadowing my layer were the ones in the ‘This computer’ main layer, i.e. this one;
I had been adding settings into this file from the context menus a long time ago, and didn't realize that they were there. I went into this layer and deleted all settings in ‘Naming Style’. Some settings were still shadowed though, and I finally realized that I needed to go into this DotSettings file (the one in the user application data folder) and delete all the removal entries such as
With all the keys under “CodeStyle/Naming/CppNaming” removed from this file, finally all my camel case settings shone through! So success in the end!
My feedback related to this adventure then will be that displaying the default settings in the layer view if it's empty makes it really hard to understand if the layer is empty. And it also doesn't seem like you're visualizing key removals at all in this view? This also makes it hard to understand the total behavior IMO without looking at the DotSettings files themselves. Do you have any other tools for introspecting the settings stack that could make this clearer?
In either case, thank you very much for the assistance, I got everything working now!
Unfortunately, I don't think there's an easy way to understand what layer a setting value comes from. But I find it somewhat surprising that user “This computer” settings files have lower priority than the standard “This computer” settings file. I'll check if this is intended. Thanks!