def handle_hierarchy_info(self, call_id, payload): self.env.logger.debug("handle_hierarchy_info: in {}".format(Pretty(payload))) classinfos = payload["inheritors"] if len(classinfos) == 0: sublime.set_timeout(bind(self.env.window.active_view().show_popup, "No implementations found.", sublime.HIDE_ON_MOUSE_MOVE), 0) return location_list = [] item_list = [] for cli in classinfos: pos = cli["sourcePosition"] file = pos["file"] line = pos["line"] path = encode_path(relative_path(self.env.project_root, str(file))) path_to_display = path if path is not None else str(file) file_line_info = file_and_line_info(path_to_display, line) name = cli.get("scalaName", cli["fqn"]) declAs = cli["declAs"]["typehint"] location_list.append((file, line)) item_list.append(["{} {}".format(declAs, name), file_line_info]) def open_item(index): if index == -1: return loc = location_list[index] self.env.editor.open_and_scroll(loc[0], loc[1]) sublime.set_timeout(bind(self.env.window.show_quick_panel, item_list, open_item, sublime.MONOSPACE_FONT), 0)
def handle_source_positions(self, call_id, payload): self.env.logger.debug("handle_source_positions: in {}".format(Pretty(payload))) sourcePositions = payload["positions"] if len(sourcePositions) == 0: sublime.set_timeout(bind(self.env.window.active_view().show_popup, "No usages found.", sublime.HIDE_ON_MOUSE_MOVE), 0) return location_list = [] item_list = [] for hint in sourcePositions: pos = hint["position"] file = pos["file"] line = pos["line"] path = encode_path(relative_path(self.env.project_root, str(file))) path_to_display = path if path is not None else str(file) file_line_info = file_and_line_info(path_to_display, line) location_list.append((file, line)) item_list.append([hint.get("preview", "no preview available"), file_line_info]) def open_item(index): if index == -1: return loc = location_list[index] self.env.editor.open_and_scroll(loc[0], loc[1]) sublime.set_timeout(bind(self.env.window.show_quick_panel, item_list, open_item, sublime.MONOSPACE_FONT), 0)
def handle_symbol_search(self, call_id, payload): """Handler for symbol search results""" self.env.logger.debug("handle_symbol_search: in {}".format(Pretty(payload))) item_list = [] location_list = [] syms = payload["syms"] for sym in syms: p = sym.get("pos") if p: location_list.append((p["file"], p["line"])) path = encode_path(relative_path(self.env.project_root, str(p["file"]))) path_to_display = path if path is not None else str(p["file"]) file_line_info = file_and_line_info(path_to_display, p["line"]) item_list.append(["{}".format(str(sym["name"]).replace("$", ".")), file_line_info]) def open_item(index): if index == -1: return loc = location_list[index] self.env.editor.open_and_scroll(loc[0], loc[1]) sublime.set_timeout(bind(self.env.window.show_quick_panel, item_list, open_item, sublime.MONOSPACE_FONT), 0)
def __program_runs_markup(program_runs): markup = "" # list program_runs with links to them with a short one line summary run_list_markup = "" for program_run_id in program_runs: run_list_markup += report.link_title(paths.relative_path(__report_url(program_runs), program_report.complete_report_url(program_run_id)), "Program_run " + program_run_id, __program_run_1line_summary(program_runs[program_run_id])) markup += report.section("Program runs", run_list_markup) return markup
def __program_runs_markup(program_runs): markup = "" # list program_runs with links to them with a short one line summary run_list_markup = "" for program_run_id in program_runs: run_list_markup += report.link_title( paths.relative_path( __report_url(program_runs), program_report.complete_report_url(program_run_id)), "Program_run " + program_run_id, __program_run_1line_summary(program_runs[program_run_id])) markup += report.section("Program runs", run_list_markup) return markup
def __page_markup(program_run_id, program_run): title = "Program report for %s" % (program_run_id) subtitle = program_run["run_description"] markup = report.header(title, subtitle, "Test config run reports (sets of scenario runs)") # add links to all test config reports run_list_markup = """<div class="config_runs">""" config_runs = program_run['config_runs'] for config_run_name, config_run in config_runs.items(): config_run_id = config_run["run_id"] link_title = "Config run (%s) %s" % (config_run_id, config_run_name) run_list_markup += report.link_title(paths.relative_path(complete_report_url(program_run_id), config_report.complete_report_url(config_run_id)), link_title, __config_run_1line_summary(config_run)) + "<br/>" run_list_markup += """</div>""" markup += run_list_markup markup += report.footer() return markup