Python sublime.KEEP_OPEN_ON_FOCUS_LOST Examples

The following are 5 code examples of sublime.KEEP_OPEN_ON_FOCUS_LOST(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sublime , or try the search function .
Example #1
Source File: references.py    From LSP with MIT License 6 votes vote down vote up
def show_quick_panel(self, references_by_file: Dict[str, List[Tuple[Point, str]]]) -> None:
        selected_index = -1
        current_file_path = self.view.file_name()
        self.reflist.clear()
        for file_path, references in references_by_file.items():
            for reference in references:
                point, line = reference
                item = ['{}:{}:{}'.format(self.get_relative_path(file_path), point.row + 1, point.col + 1), line]
                self.reflist.append(item)

                # pre-select a reference in the current file.
                if current_file_path == file_path and selected_index == -1:
                    selected_index = len(self.reflist) - 1

        flags = sublime.KEEP_OPEN_ON_FOCUS_LOST
        window = self.view.window()
        if window:
            window.show_quick_panel(
                self.reflist,
                self.on_ref_choice,
                flags,
                selected_index,
                self.on_ref_highlight
            ) 
Example #2
Source File: docphp.py    From docphp with MIT License 6 votes vote down vote up
def run(self, edit, languageName=None, set_fallback=False, is_init=False):
        view = self.view
        global currentView
        currentView = view

        if self.downloading:
            sublime.message_dialog('Another progress is working for checkout ' + self.downloading + '. Please try again later.')
            return

        self.languageList, index = getLanguageList(languageName)
        self.set_fallback = set_fallback

        if languageName:
            self.updateLanguage(index)
        else:
            currentView.window().show_quick_panel(self.languageList, self.updateLanguage, sublime.KEEP_OPEN_ON_FOCUS_LOST) 
Example #3
Source File: goto.py    From LSP with MIT License 5 votes vote down vote up
def handle_response(self, response: Any) -> None:
        window = self.view.window()
        view = self.view
        if window is None:
            return
        if response:
            # Save to jump back history.
            get_jump_history_for_view(view).push_selection(view)
            # TODO: DocumentLink support.
            if isinstance(response, dict):
                locations = [location_to_encoded_filename(response)]
            else:
                locations = process_response_list(response)
            if len(locations) == 1:
                open_location(window, locations[0])
            elif len(locations) > 1:
                window.show_quick_panel(
                    items=locations,
                    on_select=lambda x: select_entry(window, locations, x, view),
                    on_highlight=lambda x: highlight_entry(window, locations, x),
                    flags=sublime.KEEP_OPEN_ON_FOCUS_LOST)
            # TODO: can add region here.
        else:
            sublime.status_message("Empty response from language server, "
                                   "reverting to Sublime's built-in Goto Definition")
            window.run_command("goto_definition") 
Example #4
Source File: symbols.py    From LSP with MIT License 5 votes vote down vote up
def handle_response(self, response: Any) -> None:
        window = self.view.window()
        if window and isinstance(response, list) and len(response) > 0:
            self.old_regions = [sublime.Region(r.a, r.b) for r in self.view.sel()]
            self.is_first_selection = True
            window.show_quick_panel(
                self.process_symbols(response),
                self.on_symbol_selected,
                sublime.KEEP_OPEN_ON_FOCUS_LOST,
                0,
                self.on_highlighted)
            self.view.run_command("lsp_selection_clear") 
Example #5
Source File: add_flow_definition.py    From JavaScriptEnhancements with MIT License 5 votes vote down vote up
def search(self, package_name):

    self.window.status_message("Searching for '" + package_name + "' definitions...")
    node = NodeJS(check_local=True)
    result = node.execute("flow-typed", command_args=["search", package_name], is_from_bin=True)

    if result[0]:
      lines = result[1].encode('ascii', errors='ignore').decode("utf-8").strip().split("\n")
      linesNotDecoded = result[1].strip().split("\n")
      found_definations_flag = False
      for i in range(0, len(lines)):
        line = lines[i].strip()
        lineNotDecoded = linesNotDecoded[i].strip()

        if found_definations_flag and line:
   
          item = lineNotDecoded.split(b'\xe2\x94\x82'.decode("utf-8"))
          for j in range(0, len(item)):
            item[j] = item[j].encode('ascii', errors='ignore').decode("utf-8").strip()

          self.flow_typed_searched_items += [[item[0] + " " + item[1], "Flow version supported: " + item[2]]]

        elif line.startswith("Name") and line.endswith("Flow Version"):
          found_definations_flag = True

      if len(self.flow_typed_searched_items) > 0:
        self.window.show_quick_panel(self.flow_typed_searched_items, lambda index: sublime.set_timeout_async(lambda: self.install_definition(index)), sublime.KEEP_OPEN_ON_FOCUS_LOST)
      else:
        self.window.status_message("No definitions found, sorry!")