metals icon indicating copy to clipboard operation
metals copied to clipboard

improvement: delete old compilation units from pc

Open kasiaMarek opened this issue 10 months ago • 3 comments

The idea is to delete compilation units from presentation compiler, that are no longer needed. The heuristic is as follows, we keep compilation units for the following paths:

  • last 5 focused - probably we want this to be a configurable number
  • modified since the last compilation
  • outlined

I'm also hoping this means we can delete uncached pc.

kasiaMarek avatar May 26 '25 10:05 kasiaMarek

last 5 focused

How will it work in editors which do not support custom Metals didFocus LSP extension? Would it track last 5 didOpen calls instead? :slightly_smiling_face:

filipwiech avatar May 26 '25 17:05 filipwiech

How will it work in editors which do not support custom Metals didFocus LSP extension? Would it track last 5 didOpen calls instead? 🙂

"Focus" is called here on:

  • didOpen
  • didChange (if didFocus is not supported)
  • didFocus
  • didClose (will focus on the previous opened)

kasiaMarek avatar May 27 '25 07:05 kasiaMarek

I changed this to use last N files for which compilation unit was requested instead of last N focused. It's both easier (no need for additional pc method) and should be more reliable.

kasiaMarek avatar May 28 '25 09:05 kasiaMarek