@@ -4,13 +4,13 @@ import PhpNamespace from 'common/PhpNamespace';
44import { AutoloadNamespaceIndexData } from 'indexer/autoload-namespace/AutoloadNamespaceIndexData' ;
55import AutoloadNamespaceIndexer from 'indexer/autoload-namespace/AutoloadNamespaceIndexer' ;
66import IndexManager from 'indexer/IndexManager' ;
7- import { Hover , HoverProvider , Position , TextDocument } from 'vscode' ;
7+ import { Hover , HoverProvider , Position , Range , TextDocument } from 'vscode' ;
88
99export default class XmlClasslikeHoverProvider implements HoverProvider {
1010 private namespaceIndexData : AutoloadNamespaceIndexData | undefined ;
1111
1212 public async provideHover ( document : TextDocument , position : Position ) : Promise < Hover | null > {
13- const range = document . getWordRangeAtPosition ( position , / " [ ^ " ] * " / ) ;
13+ const range = document . getWordRangeAtPosition ( position , / ( " [ ^ " ] + " ) | ( > [ ^ < ] + < ) / ) ;
1414
1515 if ( ! range ) {
1616 return null ;
@@ -24,7 +24,7 @@ export default class XmlClasslikeHoverProvider implements HoverProvider {
2424 return null ;
2525 }
2626
27- const potentialNamespace = word . replace ( / " / g, '' ) ;
27+ const potentialNamespace = word . replace ( / [ " < > ] / g, '' ) ;
2828
2929 const classUri = await namespaceIndexData . findClassByNamespace (
3030 PhpNamespace . fromString ( potentialNamespace )
@@ -37,7 +37,12 @@ export default class XmlClasslikeHoverProvider implements HoverProvider {
3737 const phpFile = await PhpDocumentParser . parseUri ( document , classUri ) ;
3838 const classLikeInfo = new ClasslikeInfo ( phpFile ) ;
3939
40- return new Hover ( classLikeInfo . getHover ( ) , range ) ;
40+ const rangeWithoutTags = new Range (
41+ range . start . with ( { character : range . start . character + 1 } ) ,
42+ range . end . with ( { character : range . end . character - 1 } )
43+ ) ;
44+
45+ return new Hover ( classLikeInfo . getHover ( ) , rangeWithoutTags ) ;
4146 }
4247
4348 private getNamespaceIndexData ( ) : AutoloadNamespaceIndexData | undefined {
0 commit comments