--- a/src/eric7/Utilities/ClassBrowsers/ClbrBaseClasses.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Utilities/ClassBrowsers/ClbrBaseClasses.py Tue Apr 09 14:27:03 2024 +0200 @@ -13,7 +13,7 @@ Class implementing the base of all class browser objects. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor @@ -21,15 +21,19 @@ @type str @param name name of this object @type str - @param file filename containing this object + @param file file name containing this object @type str - @param lineno linenumber of the object definition + @param lineno line number of the object definition @type int + @param col_offset column number of the object definition (defaults to 0) + @type int (optional) """ self.module = module self.name = name self.file = file self.lineno = lineno + self.coloffset = col_offset + self.endlineno = -1 # marker for "not set" def setEndLine(self, endLineNo): @@ -47,7 +51,7 @@ Class implementing the base of all complex class browser objects. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor @@ -55,12 +59,14 @@ @type str @param name name of this object @type str - @param file filename containing this object + @param file file name containing this object @type str - @param lineno linenumber of the object definition + @param lineno line number of the object definition @type int + @param col_offset column number of the object definition (defaults to 0) + @type int (optional) """ - _ClbrBase.__init__(self, module, name, file, lineno) + _ClbrBase.__init__(self, module, name, file, lineno, col_offset=col_offset) self.methods = {} self.attributes = {} self.classes = {} @@ -211,7 +217,7 @@ Class to represent an attribute. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor @@ -219,12 +225,14 @@ @type str @param name name of this attribute @type str - @param file filename containing this attribute + @param file file name containing this attribute @type str @param lineno line number of the attribute definition @type int + @param col_offset column number of the attribute definition (defaults to 0) + @type int (optional) """ - _ClbrBase.__init__(self, module, name, file, lineno) + _ClbrBase.__init__(self, module, name, file, lineno, col_offset=col_offset) self.linenos = [lineno] @@ -244,7 +252,7 @@ Class to represent a class. """ - def __init__(self, module, name, superClasses, file, lineno): + def __init__(self, module, name, superClasses, file, lineno, col_offset=0): """ Constructor @@ -254,12 +262,14 @@ @type str @param superClasses list of class names this class is inherited from @type list of str - @param file filename containing this class + @param file file name containing this class @type str @param lineno line number of the class definition @type int + @param col_offset column number of the class definition (defaults to 0) + @type int (optional) """ - ClbrBase.__init__(self, module, name, file, lineno) + ClbrBase.__init__(self, module, name, file, lineno, col_offset=col_offset) if superClasses is None: superClasses = [] self.super = superClasses @@ -270,7 +280,7 @@ Class to represent a module. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor @@ -278,12 +288,14 @@ @type str @param name name of this module @type str - @param file filename containing this module + @param file file name containing this module @type str @param lineno line number of the module definition @type int + @param col_offset column number of the module definition (defaults to 0) + @type int (optional) """ - ClbrBase.__init__(self, module, name, file, lineno) + ClbrBase.__init__(self, module, name, file, lineno, col_offset=col_offset) class Function(ClbrBase): @@ -301,6 +313,7 @@ name, file, lineno, + col_offset=0, signature="", separator=",", modifierType=General, @@ -313,10 +326,12 @@ @type str @param name name of this function @type str - @param file filename containing this function + @param file file name containing this function @type str @param lineno line number of the function definition @type int + @param col_offset column number of the function definition (defaults to 0) + @type int (optional) @param signature parameter list of the function @type str @param separator string separating the parameters of the function @@ -326,7 +341,7 @@ @param annotation function return annotation @type str """ - ClbrBase.__init__(self, module, name, file, lineno) + ClbrBase.__init__(self, module, name, file, lineno, col_offset=col_offset) self.parameters = [e.strip() for e in signature.split(separator)] self.modifier = modifierType self.annotation = annotation @@ -343,7 +358,7 @@ @param module name of the module containing this coding statement @type str - @param file filename containing this coding statement + @param file file name containing this coding statement @type str @param lineno line number of the coding definition @type int @@ -360,7 +375,7 @@ Class to represent an enum definition. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor @@ -368,9 +383,11 @@ @type str @param name name of this enum @type str - @param file filename containing this enum + @param file file name containing this enum @type str @param lineno line number of the enum definition @type int + @param col_offset column number of the enum definition (defaults to 0) + @type int (optional) """ - ClbrBase.__init__(self, module, name, file, lineno) + ClbrBase.__init__(self, module, name, file, lineno, col_offset=col_offset)