javaintellij-ideaidesettingsjgrasp

Do IDEs and compilers have different spacing for /t spacing? (JAVA on IntelliJ)


I am pretty new to programming and just started my computer science degree. In class I was given an assignment to create a pattern. They use jGRASP as their IDE in class while I use IntelliJ.

I created a pattern using the IntelliJ IDE to display "A E V" as displayed in the screen shot Code and output ScreenShot. I used blank spaces and /t to create the pattern. To check if my code looks the same as they want I took the .java file and ran it in another IDE called jGRASP. Now on jGRASP the spacing is all off jGRASP code and output ScreenShot. I couldn't figure out what caused it.

Do "/t" have different spacing for different IDEs? Or is there some setting that I need to change?


Solution

  • Finally found a solution. The problem was indeed with the tab spacing for the two IDEs. jGrasp by default uses 3 spacing tabs while IntelliJ for Java uses 4 spacing.

    On jGRASP if you click on settings > Font > CSD > Tab size : uncheck button to edit. jGrasp setup

    On IntelliJ it is a bit harder to change the tab since it creates a project when you first create it.

    Go to preferences > Editor > CodeStyle : uncheck editor config support. If this is kept checked then the editorconfig file in the package overrides the IDE settings. IntelliJ Code style setup

    CodeStyle dropdown> select file (Java) > Tabs and Indents > set Tab to 3 IntelliJ Java File setup Click apply.

    Finally go to CodeStyle again and click export on editorconfig to replace the file on the project.

    The EditorConfig file and the editorconfig support option is what causes Intellij to be more confusing.