`loadedType` keeps files loaded in the PC
The presentation compiler API is unclear on this point, but every `askLoadedType` keeps those files in the PC cache, and they get typechecked for each keystroke. Other methods, like `parsedEntered` take a boolean, `keepLoaded`, but that's not the case here.
Our code should be inspected for calls to this method, and make sure we don't increase the list of sources unnecessarily. In fact, any call to `askLoadedType` that is not done on "editor open" should make sure to unload the unit.
Our code should be inspected for calls to this method, and make sure we don't increase the list of sources unnecessarily. In fact, any call to `askLoadedType` that is not done on "editor open" should make sure to unload the unit.
- `ScalaSourceFileEditor.reportMatches` does it (seems like the worst offender)
- `ScalaIdeRefactoring.selection` does it too, but maybe it's only loading already loaded files (need to check)
Leave a comment
on 2012-12-12 06:02 *
By Mirko Stocker
There are indeed cases where
But, why doesn't
ScalaIdeRefactoring.selection
is used for files that are not open (in two cases: the move and the rename participant, which can be used when the file isn't open). But in both cases, a cleanup step is performed because an index over (potentially) more than one file is used during the refactoring. The cleanup handler removes all files ( global.removeUnitOf
) that were not loaded at the beginning of the refactoring (see FullProjectIndex
). So, I think we're safe.But, why doesn't
askLoadedType
take such a keepLoaded
parameter?
on 2013-01-08 05:22 *
By Iulian Dragos
This is a serious offense. We need to fix it in the compiler though, so let's hope for a fix in 2.10.1.
We can work around it in our code, though.
We can work around it in our code, though.
on 2013-11-05 03:51 *
By huitseeker
Version changed from 2.1.0-nightly-210 to 3.0.2-210
Assigned to set to huitseeker
on 2013-11-19 08:40 *
By huitseeker
on 2013-11-20 03:50 *
By Iulian Dragos
@Mirko, the `cleanup` is only performed if the refactoring itself was performed. If the refactoring is only checked for feasibility, it looks like those files stay around :)
In scala-ide:43f8f2bdf4bd99cc85da7f54a0f374be737d4b2f Makes (askL|l)oadedType(d)? unload new units after use by default
Fixes #1001388
on 2013-12-06 06:24 *
By Mirco Dotta
In scala-ide:a2d5394eea3f1ddbd7e6da7617a27cd260076fb9 Reverts logic for unloading units in askLoadedType
The loagic for handling loading/unloading of units in `askLoadedType` was moved
in the compiler side. See https://github.com/scala/scala/pull/3209. (Also,
mind that this commit should be merged together with the previously linked
scala PR).
This reverts most of the changes made in SHA:
43f8f2bdf4bd99cc85da7f54a0f374be737d4b2f
Re #1001388