@@ -47,14 +47,21 @@ def get_errors_at_cursor(self, path, cursor):
4747 def handle_selection (self , idx ):
4848 if idx == - 1 :
4949 return
50- current_code_fix = self .all_code_fixes ['body' ][idx ]['changes' ][0 ]['textChanges' ]
51- start = self .view .text_point (
52- current_code_fix [0 ]['start' ]['line' ] - 1 , current_code_fix [0 ]['start' ]['offset' ] - 1 )
53- end = self .view .text_point (
54- current_code_fix [0 ]['end' ]['line' ] - 1 , current_code_fix [0 ]['end' ]['offset' ] - 1 )
55- text = current_code_fix [0 ]['newText' ]
56- self .view .run_command (
57- 'replace_text' , {'start' : start , 'end' : end , 'text' : text })
50+ all_changes = self .all_code_fixes ['body' ][idx ]['changes' ][0 ]['textChanges' ]
51+ for change in all_changes :
52+ text = change ['newText' ]
53+ if text [:1 ] == '\n ' :
54+ start = self .view .text_point (
55+ change ['start' ]['line' ] - 1 , change ['start' ]['offset' ])
56+ end = self .view .text_point (
57+ change ['end' ]['line' ] - 1 , change ['end' ]['offset' ])
58+ else :
59+ start = self .view .text_point (
60+ change ['start' ]['line' ] - 1 , change ['start' ]['offset' ] - 1 )
61+ end = self .view .text_point (
62+ change ['end' ]['line' ] - 1 , change ['end' ]['offset' ] - 1 )
63+ self .view .run_command (
64+ 'replace_text' , {'start' : start , 'end' : end , 'text' : text })
5865
5966 def run (self , text ):
6067 log .debug ("running TypescriptRequestCodeFixesCommand" )
0 commit comments