Swift Linting and Error Highlighting#

Noctule integrates with SourceKit LSP and SwiftLint to highlight problems in Swift source code.

SwiftLint Support#

Violations returned by swiftlint lint are displayed in the editor. Violations which are placed on empty lines are highlighted at the end of such lines to make the warnings visible in the editor.

Configuring SwiftLint#

By default, SwiftLint is executed if a ‘.swiftlint.yml’ file is found in the context of a file and if a swiftlint executable in found in $PATH.

To change the path to swiftlint or to change when SwiftLint is executed you can update the settings at Preferences… → Languages & Frameworks → Swift (Noctule).

Fixing SwiftLint Violations#

Noctule provides a “Fix all” quick fix on violations, which can be corrected by swiftlint lint --fix. Executing this quick fix executes SwiftLint and updates the file with the updated content.

Format on Save Support#

If you prefer automatic corrections when you save Swift files, you can configure “Format on Save” to use SwiftLint. Please refer to the documentation about formatters to learn more about it.

SourceKit Support#

Syntax errors are handled mostly by SourceKit. They appear automatically when the SourceKit LSP server is launched in the background.

The highlighting can’t be configured or customized.