src/eric7/Utilities/ClassBrowsers/rbclbr.py

branch
server
changeset 10592
2bada76be1a6
parent 10439
21c28b0f9e41
child 10596
ea35c92a3c7c
--- a/src/eric7/Utilities/ClassBrowsers/rbclbr.py	Mon Feb 19 15:34:54 2024 +0100
+++ b/src/eric7/Utilities/ClassBrowsers/rbclbr.py	Mon Feb 19 15:56:51 2024 +0100
@@ -17,6 +17,8 @@
 from PyQt6.QtCore import QRegularExpression
 
 from eric7 import Utilities
+from eric7.EricWidgets.EricApplication import ericApp
+from eric7.SystemUtilities import FileSystemUtilities
 from eric7.Utilities import ClassBrowsers
 
 from . import ClbrBaseClasses
@@ -277,31 +279,40 @@
         self.setPrivate()
 
 
-def readmodule_ex(module, path=None, isTypeFile=False):  # noqa: U100
+def readmodule_ex(module, searchPath=None, isTypeFile=False):  # noqa: U100
     """
     Read a Ruby file and return a dictionary of classes, functions and modules.
 
     @param module name of the Ruby file
     @type str
-    @param path path the file should be searched in
+    @param searchPath path the file should be searched in
     @type list of str
     @param isTypeFile flag indicating a file of this type
     @type bool
     @return the resulting dictionary
     @rtype dict
     """
-    # search the path for the file
-    f = None
-    fullpath = [] if path is None else path[:]
-    f, file, (suff, mode, type) = ClassBrowsers.find_module(module, fullpath)
-    if f:
-        f.close()
+    fsInterface = ericApp().getObject("EricServer").getServiceInterface("FileSystem")
+
+    if searchPath and FileSystemUtilities.isRemoteFileName(searchPath[0]):
+        type = ClassBrowsers.determineSourceType(module)
+        file = fsInterface.join(searchPath[0], module)
+    else:
+        # search the path for the module
+        fullpath = [] if searchPath is None else searchPath[:]
+        f, file, (suff, mode, type) = ClassBrowsers.find_module(module, fullpath)
+        if f:
+            f.close()
+
     if type not in SUPPORTED_TYPES:
         # not Ruby source, can't do anything with this module
         return {}
 
     try:
-        src = Utilities.readEncodedFile(file)[0]
+        if FileSystemUtilities.isRemoteFileName(file):
+            src = fsInterface.readEncodedFile(file)[0]
+        else:
+            src = Utilities.readEncodedFile(file)[0]
     except (OSError, UnicodeError):
         # can't do anything with this module
         return {}

eric ide

mercurial