[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [Dltk-dev] Buffer Syncronization After IFile.setContents()
|
Hi Shelby,
One of the recent changes (last Friday I think) was introduction of the
IFile content caching.
On change event the modified file is removed from cache.
I have just committed the tests in the
org.eclipse.dltk.ruby.core.tests.resources.SourceCacheTests class.
The test illustrates that after IFile.setContents() and IFile.delete()
cache item is removed.
Another possible explanation is that you have active IBuffer for the
SourceModule, so getSource() returns the buffer contents and
modifications of the underlying resource are ignored.
You can temporary turn off the caching to check if it is related to your
test failures (comment out Map.put or use null instead of Map.get - in
the future we are going to make pluggable cache providers for testing
purposes, but at the moment the code modifications are necessary).
Could you please provide the code of the failing tests, so we can check
if it fails for us?
Regards,
Alex
Shelby Sanders wrote:
All,
Something changed in the last week which is causing an interesting
issue in our automated unit tests.
We use IFile.setContents() to update the content of a Ruby file, and
then run various tests which access the ISourceModule for that file.
This was all happily working and everything stayed in sync, until I
updated our code to use the latest sources from CVS HEAD as of yesterday.
Now, ISourceModule.getSource() still reports the old contents of the
file, even after all the events have fired and the index is ready.
Also, calling ISourceModule.makeConsistent() doesn't help, because
ISourceModule.isConsistent() returns true causing it to return without
doing anything.
I've temporarily worked around the issue by calling
ISourceModule.close() then ISourceModule.open() after changing the
file contents.
However, I'm guessing this is really just exposing a bigger issue. In
general, shouldn't ISourceModules detect when the underlying IFile
changes outside of the scope of DLTK, and update themselves accordingly?
Thank You,
Shelby Sanders
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev