package Ġir . m md . intellij Dev . Action able . selection Ċ Ċ import Ġcom . intellij . openapi . action System . An Action Ċ import Ġcom . intellij . openapi . action System . An ActionEvent Ċ import Ġcom . intellij . openapi . editor . Caret Ċ import Ġcom . intellij . psi . Psi File Ċ import Ġir . m md . intellij Dev . Action able . util . ext .* Ċ Ċ abstract Ġclass ĠSelect Text Under Caret Action Ġ: ĠAn Action () Ġ{ Ċ ĉ abstract Ġfun Ġget Selection Range ( caret : ĠCare t , Ġpsi File : ĠPsi File ): ĠInt Range ? ĊĉĊ ĉ override Ġfun ĠactionPerformed ( e : ĠAn ActionEvent ) Ġ= Ġe . editor . all Care ts . forEach Ġ{ Ġcaret Ġ-> Ċĉ ĉ if Ġ( caret . has Selection ()) Ġreturn @ forEach Ċĉ ĉ caret . setSelection ( getSelection Range ( caret , Ġe . psi File ) Ġ?: Ġreturn @ forEach ) Ċ ĉ } ĊĉĊ ĉ override Ġfun Ġupdate ( e : ĠAn ActionEvent ) Ġ= Ġe . enable If Ġ{ Ġhas Project Ġand Ġhas Editor Ġ} Ċ } Ċ