RIDE icon indicating copy to clipboard operation
RIDE copied to clipboard

"Find usage" function does not work at specific situation

Open Marks1 opened this issue 9 years ago • 3 comments

i defined a resource file, such as mykw.robot, and create my keyword "sayhello".

so in my test suite, i add mykw.robot as resource and create a test case, i call this keyword by mykw.sayhello

but when i right click the keyword "sayhello" in mykw.robot, RIDE shows no result can be found.

Please help investigate this case and fix it if possible.

Thanks

Marks1 avatar Aug 31 '16 23:08 Marks1

alright, i have already fox it, actually it is not a fix, just modify RIDE "Find Usage" function to search keyword long name instead of short name.

Marks1 avatar Sep 02 '16 02:09 Marks1

Shouldn't it search first by short name and then fallback to long name? Would you share your changes in code snippet or Pull Request?

Thanks

HelioGuilherme66 avatar Sep 02 '16 22:09 HelioGuilherme66

i did very little change to make this function works for me,.

Add a menu to search keyword with Resource Name. image

Code Changes

  1. Class "UserKeywordHandler" Add def OnFindUsagesWithResourceName(self, event): Usages(self.controller, self._tree.highlight, withResource=True).show()
  2. Class "_ActionHandler" Add def OnFindUsagesWithResourceName(self, event): pass
  3. Class "Usage" Change to `def init(self, controller, highlight, name=None, kw_info=None, withResource=False): #Lin if withResource: self._name = name or controller.info.longname else: # self._name = name or controller.name self._kw_info = kw_info self._controller = controller
    self._highlight = highlight
    self._dlg = self._usages_dialog(withResource)
    self._worker = Thread(target=self._run)
    self._dialog_closed = False

def _usages_dialog(self, withRes=False):
    #Lin
    if withRes:
        kwName = self._controller.info.longname
    else:
        kwName = self._controller.name
    if kwName == self._name:
        return UsagesDialogWithUserKwNavigation(self._name, self._highlight, self._controller)
    return UsagesDialog(self._name)`

Marks1 avatar Sep 05 '16 23:09 Marks1