def occurrences_goto(): if lisp.line_number_at_pos() < 1: lisp.forward_line(1 - lisp.line_number_at_pos()) lisp.end_of_line() end = lisp.point() lisp.beginning_of_line() line = lisp.buffer_substring_no_properties(lisp.point(), end) tokens = line.split() semicolon_tokens = line.split(":") project_root = lisp.rope_get_project_root() if tokens and semicolon_tokens: # Mark this line with an arrow lisp(''' (remove-overlays (point-min) (point-max)) (overlay-put (make-overlay (line-beginning-position) (line-end-position)) 'before-string (propertize "A" 'display '(left-fringe right-triangle))) ''') filename = project_root + "/" + semicolon_tokens[0] offset = int(tokens[-1]) resource = _interface._get_resource(filename) LispUtils().find_file(resource.real_path, other=True) lisp.goto_char(offset + 1)
def occurrences_goto_occurrence(self): self._check_project() start = lisp.line_beginning_position() end = lisp.line_end_position() line = lisp.buffer_substring_no_properties(start, end) tokens = line.split() if tokens: resource = self.project.get_resource(tokens[0]) offset = int(tokens[2]) lisp.find_file_other_window(resource.real_path) lisp.goto_char(offset + 1) lisp.switch_to_buffer_other_window('*rope-occurrences*')
def occurrences_goto(): if lisp.line_number_at_pos() < 3: lisp.forward_line(3 - lisp.line_number_at_pos()) lisp.end_of_line() end = lisp.point() lisp.beginning_of_line() line = lisp.buffer_substring_no_properties(lisp.point(), end) tokens = line.split() if tokens: filename = tokens[0] offset = int(tokens[-1]) resource = _interface._get_resource(filename) LispUtils().find_file(resource.real_path, other=True) lisp.goto_char(offset + 1)
def occurrences_goto_occurrence(): lisp.end_of_line() end = lisp.point() lisp.beginning_of_line() start = lisp.point() line = lisp.buffer_substring_no_properties(start, end) tokens = line.split() if tokens: filename = tokens[0] offset = int(tokens[-1]) resource = _interface._get_resource(filename) LispUtils().find_file(resource.real_path, other=True) lisp.goto_char(offset + 1) lisp.switch_to_buffer_other_window('*rope-occurrences*')