Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusting Intellij settings in ide-settings #52

Closed
10 tasks done
CREITZ25 opened this issue Sep 28, 2023 · 34 comments
Closed
10 tasks done

Adjusting Intellij settings in ide-settings #52

CREITZ25 opened this issue Sep 28, 2023 · 34 comments
Assignees
Labels
enhancement New feature or request

Comments

@CREITZ25
Copy link
Member

CREITZ25 commented Sep 28, 2023

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.

  • Settings - Editor - Code Style - Java - Tab "Imports":
  • Class count to use import with '*' : 999
  • Names count to use static import with '*': 999
  • Set line length to at least 160 characters (I cannot imagine that as of today any developer does not get this number of characters on his screen without the need to scroll - the restrictions limiting to 80 or later 120 characters per line come from an ancient time and the reformatting line wraps added by intellij contribute to our diff-war)
  • Ensure we get a Warning if JavaDoc is missing or incomplete for public and protected elements (Types, Fields, Constructors, Methods including parameters).
  • Activate "save actions" in Intellij (like in Eclipse to ensure the code-style is always applied and cannot be forgot on commit)
  • Eclipse reformat plugin should not be used anymore - we want to configure IntelliJ natively (otherwise you get errors if you never installed and configured Eclipse and our team is not using eclipse) See here
    https://github.com/devonfw/ide-settings/blob/d1a7dd1f1ae817b3fb659f92a8fb54eb567b3b74/intellij/plugins/EclipseCodeFormatter.properties#L2
  • Optional: FolderCompact plugin could be pre-installed too (I initially liked this plugin but it has some severe downsides - if it is installed, you do not see folders like src anymore and if you have src/main/assembly or anything not common you get unable to see this in IntelliJ. This renders the plugin useless even though it would otherwise be great. See my rating comment here)
  • Maven Builder settings need to be pre-configured
  • Encoding for resource bundle properties to UTF-8
  • more?
@CREITZ25 CREITZ25 added the enhancement New feature or request label Sep 28, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Sep 28, 2023
@jan-vcapgemini
Copy link
Contributor

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

image

@jan-vcapgemini
Copy link
Contributor

For Save Actions I prefer to use these settings:

image

@jan-vcapgemini
Copy link
Contributor

For the Maven Runner I'd suggest these settings:

image

@jan-vcapgemini
Copy link
Contributor

For Maven Running Tests I'm using:

image

@jan-vcapgemini jan-vcapgemini moved this from 🆕 New to 🏗 In progress in IDEasy board Oct 4, 2023
@jan-vcapgemini jan-vcapgemini self-assigned this Oct 4, 2023
@jan-vcapgemini
Copy link
Contributor

jan-vcapgemini commented Oct 4, 2023

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

@hohwille
Copy link
Member

hohwille commented Oct 9, 2023

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
Copy link
Contributor

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
Copy link
Contributor

jan-vcapgemini commented Jan 16, 2024

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:

  • run devon eclipse
  • manually clone IDEasy into workspaces/main
  • run devon intellij
  • open/import the workspaces/main folder
  • browse to the IDEasy module
  • rightclick on the pom.xml in the root and choose Add as Maven project

All of these steps should be run automatically.

@jan-vcapgemini
Copy link
Contributor

jan-vcapgemini commented Jan 16, 2024

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
Copy link
Member

hohwille commented Jan 19, 2024

@hohwille
Copy link
Member

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
Copy link
Contributor

The problem:
* Settings - Editor - Code Style - Java - Tab "Imports":
* Class count to use import with '' : 999
* Names count to use static import with '
': 999

may be fixed by: devonfw/ide-settings#37

@mvomiero
Copy link
Contributor

All open tasks (except FolderCompact, since I understood the downside is quite limiting) should be solved by devonfw/ide-settings#38

@hohwille
Copy link
Member

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

@hohwille
Copy link
Member

@mvomiero Also Java used for maven seems correct:
image

@hohwille
Copy link
Member

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
Copy link
Member

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

@mvomiero
Copy link
Contributor

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

  • the "commandline too long" error when running JUnit tests
  • missing @OverRide annotations

With these solved, the issue should be finally solved and could be closed 🚀

@mvomiero mvomiero moved this from 🏗 In progress to 👀 In review in IDEasy board Jun 14, 2024
@hohwille
Copy link
Member

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 <[email protected]>
Date:   Mon May 6 17:13:24 2024 +0200

    devonfw/IDEasy#154: show project name in intellij (#44)

@hohwille
Copy link
Member

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
Copy link
Contributor

@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 added a commit to devonfw/ide-settings that referenced this issue Jun 20, 2024
* #52: initial dev project settings
added SaveActions plugin and settings
added FolderCompact (disabled)
added Maven localRepository settings

* added JavaDoc warning for Intellij

* delete SaveActions plugin from IntelliJ as this is not supported anymore

* fix/standardize versions for dev team

* added save actions macro and keymap
added save actions macro (adds CTRL+SHIFT+S for code reformat and optimize of imports)

* #52: added missing files
added codeStyleConfig (includes default project)

* import options fix (#37)

* #52: Intellij import options (#38)

* fixes Warning JavaDoc
* disables eclipse as code formatter
* adds encoding utf-8 boundle properties
* sets jre name for mvn builder
* sets line length to 160

* Update workspace.xml (#43)

This PR changes the slashes for maven settings so that it works with Linux and Mac as well.

* #52: intellij import options - missing javadoc (#41)

* devonfw/IDEasy#52: added JDK into intellij settings (#42)

* latest is greatest for stable tools

* clean-code

---------

Co-authored-by: jan-vcapgemini <[email protected]>
Co-authored-by: Marco Vomiero <[email protected]>
Co-authored-by: aBega2000 <[email protected]>
Co-authored-by: ndemirca <[email protected]>
@hohwille
Copy link
Member

@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 devonfw/ide-settings#50 to avoid such problems and confusions.

@hohwille
Copy link
Member

hohwille commented Jul 9, 2024

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

@hohwille
Copy link
Member

hohwille commented Jul 9, 2024

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
Copy link
Member

image

@hohwille hohwille assigned jan-vcapgemini and unassigned mvomiero Aug 13, 2024
@hohwille hohwille added this to the release:2024.09.001 milestone Aug 13, 2024
@hohwille
Copy link
Member

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

@hohwille
Copy link
Member

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

@jan-vcapgemini
Copy link
Contributor

@mvomiero Also Java used for maven seems correct: image

Added new issue for this behaviour: #601

@jan-vcapgemini
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: ✅ Done
Development

No branches or pull requests

5 participants