Class Snapshot

Snapshot represents some part of text. Snapshot can be created from
Source representing file or document, or from some other Snapshot.
So Snapshot can represent some block of code written
in different language embedded inside some top level language too. It can contain
some generated parts of code that is not contained in the original
file. Snapshot is immutable. It means that Snapshot created
from document opened in editor contains some copy of original text.
You do not need to call Snapshot methods under
any locks, but on other hand Snapshot may not be up to date.

getTokenHierarchy

TokenHierarchy created by a Lexer registered
for this Snapshot's mime type or null if there is
no such Lexer.

Since:

1.1

getOriginalOffset

public int getOriginalOffset(int snapshotOffset)

Gets an offset in the original source corresponding to an offset in this snapshot.
The method will return -1 if snapshotOffset can't
be translated back to the original source. For example on the snapshotOffset
is in a "virtual" area of text. That is in a text generated by some EmbeddingProvider,
which has no representation in the top level source code.

Parameters:

snapshotOffset - The offset in this snapshot.

Returns:

The offset in the original source or -1.

getEmbeddedOffset

public int getEmbeddedOffset(int originalOffset)

Gets an offset in this snapshot corresponding to an offset
in the original source. The method can return -1 if originalOffset
points to an area in the original source, which is not part of this snapshot.