VCS Julia Formatter error

Hi!

6 weeks ago everything was working fine. I came back to one of my projects. Before doing anything, I had 3 uncommitted changes: a change in todo.txt file, new pdf file, change in jupyter file. I committed the changes and got the following error:

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
Running Julia formatter...
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.6/Project.toml`
  No Changes to `~/.julia/environments/v1.6/Manifest.toml`
Formatting ./intro.jl
ERROR: MethodError: no method matching peekchar(::IOBuffer)
Closest candidates are:
  peekchar(!Matched::Tokenize.Lexers.Lexer) at /home/pgorski/.julia/packages/Tokenize/d4Pxs/src/lexer.jl:138
  peekchar(!Matched::CSTParser.ParseState) at /home/pgorski/.julia/packages/CSTParser/uIeiO/src/lexer.jl:69
Stacktrace:

(I’m not sure pasting veeery long stacktrace is a good idea, of course I may do it if needed.)

I realized that in the last month I added a new package, which resulted in some packages’ upgrades. So now, I ran ] update (not in the project that I tried to commit, but in the general registry). Following changes were made:

↑ JuliaFormatter v0.12.2 ⇒ v1.0.17
    Updating `~/.julia/environments/v1.6/Manifest.toml`
  [00ebfdb7] ↑ CSTParser v2.5.0 ⇒ v3.3.6
  [a80b9123] ↑ CommonMark v0.6.4 ⇒ v0.8.7
  [ffbed154] ↑ DocStringExtensions v0.8.6 ⇒ v0.9.3
  [e30172f5] - Documenter v0.25.5
  [b5f81e59] - IOCapture v0.1.1
  [98e50ef6] ↑ JuliaFormatter v0.12.2 ⇒ v1.0.17

Then, when I try to commit once again it takes a reeeeealy long time but finally the same error is returned with following code at the beginning:

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
Running Julia formatter...
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Resolving package versions...
    Updating `~/.julia/environments/v1.6/Project.toml`
  [98e50ef6] ↓ JuliaFormatter v1.0.17 ⇒ v0.12.2
    Updating `~/.julia/environments/v1.6/Manifest.toml`
  [00ebfdb7] ↓ CSTParser v3.3.6 ⇒ v2.5.0
  [a80b9123] ↓ CommonMark v0.8.7 ⇒ v0.6.4
  [ffbed154] ↓ DocStringExtensions v0.9.3 ⇒ v0.8.6
  [e30172f5] + Documenter v0.25.5
  [b5f81e59] + IOCapture v0.1.1
  [98e50ef6] ↓ JuliaFormatter v1.0.17 ⇒ v0.12.2

So clearly the project wants to use the old JuliaFormatter.

I’d be grateful for help, with what steps I should take.

I managed to solve it. I had the following line in the pre-commit git file
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.12.2"))'
which reverted the version of JuliaFormatter to the earlier one. Changing it to:
julia -e 'using Pkg; Pkg.add("JuliaFormatter")'
solved the issue.