IntelliJ IDEA override $user - intellij-idea

It's a quite simple question, but I can't find an answer to it using SO-Search and Google.
Is it possible to override the default $user VTL-variable used in file-templates globally, instead of setting it in each template with #set($user = "...") ?
Like some sort of setup-script for IntelliJ itself, where I can alter the value?
Thanks in advance.
By the way, I'm using IntelliJ Ultimate 12.1.6.

You want to modify the IntelliJ's .vmoptions file(s) in a text editor.
In Windows, edit IntelliJ-Install-Location/bin/idea.exe.vmoptions and/or IntelliJ-Install-Location/bin/idea64.exe.vmoptions.
In Mac OS X, edit IntelliJ-Install-App.app/Contents/bin/idea.vmoptions.
Within these files simply add or modify the following line:
-Duser.name=Your name
If you recognize this syntax, that's because Intellij IDEA uses the Java System Property user.name to fill $user and ${USER}.

Related

How can I create a gedit plugin using python?

I wanted to create a simple gedit plugin that could save the current file when mouse leaves the text area (just like the <<leave>> event in tkinter) using python3. I went through wiki but I couldn't get much from it (All I could do was to create a plugin that just showed in plugins menu,nothing more). Can anyone help me with this?
According to the Python plugin HOWTO:
The gedit window based on Gtk.Window.
Looking at the documentation for Gtk.Window, it inherits from Gtk.Widget.
Looking at the signals documentation for Gtk.Widget, it looks like leave-notify-event is what you are looking for.

Is there a plugin to tell IntelliJ not to format a particular block when I use auto format?

My question is a duplicate of: How to turn off the Eclipse code formatter for certain sections of Java code? but for IntelliJ.
Does a similar feature exist for IntelliJ?
Yes, and It works the same way with:
#formatter:off
and
#formatter:on
Navigate to:
Settings > Editor > Code Style > Formatter control

IntelliJ does not recognize kotlin file after deleting it and recreate with the same name

I am currently having a problem with IntelliJ. I am using Kotlin in my project. I have deleted a file (let's say test.kt), and now, I want to create a new file with the same name. IntelliJ does not recognize the kotlin syntaxe and show it as a text file.
When I have deleted I have unchecked "safe delete" and "Search in comment and strings"
Can anyone help me in this matter ?
Edit : I tried to delete .idea and .iml file, restart intelliJ. It does not change anything.
"Overrid File Type" to Kotlin would work.
Expanding on a comment:
Is test.kt listed in Preferences > Editor > File Types > Text, under the Registered Patterns? An entry there may override the default Kotlin filetype
I had a class, MyProxy.kt, that as the question implies was not being picked up as a Kotlin class in IntelliJ. I scrolled through my list of file associations and did not find anything that could match MyProxy.kt except for the Kotlin extension, *.kt (it is entirely possible I missed something.)
Most regex matching will apply the most specific rule, though. On the off chance my class was being picked up by another association, I explicitly declared it as a Kotlin file pattern. It is a little hacky, but it did work! My Kotlin file name patterns are now:
*.kt
*.kts
*.main.kts
MyProxy.kt
Note: IntelliJ did complain that *.kt would already catch MyProxy.kt, but I overrode it.
Ctrl+alt+s, Editor, File Types, under recognized filetypes,
Under Filetype auto-detected by file content...
remove Main.kt

IntelliJ - Cucumber step definition case

Ever since I upgraded to latest community edition of IntelliJ 15.0.3, whenever I auto generate a step definition from the feature definition file using alt + enter, it creates the method in camel case rather than usual style with underscores.
For e.g. it used to be generated like this
#When("Cucumber is awesome")
public void cucumber_is_awesome() {}
But now it generates in usual camelCase convention:
#When("Cucumber is awesome")
public void cucumberIsAwesome() {}
Is there any way to change this setting back to the first style?
Thanks
What you can do is check the
Run -> Edit Configuration
then go to the cucumber config. Within the Program Arguments check if
--snippets camelcase
is present and take it out. that should make it show it in snake casing again. Hope that helps :-)

IntelliJ Ultimate 14 find usages not working

I am using IntelliJ IDEA 14 Ultimate. When I search find usages, in find view, there is an info like "Searching for usages in project files" and doesn't return any result. Scope is "whole project".
I have also IntelliJ 14 Community Edition. When it tries find usages in Community Edition, it works.
Do you have any idea?
I had exactly the same problem, so for people looking for the quick answer, try
File -> Invalidate Caches / Restart
Thanks to user #yole and his comment.
If it doesn't solve by File -> Invalidate Caches / Restart
then make sure your 'src' folder is marked as 'Sources' in project structure.
If File -> Invalidate Caches / Restart is not working -> close the project, remove it from recent projects and then delete the .idea folder then open the project again.
In PhpStorm version 2019.1 on a Windows machine, if you hold AltGr key and hover on a function, it appears the popup 'Show usage of Method ...' but it's misleading since doesn't find the calls to that method from other files.
The correct way to show usages, is to hold the Ctrl button and click on the method name.
There are also other cases the "Find Usages" feature does not work. I can illustrate one very simple case.
Provider.java:
public class Provider {
private static final Provider instance = new Provider();
public static Provider getInstance() { return instance; }
public Integer getID() { return 0; }
}
User.java:
public class User {
private final Integer pID;
public User() { pID = Provider.getInstance().getID(); }
}
If you click on the getID() method in Provider.java and call "Find Usages", it finds the call in the User.java easily. But if you rename or remove the getInstance() method in Provider.java, then it won't find the getID() call in User.java anymore.
I assume that it happens because the line Provider.getInstance().getID() is marked with red (compilation error) and the "Find Usages" feature does not consider this failing code as a valid call of getID(). It means that, at least some compilation errors affect the "Find Usages" results.
I was curious enough to look into the list of bugs related to this feature on https://youtrack.jetbrains.com/issues?q=find%20usages and there I saw there are other cases and made my conclusion. To sum up, if you don't like to keep in mind all the conditions in which it works and want always full search I recommend using grep which finds always and everything.
IntelliJ IDEA 2022.2.1
After Invalidate Caches/Restart did not work, what did fix the problem was Mark Directory As -> Unmark As Sources Root, followed by Mark Directory As -> Sources Root on 'src/main/java'
Sometimes problem in your code format structure.
Try this -
Press ctrl+alt+shift+l and
Choose selected text
Code cleanup
then your problem is resolved
You can also temporarily force a "bad" source folder (ex: .../tmp), then switch back to the correct source folder (ex: src/main/java).
This, combined with cache cleaning as explained in the other posts solved the problem for one of my collegues.
You declare / undeclar source folder with a right click on the folder, then "Mark Directory as ...".
have u tried mark directory as -> Project Source and Header?I just work out it in CLion.