code: def apply_refactor(self, call_id, payload):
          
          supported_refactorings = ["Rename", "InlineLocal", "AddImport", "OrganizeImports"]
  
          if payload["refactorType"]["typehint"] in supported_refactorings:
              diff_filepath = payload["diff"]
              path = self.editor.path()
              bname = os.path.basename(path)
              target = os.path.join(self.tmp_diff_folder, bname)
              reject_arg = "--reject-file={}.rej".format(target)
              backup_pref = "--prefix={}".format(self.tmp_diff_folder)
              # Patch utility is prepackaged or installed with vim
              cmd = ["patch", reject_arg, backup_pref, path, diff_filepath]
              failed = Popen(cmd, stdout=PIPE, stderr=PIPE).wait()
              if failed:
                  self.editor.message("failed_refactoring")
              # Update file and reload highlighting
              self.editor.edit(self.editor.path())
              self.editor.doautocmd('BufReadPre', 'BufRead', 'BufEnter')
docs: Apply a refactor depending on its type.