def update_server_list(self): for language in CONF.options(self.CONF_SECTION): config = {'status': self.STOPPED, 'config': self.get_option(language), 'instance': None} if language not in self.clients: self.clients[language] = config self.register_queue[language] = [] else: logger.debug( self.clients[language]['config'] != config['config']) current_config = self.clients[language]['config'] new_config = config['config'] configuration_diff = (current_config['configurations'] != new_config['configurations']) restart_diff = ['cmd', 'args', 'host', 'port', 'external'] restart = any([current_config[x] != new_config[x] for x in restart_diff]) if restart: if self.clients[language]['status'] == self.STOPPED: self.clients[language] = config elif self.clients[language]['status'] == self.RUNNING: self.close_client(language) self.clients[language] = config self.start_lsp_client(language) else: if configuration_diff: if self.clients[language]['status'] == self.RUNNING: client = self.clients[language]['instance'] client.send_plugin_configurations( new_config['configurations'])
def update_server_list(self): for language in CONF.options(self.CONF_SECTION): config = {'status': self.STOPPED, 'config': self.get_option(language), 'instance': None} if language not in self.clients: self.clients[language] = config self.register_queue[language] = [] else: debug_print( self.clients[language]['config'] != config['config']) current_config = self.clients[language]['config'] new_config = config['config'] configuration_diff = (current_config['configurations'] != new_config['configurations']) restart_diff = ['cmd', 'args', 'host', 'port', 'external'] restart = any([current_config[x] != new_config[x] for x in restart_diff]) if restart: if self.clients[language]['status'] == self.STOPPED: self.clients[language] = config elif self.clients[language]['status'] == self.RUNNING: self.close_client(language) self.clients[language] = config self.start_lsp_client(language) else: if configuration_diff: if self.clients[language]['status'] == self.RUNNING: client = self.clients[language]['instance'] client.send_plugin_configurations( new_config['configurations'])
def get_languages(self): """ Get the list of languages we need to start servers and create clients for. """ languages = ['python'] all_options = CONF.options(self.CONF_SECTION) for option in all_options: if option in [l.lower() for l in LSP_LANGUAGES]: languages.append(option) return languages
def __init__(self, parent): SpyderPluginWidget.__init__(self, parent) self.options_button.hide() self.lsp_plugins = {} self.clients = {} self.requests = {} self.register_queue = {} for option in CONF.options(self.CONF_SECTION): self.clients[option] = {'status': self.STOPPED, 'config': self.get_option(option), 'instance': None} self.register_queue[option] = []
def __init__(self, parent): SpyderPluginWidget.__init__(self, parent) self.options_button.hide() self.hide() self.lsp_plugins = {} self.clients = {} self.requests = {} self.register_queue = {} for option in CONF.options(self.CONF_SECTION): self.clients[option] = {'status': self.STOPPED, 'config': self.get_option(option), 'instance': None} self.register_queue[option] = []
def __init__(self, parent): QObject.__init__(self) self.main = parent self.lsp_plugins = {} self.clients = {} self.requests = {} self.register_queue = {} for option in CONF.options(self.CONF_SECTION): self.clients[option] = { 'status': self.STOPPED, 'config': CONF.get('lsp-server', option), 'instance': None } self.register_queue[option] = []
def __init__(self, parent): QObject.__init__(self) self.main = parent self.lsp_plugins = {} self.clients = {} self.requests = {} self.register_queue = {} # Get configurations for all LSP servers registered through # our Preferences self.configurations_for_servers = CONF.options('lsp-server') # Register languages to create clients for for language in self.configurations_for_servers: self.clients[language] = { 'status': self.STOPPED, 'config': CONF.get('lsp-server', language), 'instance': None } self.register_queue[language] = []
def iter_servers(): for option in CONF.options('lsp-server'): server = LSPServer(language=option) server.load() yield server
def iter_shortcuts(): """Iterate over keyboard shortcuts""" for option in CONF.options('shortcuts'): context, name = option.split("/", 1) yield context, name, get_shortcut(context, name)
def iter_servers(): for option in CONF.options('lsp-server'): if option in [l.lower() for l in LSP_LANGUAGES]: server = LSPServer(language=option) server.load() yield server