Inconsistent Behavior of Revise.jl in VSCode

Hi everyone,

I’m having serious trouble using Revise in VSCode. Sometimes it works perfectly, other times it doesn’t, and the behavior seems extremely inconsistent. I can’t figure out what’s going on.

I don’t even know where to start in explaining my issue, but I’ll try to be as clear as possible, though I realize this won’t be easy.

The setup:

  • I have created a module that contains utility functions for my work.
  • In the same directory, I have a script where I import this module.
  • Revise is automatically loaded in the REPL from startup.jl (I double-checked).
  • My expectation: when I modify an exported function in the module, the change should automatically be reflected when I call the function in the script.

The problem:

  • At first, everything works great! I edit the module, run the script in the REPL, and the changes are applied automatically. Fantastic!
  • Two days later, Revise randomly stops updating the imported functions. Or rather, sometimes it updates them once or twice, and then it just stops.
  • I haven’t changed anything in my setup—no updates, no modifications that could have affected Revise’s behavior.
  • Yes, all functions are properly exported from the module.
  • I tried forcing a reload with Revise.revise().
  • I tried activating the environment before anything else.
  • I searched this forum and tried every suggestion I found, but nothing worked.

I’m not looking for a specific bug fix since I can’t share my code. However, I’m curious if anyone has experienced something similar.

Any ideas? Thanks in advance!

I had a similar problem a long time ago. VSCode was configured to autosave files on focus change, and to automatically format files on save.

I would make a change to a function in VSCode and then immediately try to execute that changed function in the repl. Sometimes it would be updated and sometimes not.

The cause was slow formatting. The file wasn’t written till the formatting completed which, for some files for no obvious reason, could take quite a few seconds. Revise isn’t triggered until the file changes. By which time I would have already tried to execute the function and gotten the old rather than the new definition.

Maybe something similar is happening in your case.