how can I persist Kotlin inspection settings in file .editorconfig in IteliiJ IDEA so that I could share them with a team through git?
Exact settings name is:
Editor > Inspections > Kotlin > Style issues > Accessor call that can be replaced with property access syntax
I'd like to change it's Severity level.
I tried to follow
https://www.jetbrains.com/help/rider/Code_Analysis__Code_Inspections.html#list-of-configurable-code-inspections
and
https://www.jetbrains.com/help/idea/configuring-code-style.html#editorconfig
but with no luck.
How exactly should .editorconfig entry look like for that settings and where can I find full list of property keys?
Thanks in advance!
Inspections have nothing common with .editorconfig files.
Editorconfig
Editorconfig is about Code Style (Preferences | Editor | Code Style | Kotlin)
All the styles could be exported via this button:
There are too many options to describe them all. That is why export is easier.
General options could be found at https://editorconfig-specification.readthedocs.io/#supported-pairs
Kotlin inspections
Inspections are IDE-specific. And they can be exported/imported to an XML file via this button:
But there is no possibility to export an individual inspection. Instead, you can create a project-wide inspections profile with your team and use it across.
You can share the inspection profile along with the project. Just add this file to your project's VCS: .idea/inspectionProfiles/Project_Default.xml
Related
Question is pretty much in the title. Does IntelliJ have native syntax highlighting for .jinja and .j2 files?
If not is there a plugin?
This plugin: https://plugins.jetbrains.com/plugin/7792-yaml-ansible-support offers some support for jinja files.
To ensure that this plugin is associated with jinja files:
Go to File > Preferences > Editor > File Types
Under Recognized File Types scroll down to YAML/Ansible and select it
Under Registered Patterns click the + icon and enter *.jinja.
With this configuration in place your jinja files will open into this plugin. If they do not, then jinja files must be already associated with one of the other Recognized File Types in which case you'll need to scroll through them to find the culprit and remove *.jinja from its Registered Patterns.
Try the Python plugin with IntelliJ IDEA Ultimate, that has support for Jinja2 Templates.
With recent version of Intellij, you don't need any plugin any more.
Go to File > Settings > Editor > File Types
Under Recognized Files Types, choose Jinja 2 Template
Under File Name Patterns add *.j2 for jinja2, and/or *.jinja for jinja
For Ansible yaml jinja 2 templates:
Under Recognized Files Types, choose YAML/Ansible
Under File Name Patterns add *.yaml.j2 and *yml.j2
Just for sanity sake. I found my solution in a combination of both answers previously posted.
Besides the Python plugin as #Andrei states it is needed that the file extension is recognized as explained above by #glytching: File > Preferences > Editor > File Types, for me the pattern *.j2 was missing.
As a good thing to do also would be to mark the directory as Template as described in section To define template directories on the referenced templates link given by #Andrei:
1. In the Settings/Preferences dialog, click the Project Structure page.
2. Choose the directory to be marked as a template root.
3. Do one of the following:
* Click Templates on the toolbar of the Content roots pane.
* Choose Templates on the directory's context menu.
I have modified an Intellij 'intention'. (I changed the initialization of the JUnit test class).
How do I make this available to other members of my organization? We are all working on the same Intellij 'project', but I believe that these changes are on a per-user, not per-project basis. (If there is a way to make the changes apply only to one project, I would prefer that).
File | Export Setting / File | Import Settings.
Are more robust way would be to use the Settings Repository plug-in.
Templates are stored in the %CONFIG% directory, fileTemplates subdirectory.
To export the file, you set the 'Schema:' pulldown in the upper right corner of 'Settings->Editor->File and Code Templates->Code tab' to 'Project' This will cause IDEA to create a folder PROJECT/.idea/fileTemplates/code, and put your modified file there. Details are in:
https://www.jetbrains.com/help/idea/2016.3/file-and-code-templates.html#d2040410e142
I'm using the updated version of the IntelliJ IDEA and am trying to export my code style settings so that they can be used by all developers working on a particular project. I read the tutorials at https://confluence.jetbrains.com/display/IntelliJIDEA/Code+Styles and http://forum.shakacode.com/t/sharing-your-intellij-rubymine-webstorm-codestyle-among-developers/240, which seems fairly simple.
Unfortunately that is not how my 'export settings' pane looks like, and I don't have a line that says 'code styles'. Mine looks like
The closest I can find is the line I highlighted which has CodeStyleSettingsManager in it along with a whole bunch of other stuff. However I tried using that and extracted the .jar file only to find that there was nothing much inside at all.
Does anyone know a way of exporting code styles that works with the latest version of IntelliJ?
Edit: My codeStyleSettings.xml file only contains the following:
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value/>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true"/>
</component>
</project>
I don't understand, why you don't see Code Style in your list (it appears in my IDEA 14.1.5), but...
(...) export my code style settings so that they can be used by all developers working on a particular project
A better way to share the project code style across all developers is to include it in your VCS repository. Pulling such a commit will apply those code styles automatically. This is the file: project/.idea/codeStyleSettings.xml. If your VCS is set to ignore .idea/, add an exception for this file.
If you don't see this file at all, you're probably using a local formatter and your Project scheme is unchanged. In this case, go to Settings > Editor > Code Style > Scheme: Manage, select your formatter and click Copy to Project.
Update
Code style files only state the difference to the IDEA Default Code style (which is always the same). You can try this yourself: create a new project, go the the Code Style settings, select Project and change only one option. The codeStyleSettings.xml file will be created, and it will contain only this one option. If you could export your code style settings, the output would be exactly the same.
How can I exclude some classes from autocomplete, but not from project?
I'm trying to develop on flash with starling library. The problem is that IDE always suggest me a built-in classes, which I probably don't want to use, even if I import another class.
http://monosnap.com/image/7VRQpIhqIPRK2wgBKp41GOU9i
I'm tried to exclude in a Settings -> Editor -> Auto Import, but it takes no effect on a autocomplete.
May be I can reorder autocomplete suggest, for placing the libraries classes on top?
I'm using idea 12.0.4
Does Settings -> Editor -> Auto Import -> Exclude from Import and Completion help you?
Now in Preferences | Editor | General | Auto Import
There are instructions at https://www.jetbrains.com/help/idea/auto-completing-code.html for disabling, but they didn't work for me until invalidating caches and restarting.
Pull up autocomplete, highlight the offending item, then option-return and exclude it, either at the class or method level. Then invalidate caches and restart.
Why does the default IntelliJ default class javadoc comment use non-standard syntax? Instead of creating a line with "User: jstauffer" it could create a line with "#author jstauffer". The other lines that it creates (Date and Time) probably don't have javadoc syntax to use but why not use the javadoc syntax when available?
For reference here is an example:
/**
* Created by IntelliJ IDEA.
* User: jstauffer
* Date: Nov 13, 2007
* Time: 11:15:10 AM
* To change this template use File | Settings | File Templates.
*/
I'm not sure why Idea doesn't use the #author tag by default.
But you can change this behavior by going to File -> Settings -> File Templates and editing the File Header entry in the Includes tab.
As of IDEA 14 it's: File -> Settings -> Editor -> File and Code Templates -> Includes -> File Header
In AndroidStuido 1.0.2 on Mac
Go in Preferences
then on left span File and Code Templates
After selecting file and code templates on right hand side select includes tab select
file Header and change your file header.
The default is readable, usable, but does not adhere to or suggest any coding standard.
I think the reason IntelliJ doesn't use the Javadoc tags in the default, is so that it avoids possible interference with any coding/javadoc standards that might exist in development shops. It should be obvious to the user if the default needs to be modified to something more appropriate.
Where I am working, the use of author tags is discouraged, for various reasons.
Because it's a default file template that you're supposed to change to your organization's standard, or your tastes.
My best guess.
It is likely that the header snippet you show is older than javadoc and was just borrowed from some coding standard document, probably written for C++.