@@ -285,6 +285,10 @@ def read_above(cls, view, position):
285
285
if not current_indentation == indentation_level - 1 :
286
286
break
287
287
288
+ # Keeping it simple, will not parse multiline decorators
289
+ if docstring_type is not None and not re .match (r'^\s*(\@)' , current_line_string ):
290
+ break
291
+
288
292
# Set to module, class, or function
289
293
if docstring_type is None :
290
294
if re .match (r'^\s*(class )' , current_line_string ):
@@ -328,23 +332,24 @@ def get_definition_contents(cls, view, position):
328
332
for current_line in read_next_line (view , position ):
329
333
# Not an empty line
330
334
current_line_string = view .substr (current_line ).rstrip ()
331
- if len (current_line_string ) is 0 :
335
+ if len (current_line_string ) == 0 :
332
336
continue
333
337
334
338
# Remove comments
335
339
if re .match (r'^\s*(\#)' , current_line_string ):
336
340
continue
337
341
338
- # If this is a module or a class, we only care about the lines on
339
- # the same indentation level for contextual reasons
340
342
current_indentation = view .indentation_level (current_line .end ())
341
- if not docstring_type == 'function' and not current_indentation == indentation_level :
342
- continue
343
343
344
- # Still within the same indentation level
344
+ # Exit if this has de-indented below the current level
345
345
if current_indentation < indentation_level :
346
346
break
347
347
348
+ # If this is a module or a class, we only care about the lines on
349
+ # the same indentation level for contextual reasons
350
+ if not docstring_type == 'function' and not current_indentation == indentation_level :
351
+ continue
352
+
348
353
definition += current_line_string + '\n '
349
354
350
355
return definition
0 commit comments