Skip to content

Optimize imports can change namespace require indentation #3093

@cmf

Description

@cmf

Problem

Running Optimize Imports or a reformat action that optimizes imports can change indentation in an already-correct namespace form, even when there are no imports or requires to optimize.

This is most visible with Clojure Standard Style formatting, and can leave the :require form progressively less indented after repeated runs.

Example

Starting from:

(ns auto-discovery.resolvers.domain-resolvers-test
  (:require [clojure.test :refer [deftest is]]
            [cyco-app.resolvers.domain-resolvers :as domain-resolvers]))

Running Optimize Imports/Reformat should leave the namespace form unchanged, but it can reduce the indentation of the second require clause. Repeating the operation can move it further left.

Expected behavior

If the namespace form is already optimized, Optimize Imports should not change its indentation.

Partial formatting of a namespace clause should preserve the same indentation that a full-file format would produce.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugMarks issues describing bugsreleased-eapMarks issues which have had the fixes released in an EAP build

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions