wiki needs you: share your IDE tips and tricks

Hello wiki readers :smile: and IDE heroes :dart:

I started dusting of the developer how-to wikis for IDEs a bit

and would hope that some of you would share your favorite IDE settings or tips that make OpenMRS development a summer vacation :sunny: This will greatly help new developers set up their IDEs.

Please just update the wiki with your tips!

1 Like

Hello @teleivo,

Till today, I still can’t figure out how to set-up IntelliJ IDEA properly :smile: I prefer using a light weight IDE like Visual Studio Code. It is not as advanced as Eclipse or IntelliJ, but it has a handful of helpful extensions! :relaxed:

Hi @grimm,

thanks for sharing! Thats good to know, I also often feel overwhelmed with all the settings/plugins in Eclipse & IntelliJ. Thats why I thought we should have better docs so new devs or older ones (me included) dont have to go through the same pain :joy:

There are pages for Eclipse, IntelliJ, Netbeans under https://wiki.openmrs.org/display/docs/Developer+How-To+Guide Do you want to create a Visual Studio one? That would be fantastic! I’m sure others would also like to use Visual Studio but might not know how to tweak it for OpenMRS development.

@teleivo I’ll try to see if I can create one for Visual Studio Code any of these days. :grinning: Oh, like I said, it’s not as advanced as Eclipse or IntelliJ, but is still awesome! :smile:

1 Like

Great initiative @teleivo ! Here are a few tips for Intellij IDEA that I use and might be useful for beginners. .

  1. Renaming all instances of a variable: Place your cursor at the end of the work and press Shift + F6. This should highlight all instances of the particular variables in that Class file and helps for quick renaming.

  2. All project String Search: Ctrl+Shift+F. This helps you to search for a particular word/method across your entire project.

  3. Remote Synchronizer: Helps refresh HTML/CSS and other static pages without restarting the server instance while development. Tutorial for intellij here on @ssmusoke 's blog (bunch of other tricks here too) https://ssmusoke.com/2015/09/24/openmrs-module-development-learnings-102/

  4. Setting up the Maven Plugins within Intellij (Can be used for Hotswapping /Refreshing Class changes without deployment): Right click on Maven projects on the left toolbar, expand the project, and you should see the entire configurations of Maven plugins. You can find jetty there, deploy, clean basically everything.

I guess that’s all that comes to mind for now. Will add to this if anything comes to mind!

2 Likes

@bholagabbar awesome! Can you please also add your tips to the IntelliJ wiki page.

Good going @teleivo .This is one post that’s going to help new devs a lot :smile: .One of the commands in Intellij which I find most useful is using Ctrl+Shift+Alt+L to reformat the code in a particular file which we want. We could also use Ctrl+Alt+L but it probably re-formats the whole code(Not recommended). More information on the same can be found here : https://www.jetbrains.com/help/idea/2016.3/reformatting-source-code.html

love the way you are making things easier for new-devs @teleivo . This is a pretty simple trick, but in case someone didn’t know. In eclipse you can automatically generate getters and setters, generate constructors, etc. Just right click on the program code go to source and you will a lot of useful options :slight_smile:

thanks all for your awesome tips!!!

I created a landing page which links to all IDE specific setup pages

https://wiki.openmrs.org/display/docs/How-To+Setup+And+Use+Your+IDE

please help me out and directly add you suggestions to the wikis thank you all :blush:

1 Like

@teleivo, the instructions for IntelliJ no longer work as of the 2017.1 release.

Someone created this ticket (which I will close and point back to Talk), and I verified it also doesn’t work for me. For me I don’t see “Eclipse XML Profile” as an import option, and the code formatter is not in IntelliJ format.

I could try to export my existing configuration (which should include the code style I imported and then upgraded in IntelliJ, though I don’t know if I necessarily had the very latest). If I do that, where should I put the file? (I think it’s fine to make it a sibling of https://github.com/openmrs/openmrs-core/blob/master/tools/src/main/resources/eclipse/OpenMRSFormatter.xml.)

What do you think?

If that doesnt exist in 2017.1 it means they removed it which is annoying.

Our formatter xml is from an older eclipse version, you could update that to latest Eclipse and try to import that into 2017.1 intellij. maybe it still supports eclipse xmls but not the older xml version we have.

SHORT ANSWER: Sure you can add it here https://github.com/openmrs/openmrs-core/tree/master/tools/src/main/resources/intellij so people can contribute :slight_smile:

LONG ANSWER:

Formatting is something that I think is a pain and could be improved.

I mean we often have different formatting from intellij/eclipse contributors. Not everyone configures their IDE, is it to combersome, complicated? Or runs the maven build command running the formatter which unfortunately does not format everything (the formatter we use is outdated and our format xml is not well configured for fluent APIs see https://issues.openmrs.org/browse/TRUNK-5095 )

Maintaining 2 files for the same thing is annoying. The one we had wasnt updated for fluent/Java 8 style.

Should we look into alternatives for this?

1 Like

I approve of the general idea of using someone else’s solution to this problem, e.g. Google’s.

Besides replacing tabs with two-spaces, and moving away from

}
else {

… any idea how much of our code would need to change to adhere to google’s style?

I havent yet tried their plugin, its on my todo. But I assume a lot. I mean given the fact that our code does not adhere to our own formatter settings (in Eclipse you could right click in the openmrs-api on src/main/java Source -> Format which will format all and lead to quite a diff). I will try to get more input from others.

Anyone with proven solutions to this is of course welcome to bring them forward :slight_smile: