Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Open the Extensions panel. Search for and install the Checkstyle for Java extension by ShengChen. Follow the configuration docs for the plugin. The important parts are: set the configuration file, by right clicking the checkstyle.xml file and select Set the Checkstyle Configuration File . You will need to use the command Checkstyle: Set the Checkstyle Version (Help>Show All Commands, or hit F1 on your keyboard) to manually set the Checkstyle version to 8.36.230. The extension will automatically download the required checkstyle jar file if it needs to. Other versions of Checkstyle jar are known to not work (8.18 and 9.2.1 as of this writing all currently throw errors). The DSpace pom.xml file pins the version of checkstyle to 8.30, we should use that version in VSCode.
  • You'll need to restart VSCode after adding the Checkstyle for Java extension
  • You will want to modify the setting for Java → Completion: Import Order (in the settings.json file for VScode): add this to your settings.json file: 

    "java.completion.importOrder": ["#","java","javax","com","org"],

  • Whenever you select an option to "organize imports", VSCode will incorrectly add a single blank line in your imports block, where our checkstyle configuration says it should not. The checkstyle plugin will alert you to this fact, and you can remove it manually. Unfortunately, VSCode does not currently support specifying the exact importOrder in the java.completion.importOrder that we require. But this is close enough.

...