Why can't I save some editor config settings to the local file? - visual-studio-2022

Looking at this question: How can I use a file-scoped namespace declaration in a class template?
The answer shows an example:
But when I add a file "Editor Config(.Net)" to my project it doesn't look the same:
many settings are hard-coded to Location = Visual Studio Settings
the severity options do not match that screenshot at all
I am also using VS2022 like the other question (Pro version in my case). What is going on? There's no point me adding a .editorconfig file to Git under my project if the settings I want to change aren't stored in that file.

Related

How to programmatically configure the settings of a CLion project (.idea files)

Is there a way to configure the settings of a project in CLion (2017.2.1 or later) programmatically via a script or terminal commands?
Specifically, the settings (File > Settings) I would like to be able to set via a command or script are:
those found under the Build, Execution, Deployment menu:
CMake/Generation/Configuration
CMake/Generation/CMake options
CMake/Generation/Generation path
CMake/Generation/Build options
those found under the Version Control menu:
Add
Git/Allow force push
etc.
Rationale:
The project directory contains the .idea directory. This is automatically created by CLion as soon as you open/import a suitable repo in the IDE. As far as I can tell, all the settings I am interesting in reside under $PROJECT_DIR$/.idea/workspace.xml saved there after I painstakingly configure the settings of the project by hand.
According to https://www.jetbrains.com/help/clion/project.html:
All the settings files in the .idea directory should be put under version control except the workspace.xml, which stores your local preferences. The workspace.xml file should be marked as ignored by VCS.
However, for cases where the above is not an option - developers who use an IDE-independent system - it becomes quite important (for ease of use, consistency, trace-ability, etc.) to be able to automatically configure a cloned project for CLion with specific pre-defined settings.
What I have tried:
I have tried, copying the .idea directory of an already-configured-project in CLion over to a newly-cloned repo (which has no such .idea directory) but some settings dependent paths did not work. Also, this solution is not as elegant/straight-forward as running a script (if that is indeed a possibility)/
Furthermore, I have tried using the Export settings option (File > Export Settings...) but the extracted jar file does not hold any project configuration; it only holds code style, UI and other general settings.
I understand that CLion is not open-source but if anyone knows the necessary commands or knows of an available API or even a plugin to allow programmatically configuring these settings in a CLion project, please let me know.

Force IntelliJ to use another Home Directory?

I have read this... it does not answer the question.
I would like to have IntelliJ use another location for all of my project files. Currently, it goes to c:\users\ as a default project location.
I want to change that to c:\git.
I tried to change the "Start in" link properties, to no avail.
I don't want to force all of the configuration (ie: the .IdeaIC15 folder) to be relocated, I just want it to go to c:\git when I click "Open project".
To change the directory where project files are located to C:\git:
Select Help->Edit Custom VM Options...
Add the following line to the end of the file that comes up in the editor (*):
-Duser.home=C:\git
Restart IntelliJ.
(*) The file that comes up in the editor will either be idea64.exe.vmoptions or idea.exe.vmoptions.
Notes:
This will update/create a .vmoptions file in your config directory. It does not modify the vmoptions file in your install directory.
The above steps do not change the default directory that is used
when cloning git repositories. This is the directory that is used in
the File->New->Project from Version Control->Git window. You
still need to set that directory to C:\git and clone one remote repo
into C:\git. Once you have done that IntelliJ remembers the directory and
uses it for subsequent clones.
https://intellij-support.jetbrains.com/hc/en-us/articles/207240985-Changing-IDE-default-directories-used-for-config-plugins-and-caches-storage
Locations can be changed by editing the following file:
IDE_HOME\bin\idea.properties
Follow the comments in idea.properties file to change the defaults, make sure to un-comment the lines defining these properties:
idea.config.path
idea.system.path
idea.plugins.path
idea.log.path

IntelliJ-IDEA: how to enforce same code style

We are using IntelliJ IDEA 10.5. How can we ensure that everyone is using the same code style and Rearranger configuration? What files should be put under version control?
You should share most of the files in .idea directory when using the directory based format, check the FAQ.
In the Code style settings make the current scheme project specific, it will be stored in .idea/codeStyleSettings.xml (or project .ipr file when using the legacy format).
Rearranger is a third-party plug-in and as far as I know doesn't store its configuration inside the project. It has options to import configuration from a file and export it to a file which you can use to maintain the same configuration by putting this file in the version control.
Note that IDEA 12 will bundle a new Rearranger plug-in which will have better configuration management (similar to the code style settings, or a part of it).

Which file IDEA uses to display the name of Android project?

Which file in Android project does IDEA use to display project name in Recent Projects list?
If I want to change display name of my 8th project to "My changed project", which file should I edit? Is this done manually editing a certain file or can be done in a faster way via Ctrl+F6?
I am asking this as renaming module will not change display name.
Depending on the project format, IDEA uses either the .ipr file (its name, specifically) or some file buried under the .idea directory apparently.
Anyway, to change the project (display) name:
Projects using the newer directory-based format
(If you're not sure which format your project is using, try this first.)
Don't edit any file; instead, open the Project Structure dialog (Ctrl-Alt-Shift-S or ⌘;), and under General Settings for Project, change Project name.
Projects using the older file-based format
Find the main project settings file with .ipr extension, in your case LibraryTest.ipr, and simply rename that. Also rename the accompanying .iws file.
(NB: Close the project before doing this. Also, if there's an .iml module file with the same name, leave that alone. If you want to change names of modules, do that through Project Structure settings.)
The project will first disappear from the Recent Projects list; you'll have to use "Open Project" and find the newly renamed .ipr file to open it.

How to share Code Style settings between developers in IntelliJ

I would like all developers on my team to use the same default code style settings. We all use IntelliJ 11+ as our IDE and we use git as our source control system.
What is the easiest way to make sure they're all using the same settings? I thought there would be a way to check in the style settings into the project and have their editors discover them automatically, but that doesn't seem to be the case.
PS. I don't mind if developers consciously override some of the default settings with their own preferences, but I do want to make sure that we all at least start from a common set of default settings.
Code Style can be copied to project and saved in .idea/codeStyles to be shared via version control:
Copy to Project Click this button to create a copy of the current global scheme to the project level. After creating the copy, IntelliJ
IDEA suggests to switch to this new scheme at the project level.
The Settings Repository feature was introduced at IntelliJ IDEA 2016.
This option helps us to share IDE settings between different computers, including sharing settings between developers.
The settings are stored at Git repository, for example on GitHub or Bitbucket.
To setup Git repository we should set URL via Settings Repository menu option.
The developer can load remote settings, overwrite remote settings or merge local settings with remote ones.
The structure of Git repository with settings:
I used personal access token for GitHub authentication.
More information:
Settings Repository
Creating a personal access token for the command line
I came across this long after the fact, but thought I'd share if anyone ran into this. Add the following to your .gitignore
# IDE - IntelliJ
/.idea/*
# Keep the code styles.
!/.idea/codeStyles
/.idea/codeStyles/*
!/.idea/codeStyles/Project.xml
!/.idea/codeStyles/codeStyleConfig.xml
# Keep the inspection levels
!/.idea/inspectionProfiles
/.idea/inspectionProfiles/*
!/.idea/inspectionProfiles/Project_Default.xml
And of course, make sure your .gitignore also has a ! in front of it so these changes get picked up.
Basically, gitignore's recursive looking is a little wonky, so the below ignores a directory's contents, except for a subdirectory, then ignores that subdirectory's contents, except for the files we want.
codeStyleConfig lets you use per project settings, the project file itself is your actual code styles, and I included the Project_Default as it holds the warning levels, which you likely want if you're doing the code style work anyways.
You can create .editorconfig file in Your project (and it can be managed on directory level). More info on https://www.jetbrains.com/help/idea/configuring-code-style.html#editorconfig and https://editorconfig.org/
With this approach You can keep all Your code style settings in one file and it's not limited to IJ only.