Invoke SurroundDescriptor without explicitly selected text

When I press Ctrl+Alt+T to surround an expression without having an explicit selection, IDEA always creates a selection of the whole line and gives me this text-range in com.intellij.lang.surroundWith.SurroundDescriptor#getElementsToSurround.

Question: is there any way to tell if surroundWith was invoked with or without selected text?

I would like to implement a different behavior for these two situations and I'm kind of lost here. I could check if the selection is a selection for the complete current line, but this fails if the user indeed selected the complete line.

Cheers
Patrick

0
1 comment
Avatar
Permanently deleted user

The correct way seems to be to implement and register

com.intellij.codeInsight.generation.surroundWith.SurroundWithRangeAdjuster

The 

adjustSurroundWithRange

method there gets the information if a selection was made.

0

Please sign in to leave a comment.