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.

Bug 185764

Summary: Ability to obtain higher level snapshot
Product: editor Reporter: Marek Fukala <mfukala>
Component: Parsing & IndexingAssignee: Tomas Zezula <tzezula>
Status: NEW ---    
Severity: normal CC: jjancura
Priority: P2 Keywords: API
Version: 6.x   
Hardware: PC   
OS: Mac OS X   
Issue Type: ENHANCEMENT Exception Reporter:

Description Marek Fukala 2010-05-08 06:41:52 UTC
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.
Comment 1 Vitezslav Stejskal 2010-05-11 14:25:47 UTC
Could you point me to a task where this is needed or add some real world usecases? Thanks
Comment 2 Marek Fukala 2010-05-11 15:20:46 UTC
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.