File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -460,7 +460,8 @@ def apply_change(self, change):
460460end_col = change_range ["end" ]["character" ]
461461
462462# 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 ):
464465self ._source = self .source + text
465466return
466467
@@ -469,7 +470,7 @@ def apply_change(self, change):
469470# Iterate over the existing document until we hit the edit range,
470471# at which point we write the new text, then loop until we hit
471472# the end of the range and continue writing.
472- for i , line in enumerate (self . lines ):
473+ for i , line in enumerate (lines ):
473474if i < start_line :
474475new .write (line )
475476continue
@@ -493,10 +494,11 @@ def offset_at_position(self, position):
493494
494495def word_at_position (self , position ):
495496"""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 ):
497499return ""
498500
499- line = self . lines [position ["line" ]]
501+ line = lines [position ["line" ]]
500502i = position ["character" ]
501503# Split word in two
502504start = line [:i ]
You can’t perform that action at this time.
0 commit comments