// ĠCopyright Ġ 2 0 0 0 - 2 0 2 0 ĠJetBrains Ġs . r . o . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ package Ġcom . intellij . model . psi . impl Ċ Ċ import Ġcom . intellij . model . Symbol Resolve Result Ċ import Ġcom . intellij . model . psi . Implicit Reference Provider Ċ import Ġcom . intellij . model . psi . Psi Symbol Reference Ċ import Ġcom . intellij . model . psi . Psi Symbol Reference Hints Ċ import Ġcom . intellij . model . psi . Psi Symbol Reference Service Ċ import Ġcom . intellij . openapi . util . Text Range Ċ import Ġcom . intellij . psi . Psi Element Ċ import Ġcom . intellij . psi . Psi File Ċ import Ġcom . intellij . psi . util . elements Around Offset Up Ċ import Ġcom . intellij . psi . util . elements At Offset Up Ċ Ċ /** Ċ Ġ* Ġ@ return Ġcollection Ġof Ġ[ references ][ Psi Symbol Reference Service . get References ] Ġto Ġthe Ġright Ġof Ġgiven Ġ[ offset ] Ċ Ġ*/ Ċ fun ĠPsi File . references At ( offset : ĠInt ): ĠCollection < Psi Symbol Reference > Ġ{ ĊĠ Ġfor Ġ(( element , Ġoffset In Element ) Ġin Ġelements At Offset Up ( offset )) Ġ{ ĊĠĠĠ Ġval Ġreferences Ġ= Ġreferences In Element ( element , Ġoffset In Element ) ĊĠĠĠ Ġif Ġ( references . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠ Ġreturn Ġreferences ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĠ Ġreturn Ġempty List () Ċ } Ċ Ċ /** Ċ Ġ* Ġ@ return Ġcollection Ġof Ġ[ references ][ Psi Symbol Reference Service . get References ] Ċ Ġ* Ġand Ġ[ implicit Ġreferences ][ Implicit Reference Provider ] Ġaround Ġgiven Ġ[ offset ] Ċ Ġ*/ Ċ fun ĠPsi File . all References Around ( offset : ĠInt ): ĠCollection < Psi Symbol Reference > Ġ{ ĊĠ Ġfor Ġ(( element , Ġoffset In Element ) Ġin Ġelements Around Offset Up ( offset )) Ġ{ ĊĠĠĠ Ġval Ġreferences In Element Ġ= Ġall References In Element ( element , Ġoffset In Element ) ĊĠĠĠ Ġif Ġ( references In Element . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠ Ġreturn Ġreferences In Element ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĠ Ġreturn Ġempty List () Ċ } Ċ Ċ fun Ġall References In Element ( element : ĠPsi Element , Ġoffset In Element : ĠInt ): ĠCollection < Psi Symbol Reference > Ġ{ ĊĠ Ġval Ġreferences : ĠCollection < Psi Symbol Reference > Ġ= Ġreferences In Element ( element , Ġoffset In Element ) ĊĠ Ġif Ġ( references . isNotEmpty ()) Ġ{ ĊĠĠĠ Ġreturn Ġreferences ĊĠ Ġ} ĊĠ Ġval Ġimplicit Reference Ġ= Ġimplicit Reference ( element ) ĊĠ Ġif Ġ( implicit Reference Ġ!= Ġnull ) Ġ{ ĊĠĠĠ Ġreturn ĠlistOf ( implicit Reference ) ĊĠ Ġ} ĊĠ Ġreturn Ġempty List () Ċ } Ċ Ċ private Ġfun Ġreferences In Element ( element : ĠPsi Element , Ġoffset In Element : ĠInt ): ĠCollection < Psi Symbol Reference > Ġ{ ĊĠ Ġval Ġhints Ġ= ĠPsi Symbol Reference Hints . offset Hint ( offset In Element ) ĊĠ Ġreturn ĠPsi Symbol Reference Service . getService (). get References ( element , Ġhints ) Ċ } Ċ Ċ private Ġfun Ġimplicit Reference ( element : ĠPsi Element ): ĠPsi Symbol Reference ? Ġ{ ĊĠ Ġfor Ġ( handler Ġin ĠImp licit Reference Provider . EP _ NAME . extensions ) Ġ{ ĊĠĠĠ Ġval Ġresolved Ġ= Ġhandler . resolve As Reference ( element ) ĊĠĠĠ Ġif Ġ( resolved . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠ Ġreturn ĠIm mediate Psi Symbol Reference ( element , Ġresolved ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĠ Ġreturn Ġnull Ċ } Ċ Ċ private Ġclass ĠIm mediate Psi Symbol Reference ( ĊĠ Ġprivate Ġval Ġmy Element : ĠPsi Element , ĊĠ Ġprivate Ġval Ġmy Results : ĠCollection < Symbol Resolve Result > Ċ ) Ġ: ĠPsi Symbol Reference Ġ{ ĊĊĠ Ġprivate Ġval Ġmy Range Ġ= ĠText Range . from ( 0 , Ġelement . text Length ) ĊĊĠ Ġoverride Ġfun Ġget Element (): ĠPsi Element Ġ= Ġmy Element ĊĠ Ġoverride Ġfun Ġget Range In Element (): ĠText Range Ġ= Ġmy Range ĊĠ Ġoverride Ġfun Ġresolve Reference (): ĠCollection < Symbol Resolve Result > Ġ= Ġmy Results Ċ } Ċ