@@ -460,7 +460,8 @@ def apply_change(self, change):
460
460
end_col = change_range ["end" ]["character" ]
461
461
462
462
# Check for an edit occuring at the very end of the file
463
- if start_line == len (self .lines ):
463
+ lines = self .lines
464
+ if start_line == len (lines ):
464
465
self ._source = self .source + text
465
466
return
466
467
@@ -469,7 +470,7 @@ def apply_change(self, change):
469
470
# Iterate over the existing document until we hit the edit range,
470
471
# at which point we write the new text, then loop until we hit
471
472
# the end of the range and continue writing.
472
- for i , line in enumerate (self . lines ):
473
+ for i , line in enumerate (lines ):
473
474
if i < start_line :
474
475
new .write (line )
475
476
continue
@@ -493,10 +494,11 @@ def offset_at_position(self, position):
493
494
494
495
def word_at_position (self , position ):
495
496
"""Get the word under the cursor returning the start and end positions."""
496
- if position ["line" ] >= len (self .lines ):
497
+ lines = self .lines
498
+ if position ["line" ] >= len (lines ):
497
499
return ""
498
500
499
- line = self . lines [position ["line" ]]
501
+ line = lines [position ["line" ]]
500
502
i = position ["character" ]
501
503
# Split word in two
502
504
start = line [:i ]
0 commit comments