This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
An instance of ParserResult is passed to user tasks. One may get the snapshot of the code bound to the task's mimetype or the underlying source. However in many cases the superordinate snapshot(s) or at least the top level language snapshot are needed. Currently it is not possible to get them and the only chance how to get the original document code is to read the content of the document got from the associated source. However the content may already be modified from the moment when the snapshot(s) for the task were created. I would appreciate something like snapshot.getSuperordinateSnapshot() or at least snapshot.getTopLevelSnapshot(). Please consider if this is feasible.
Could you point me to a task where this is needed or add some real world usecases? Thanks
To clarify the request a bit ... In general I have several usecases for being able to get the top level snapshot from one of the snapshots created from virtual sources. This is necessary since in ParserResultTask you have access just the to virtual source snapshot and as you are able to translate the virtual snapshots to the top level (document) there's a logical request for being able to also read the top level snapshot's content where the snapshot.getOriginalOffset(astOffset) points to. Accessing the source document is not possible since it is not locked during the top level snapshot creation and the call to your ParserResultTask. The ability to get parent't snapshot is not necessary especially if you are not able to conver the offsets to it.