File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -552,6 +552,18 @@ def lineno(self):
552
552
return self .location .lineno
553
553
return self .location .resource .read ().count ('\n ' , 0 , self .offset ) + 1
554
554
555
+ @property
556
+ def line_content (self ):
557
+ resource_contents = self .location .resource .read ()
558
+ # rfind returns -1 for start of string, so by adding 1 we get the start
559
+ # of the string. When a match is found we want to exclude the matching
560
+ # character so again we add 1.
561
+ line_start = resource_contents .rfind ("\n " , 0 , self .offset ) + 1
562
+ line_end = resource_contents .find ("\n " , self .offset )
563
+ if line_end < 0 :
564
+ line_end = len (resource_contents )
565
+ return resource_contents [line_start :line_end ]
566
+
555
567
556
568
class _CodeAssist (object ):
557
569
You can’t perform that action at this time.
0 commit comments