def rename_command(): project, file = eclim.get_context() # we cannot read the code from TM via stdin, as it will not have # the correct line endings when editing windows files (it will just have \n) #code = sys.stdin.read() # so we read from disk with open(os.environ["TM_FILEPATH"]) as f: code = f.read() pos = caret_position(code) identifier = current_identifier() pos = code.find(identifier, pos-len(identifier)) new_name = util.get_input(default=identifier,title="Enter new name") call_eclim(project, file, len(identifier), pos, new_name)
def go_to_definition_command(): project, file = eclim.get_context() # we cannot read the code from TM via stdin, as it will not have # the correct line endings when editing windows files (it will just have \n) #code = sys.stdin.read() # so we read from disk with open(os.environ["TM_FILEPATH"]) as f: code = f.read() pos = caret_position(code) identifier = current_identifier() pos = code.find(identifier, pos-len(identifier)) locations = call_eclim(project, file, pos, len(identifier)) locations = to_list(locations) if len(locations) == 1: go_to_location(locations[0])