com.intellij.lang.surroundWith
Interface SurroundDescriptor


public interface SurroundDescriptor

Defines a code fragment type on which the Surround With action can be used for files in a custom language. All surround descriptors registered for a language are queried sequentially, and as soon as one is found that returns a non-empty list of elements from getElementsToSurround(com.intellij.psi.PsiFile, int, int), the user is prompted to choose a specific surrounder for that surround descriptor.

See Also:
Language.getSurroundDescriptors()

Method Summary
 PsiElement[] getElementsToSurround(PsiFile file, int startOffset, int endOffset)
          Returns the list of elements which will be included in the surrounded region for the specified selection in the specified file, or an empty array if no surrounders from this surround descriptor are applicable to the specified selection.
 Surrounder[] getSurrounders()
          Returns the list of surrounders (surround templates) which can be used for this code fragment type.
 

Method Detail

getElementsToSurround

@NotNull
PsiElement[] getElementsToSurround(PsiFile file,
                                           int startOffset,
                                           int endOffset)
Returns the list of elements which will be included in the surrounded region for the specified selection in the specified file, or an empty array if no surrounders from this surround descriptor are applicable to the specified selection.

Parameters:
file - the file where elements are to be surrounded.
startOffset - the selection start offset, with whitespaces skipped
endOffset - the selection end offset, with whitespaces skipped
Returns:
the elements to be surrounded, or an empty array if cannot surround

getSurrounders

@NotNull
Surrounder[] getSurrounders()
Returns the list of surrounders (surround templates) which can be used for this code fragment type.

Returns:
the list of surrounders.