Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ImportGraph/Imports/Pretty.lean
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ def comparePretty (i₁ i₂ : Import) : Ordering :=
(compare i₁.isExported i₂.isExported).swap -- `public import < import`
|>.then (compare i₁.importAll i₂.importAll) -- `import < import all`
|>.then (compare i₁.isMeta i₂.isMeta).swap -- `meta import < import`
|>.then (Name.cmp i₁.module i₂.module)
|>.then (compare i₁.module.toString i₂.module.toString) -- alphabetical
-- TODO: handle edge cases where `.` does not induce the same sort as "lexicographic by `Name`
-- component from the root" does (and prefer the latter).

/-- Considers imports with `public` to come first; then those without `all`; then those with
`meta`; then compares the modules alphabetically; then compares starting source position, c
Expand Down
14 changes: 14 additions & 0 deletions ImportGraphTest/NormImports.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ module

import all Lean.Syntax

import Lean.Widget
import Std.WP.Monad
import Std.Async
-- `Std.*` shouldn't come before `Lean.*` simply because it has fewer components
import Lean.Meta.Sym.Simp
import Lean.Server.FileWorker.WidgetRequests

public meta import ImportGraph.Tools.NormImports

public import ImportGraph.Imports.Pretty
Expand All @@ -24,6 +31,13 @@ warning: Imports can be normalized, but some comments could not be carried over.
public import ImportGraph.Imports.Pretty
public import ImportGraph.Shake.EnvExtension
⏎
-- `Std.*` shouldn't come before `Lean.*` simply because it has fewer components
import Lean.Meta.Sym.Simp
import Lean.Server.FileWorker.WidgetRequests
import Lean.Widget
import Std.Async
import Std.WP.Monad
⏎
import all Lean.Syntax
⏎
/-
Expand Down
Loading