5858from tabulate import tabulate
5959
6060from hdl_checker import DEFAULT_LIBRARY , DEFAULT_PROJECT_FILE
61- from hdl_checker .core import HdlCheckerCore
6261from hdl_checker .config_generators .simple_finder import SimpleFinder
62+ from hdl_checker .core import HdlCheckerCore
6363from hdl_checker .diagnostics import CheckerDiagnostic , DiagType
6464from hdl_checker .exceptions import UnknownParameterError
6565from hdl_checker .parsers .elements .dependency_spec import (
@@ -310,7 +310,7 @@ def _getDiags(self, doc_uri: URI, is_saved: bool) -> Iterable[CheckerDiagnostic]
310310 def references (self , params : ReferenceParams ) -> Optional [List [Location ]]:
311311 "Tries to find references for the selected element"
312312
313- element = self ._getElementAtPosition (
313+ element = self .getElementAtPosition (
314314 Path (to_fs_path (params .textDocument .uri )), params .position
315315 )
316316
@@ -368,7 +368,7 @@ def _format(self, text):
368368
369369 return text
370370
371- def _getBuildSequenceForHover (self , path : Path ) -> str :
371+ def getBuildSequenceForHover (self , path : Path ) -> str :
372372 """
373373 Return a formatted text with the build sequence for the given path
374374 """
@@ -401,7 +401,7 @@ def _getBuildSequenceForHover(self, path: Path) -> str:
401401 ),
402402 )
403403
404- def _getDependencyInfoForHover (self , dependency ):
404+ def getDependencyInfoForHover (self , dependency ):
405405 # type: (BaseDependencySpec) -> str
406406 """
407407 Report which source defines a given dependency when the user hovers
@@ -421,7 +421,7 @@ def _getDependencyInfoForHover(self, dependency):
421421 return self ._format ('Path "{}"' .format (info ))
422422 return "Couldn't find a source defining '{}'" .format (dependency .name )
423423
424- def _getElementAtPosition (
424+ def getElementAtPosition (
425425 self , path : Path , position : Position
426426 ) -> Union [BaseDependencySpec , tAnyDesignUnit , None ]:
427427 """
@@ -441,9 +441,13 @@ def _getElementAtPosition(
441441 return None
442442
443443 def hover (self , params : HoverParams ) -> Optional [Hover ]:
444+ """
445+ Handles HoverParams and produces a Hover object if a known element is
446+ found within the given location
447+ """
444448 path = Path (to_fs_path (params .textDocument .uri ))
445449 # Check if the element under the cursor matches something we know
446- element = self ._getElementAtPosition (path , params .position )
450+ element = self .getElementAtPosition (path , params .position )
447451
448452 _logger .debug ("Getting info from %s" , element )
449453
@@ -453,9 +457,9 @@ def hover(self, params: HoverParams) -> Optional[Hover]:
453457 return None
454458
455459 if isinstance (element , (VerilogDesignUnit , VhdlDesignUnit )):
456- contents = self ._getBuildSequenceForHover (path )
460+ contents = self .getBuildSequenceForHover (path )
457461 else :
458- contents = self ._getDependencyInfoForHover (element )
462+ contents = self .getDependencyInfoForHover (element )
459463
460464 return Hover (
461465 contents = contents ,
@@ -473,7 +477,10 @@ def hover(self, params: HoverParams) -> Optional[Hover]:
473477 def definitions (
474478 self , params : TextDocumentPositionParams
475479 ) -> Optional [List [Location ]]:
476- dependency = self ._getElementAtPosition (
480+ """
481+ Returns known definitions found in the given location
482+ """
483+ dependency = self .getElementAtPosition (
477484 Path (to_fs_path (params .textDocument .uri )), params .position
478485 )
479486
0 commit comments