VSCode taking a very long time to format saved file

I have VSCode set to automatically format .jl files on save, and also to save files whenever focus changes.

Most of the time this works brilliantly, formatting my files in a flash. But occasionally formatting a file will take several minutes for a 150 line file.

Has anybody else encountered this?

I’m running the julia extension for VSCode version 1.38.2

system info:

julia> versioninfo()
Julia Version 1.8.3
Commit 0434deb161 (2022-11-14 20:14 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 32 × AMD Ryzen 9 7950X 16-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, znver3)
  Threads: 32 on 32 virtual cores
Environment:
  JULIA_EDITOR = code.cmd

Maybe it’s taking a while to load everytime the language server has to restart. What setting are you using to format files on save?

Here are my vscode settings:

{
    "terminal.integrated.commandsToSkipShell": [
        "language-julia.interrupt"
    ],

    "editor.fontFamily": "JuliaMono,Consolas,Courier New ,monospace",
    "editor.fontLigatures": "'zero', 'ss02', 'ss04', 'ss05', 'ss08'",
    "julia.symbolCacheDownload": true,
    "julia.enableTelemetry": true,
    "files.autoSave": "onFocusChange",
    "workbench.editor.enablePreview": false,
    "workbench.editor.revealIfOpen": true,
    "git.confirmSync": false,
    "editor.accessibilitySupport": "off",
    "terminal.integrated.tabs.enabled": false,
    "editor.minimap.enabled": false,
    "git.enableSmartCommit": true,
    "editor.wordWrap": "on",
    "editor.defaultFormatter": "julialang.language-julia",
    "editor.formatOnSave": true,
    "julia.NumThreads": "auto",
    "julia.useCustomSysimage": true
}

hey you got any solution ?

It magically got better on its own no idea which of the many improvements to the Julia ecosystem did the trick. On 1.10 this is not an issue.

Autoformatting is now essentially instant. In the time it takes me to move my cursor from the VSCode text editor window to the Julia REPL window the text is formatted, saved, the change is detected by Revise and everything is consistent. It’s great.