Skip to content

SJrX/systemdUnitFilePlugin

Repository files navigation

Unit File Support for systemd

Introduction

This plugin adds support for systemd unit files to IntelliJ.

Features

  • Syntax highlighting for unit files.
  • Auto-completion for:
    • Option names in a section
    • Boolean options
    • Octal options
    • Some other common options (e.g., KillMode=, Type=, Restart=)
    • Unit names in dependencies (e.g., WantedBy=, Requires)
  • Inspections
    • Invalid value for argument.
    • Shell syntax detected in Exec___= call.
    • Unknown option in section (ignoring those starting with X-)
    • Missing required key
  • Annotations
    • When the section name is invalid or used in the wrong file type
    • Whitespace after a line continuation \ character.
    • When a key has been deprecated.
  • Built-in documentation for options or section name (available when hitting CTRL+Q or F1 on Mac)

Usage

To create a file simply right-click on a folder and New > File, and enter a file name ending any of:

  • .automount
  • .device
  • .mount
  • .path
  • .service
  • .slice
  • .socket
  • .swap
  • .target
  • .timer

The file should then be associated with this plugin and the above features should work.

NOTE: .scope units are not configured via unit configuration files and so we don't support them.

Installation

This plugin is avaliable to install at the JetBrains Plugin Repository.

Contributors

Acknowledgements

License

  • Everything but the logo is GPLv2.
  • Logo is CC-BY-SA, as it is a derivative work from the brand repository.

Development Notes

System Requirements

Java 17

Manual Installation

Simply clone the repository, and run

./gradlew buildPlugin 

Then in IntelliJ navigate to

Plugins > Install Plugins From Disk > build/distributions/systemdUnitFilePlugin-X.X-SNAPSHOT.zip

Problems

Weird Fonts In Linux

When starting the development IDE if the fonts are poor add the following ENVIRONMENT VARIABLE to the run configuration

_JAVA_OPTIONS=-Dawt.useSystemAAFontSettings\=lcd -Dsun.java2d.renderer\=sun.java2d.marlin.MarlinRenderingEngine

Note: If you are using the Gradle runIde task it must be passed as an environment variable and not a VM option, because it gets executed in a different VM.

SLF4J Errors when running tests

If you see errors related to duplicate SLF4J class bindings available switch the JRE in use from the Default which references IntelliJ, to a native one.