devonfw / IDEasy

Tool to automate the setup and updates of a development environment for any project (Successor of devonfw-ide).
Apache License 2.0
8 stars 20 forks source link

Adjusting Intellij settings in ide-settings #52

Closed CREITZ25 closed 3 weeks ago

CREITZ25 commented 1 year ago

As an Intellij user, I want to use Intellij with defaults that make sense to us. To do this, the required settings should be stored in the ide-settings repository.

jan-vcapgemini commented 1 year ago

For Adapter for Eclipse Code Formatter we need to use these settings:

image

jan-vcapgemini commented 1 year ago

For Save Actions I prefer to use these settings:

image

jan-vcapgemini commented 1 year ago

For the Maven Runner I'd suggest these settings:

image

jan-vcapgemini commented 1 year ago

For Maven Running Tests I'm using:

image

jan-vcapgemini commented 1 year ago

I've added a new branch to ide-settings now: https://github.com/devonfw/ide-settings/tree/dev-ide-settings

hohwille commented 12 months ago

Just had a long confusion with @moritzLanger because assertions are failing in his JUnit test. I was assuming that assertions are enabled via our settings and therefore did not get that the assert statements in the code were totally wrong (inverted) but never executed when I run the CLI. What we need to change is to enable assertions in our IDEs (ideally both Eclipse and Intellij and IMHO on all branches). This is done with the JVM option -ea for "enable assertions".

jan-vcapgemini commented 12 months ago

I've realized that "Save Actions Tool" is deprecated. It won't work in the latest version of intellij anymore. Looks like we have to remove it from our settings. :( With some luck, we might get its features integrated into intellij later: https://youtrack.jetbrains.com/issue/IDEA-326980

jan-vcapgemini commented 8 months ago

It looks like some more steps are required so that our settings work properly. F.e. eclipse needs to be pre-installed automatically, otherwise our Adapter for Eclipse Code Reformatter Plug-In won't work at all.

We also need to make sure that our IDEasy project gets cloned and imported into intellij properly.

Current workflow looks like the following:

All of these steps should be run automatically.

jan-vcapgemini commented 8 months ago

Another issue I've found is the initial clone of the settings when providing the dev-ide-settings git repository URL. It seems like the initial installation of devonfw-ide changed some files in the settings directory and fails to pull the latest version of our dev-ide-settings.

hohwille commented 8 months ago

I would propose to change margin/line-length to 160 as we have in Eclipse: https://github.com/devonfw/ide-settings/blob/7d8a9c83ad87b5d0aa060001cfd228b95605ea3f/intellij/workspace/update/.intellij/config/codestyles/Default.xml#L22

Effect: https://github.com/devonfw/IDEasy/pull/184/files#diff-63fb5fa0581be336809a98949d6475569b657b1a3183405ac5553adacd061eda

Another example: https://github.com/devonfw/IDEasy/pull/187/commits/42ea369595b76e3f14c208430d87473664dddff5

hohwille commented 8 months ago

Also I want to get @Override annotations automatically. I could not figure out how to do this with IntelliJ. In Eclipse we have this via Save-Actions.

mvomiero commented 6 months ago

The problem: _* Settings - Editor - Code Style - Java - Tab "Imports":

mvomiero commented 6 months ago

All open tasks (except FolderCompact, since I understood the downside is quite limiting) should be solved by https://github.com/devonfw/ide-settings/pull/38

hohwille commented 6 months ago

Confirmed that line wrapping to 160 worked. Thanks @mvomiero image

hohwille commented 6 months ago

@mvomiero Also Java used for maven seems correct: image

hohwille commented 6 months ago

For the record: Java is still preconfigured correctly (on Windows or without the current workaround for Mac): image

However, the JDK is still not pre-selected automatically: image

@ndemirca could you create a PR adding the misc.xml config that will fix this?

hohwille commented 6 months ago

@mvomiero I still do not get warnings for missing JavaDoc: image

hohwille commented 6 months ago

@mvomiero thanks also for fixing encoding. Seems to work: image (also note the yellow/orange mark if someone wants to do a quick and simple nice-to-have improvement)

mvomiero commented 6 months ago

@mvomiero I still do not get warnings for missing JavaDoc: image

That is because I used the settings that were provided in .intellij/config/inspectionProfiles/Project_Default.xml. I used them since they seemed to be quite precise about the handling of the warnings and so on, donΒ΄t actually know who wrote them, I thought they were project-specific.

Otherwise we can just activate a normal warining for missing javadocs πŸ“„

mvomiero commented 6 months ago

I added the warning for missing JavaDoc ⚠️ I substituted the not-working too specific old one in .intellij/config/inspectionProfiles/Project_Default.xml with a more generic in .intellij/config/inspection/Default.xml

here is the related PR: https://github.com/devonfw/ide-settings/pull/41

hohwille commented 5 months ago

I have another demand: When running JUnit tests projects often get the "commandline too long" error what is really annoying. I do not know, why IntelliJ is behaving so bad out-of-the-box but there is a generic solution for the problem that I will illustrate with a screenshot how it can be solved manually in the preferences: image We need to apply this manually then figure out in which config files this is written and then add the needed changes to our settings repo to automate this configuration to make IntelliJ usable for Java developers.

hohwille commented 4 months ago

To be clarified or fixed if all missing @Override annotations are automatically added by IntelliJ (maybe missing if protected or when comming from interface and not superclass TBD).

mvomiero commented 3 months ago

Created a new pull request: https://github.com/devonfw/ide-settings/pull/49 that should fix the last two problems of this issue:

With these solved, the issue should be finally solved and could be closed πŸš€

hohwille commented 3 months ago

I do not understand what is going on but I have the impression that we are still far away from our goal. I am on the latest main of our ide-settings and I did re-create my workspace from scratch to verify that its not my personal fault but I am getting this as a result: image and also this image

So it seems that our efforts in taming IntelliJ are somehow not paying off. This is really annoying. Is there something I could do wrong?

hohwille@CE49454 MSYS /d/projects/IDEasy/settings (main)
$ git log
commit 476b4e70b8690b0f6e22b3f332a285e0446edbc1 (HEAD -> main, origin/main)
Author: jan-vcapgemini <59438728+jan-vcapgemini@users.noreply.github.com>
Date:   Mon May 6 17:13:24 2024 +0200

    devonfw/IDEasy#154: show project name in intellij (#44)
hohwille commented 3 months ago

Seems I am forced to temporary go back to Eclipse since I am blocked and do not want to waste my time with this crappy IntelliJ that always gets into my way.

mvomiero commented 3 months ago

@hohwille I think the problem is that you are on branch main and not dev-ide-settings πŸ˜ƒ I believe we were speaking about merging the two branches some time ago right? but at the end it never happened.

hohwille commented 3 months ago

@hohwille I think the problem is that you are on branch main and not dev-ide-settings πŸ˜ƒ I believe we were speaking about merging the two branches some time ago right? but at the end it never happened.

I created and merged https://github.com/devonfw/ide-settings/pull/50 to avoid such problems and confusions.

hohwille commented 2 months ago

There is a simple option for the undesired reformatting of single-line JavaDoc comments causing Diff-Wars: 7aUur

hohwille commented 2 months ago

It seems to be already configured this way: https://github.com/devonfw/ide-settings/blob/5a4f6e225131ad6cfcb035ee1e383fc3f1d3c1e2/intellij/workspace/update/.intellij/config/codestyles/Default.xml#L9

However, what we configure sometimes does not apply. I have some doubts about how our config looks like... Why do we have some of these settings in <JavaCodeStyleSettings> while others are in <codeStyleSettings language="JAVA">? Is that all some IntelliJ legacy that is really required or are we maybe doing something wrong in our XML structure. Maybe we have to configure this from scratch in an IntelliJ not managed by IDEasy and then create our template from that outcome. In the worst case the XML structure has to be different for various versions of IntelliJ and then we are lost with the approach.

We have already discussed a very long time ago that it would be much smart to do all this with a simple .editorconfig file instead and ignore the native XML config used by IntelliJ that is undocumented. The .editorconfig is a more stable "API" to configure IntelliJ more "officially".

hohwille commented 2 months ago

image

hohwille commented 1 month ago

Can https://github.com/devonfw/ide-settings/blob/main/intellij/workspace/setup/.idea/saveactions_settings.xml be deleted? Seems not relevant anymore.

hohwille commented 1 month ago

Please create issue for XML merger usage of intellij XML configs and move them from setup to `update.

jan-vcapgemini commented 3 weeks ago

@mvomiero Also Java used for maven seems correct: image

Added new issue for this behaviour: https://github.com/devonfw/IDEasy/issues/601

jan-vcapgemini commented 3 weeks ago

All open points of this issue were addressed and for the current bugs new issues were created. This issue can be closed now.