JuliaFormatter for imports / using

e3c6
Sat, 16 Mar 2024 18:08:36 +0000
General Usage

I like writing my imports / using statements in the following style:

import CairoMakie
import CSV
import HDF5
import KernelDensity
import Makie
import StatsBase
using DataFrames: DataFrame
using Distributions: Gamma
using Distributions: logpdf
using Distributions: pdf
using Distributions: Poisson
using LinearAlgebra: Diagonal
using LinearAlgebra: eigen
using Makie: @L_str
using NaNStatistics: nanmean
using NaNStatistics: nansum
using ProgressMeter: @showprogress
using Random: bitrand
using Statistics: cor
using Statistics: mean
using Statistics: middle
using StatsBase: countmap

Thus, each using (for each symbol) and each import goes in its own line, and lines are sorted alphabetically.

Can I write a JuliaFormatter spec to help me enforce this style?

4 posts - 3 participants