def __init__(self, rx, tx) -> None: from robocorp_ls_core.pluginmanager import PluginManager from robotframework_ls.server_manager import ServerManager from robotframework_ls.ep_providers import DefaultConfigurationProvider from robotframework_ls.ep_providers import DefaultEndPointProvider from robotframework_ls.ep_providers import DefaultDirCacheProvider PythonLanguageServer.__init__(self, rx, tx) from robocorp_ls_core.cache import DirCache from robotframework_ls import robot_config home = robot_config.get_robotframework_ls_home() cache_dir = os.path.join(home, ".cache") log.debug(f"Cache dir: {cache_dir}") self._dir_cache = DirCache(cache_dir) self._pm = PluginManager() self._config_provider = DefaultConfigurationProvider(self.config) self._pm.set_instance(EPConfigurationProvider, self._config_provider) self._pm.set_instance(EPDirCacheProvider, DefaultDirCacheProvider(self._dir_cache)) self._pm.set_instance(EPEndPointProvider, DefaultEndPointProvider(self._endpoint)) self._server_manager = ServerManager(self._pm, language_server=self) self._lint_manager = _LintManager(self._server_manager, self._lsp_messages)
def __init__(self, read_stream, write_stream): from robocorp_code.rcc import Rcc from robocorp_ls_core.cache import DirCache from robocorp_ls_core.pluginmanager import PluginManager from robocorp_ls_core.ep_providers import DefaultConfigurationProvider from robocorp_ls_core.ep_providers import EPConfigurationProvider from robocorp_ls_core.ep_providers import DefaultDirCacheProvider from robocorp_ls_core.ep_providers import EPDirCacheProvider from robocorp_ls_core.ep_providers import DefaultEndPointProvider from robocorp_ls_core.ep_providers import EPEndPointProvider user_home = os.getenv("ROBOCORP_CODE_USER_HOME", None) if user_home is None: user_home = os.path.expanduser("~") cache_dir = os.path.join(user_home, ".robocorp-code", ".cache") log.debug(f"Cache dir: {cache_dir}") self._dir_cache = DirCache(cache_dir) self._rcc = Rcc(self) self._track = True self._local_list_robots_cache: Dict[ Path, CachedFileInfo[LocalRobotMetadataInfoDict]] = {} PythonLanguageServer.__init__(self, read_stream, write_stream) self._pm = PluginManager() self._config_provider = DefaultConfigurationProvider(self.config) self._pm.set_instance(EPConfigurationProvider, self._config_provider) self._pm.set_instance(EPDirCacheProvider, DefaultDirCacheProvider(self._dir_cache)) self._pm.set_instance(EPEndPointProvider, DefaultEndPointProvider(self._endpoint)) from robocorp_code.plugins.resolve_interpreter import register_plugins register_plugins(self._pm)
def __init__(self, read_from, write_to): PythonLanguageServer.__init__(self, read_from, write_to) from queue import Queue self._interpreter_queue: "Queue[IMessage]" = Queue() self._interpreter_initialized = False self._interpreter_disposed = False self._interpreter: Optional[IRobotFrameworkInterpreter] self._finished_event = threading.Event()
def __init__(self, read_from, write_to, libspec_manager=None): from robotframework_ls.impl.libspec_manager import LibspecManager if libspec_manager is None: try: libspec_manager = LibspecManager() except: log.exception("Unable to properly initialize the LibspecManager.") raise self.libspec_manager = libspec_manager PythonLanguageServer.__init__(self, read_from, write_to) self._version = None
def __init__(self, read_stream, write_stream): from robocorp_code.rcc import Rcc from robocorp_ls_core.cache import DirCache user_home = os.getenv("ROBOCORP_CODE_USER_HOME", None) if user_home is None: user_home = os.path.expanduser("~") cache_dir = os.path.join(user_home, ".robocorp-code", ".cache") log.debug(f"Cache dir: {cache_dir}") self._dir_cache = DirCache(cache_dir) self._rcc = Rcc(self) PythonLanguageServer.__init__(self, read_stream, write_stream)
def __init__( self, read_from, write_to, libspec_manager=None, observer: Optional[IFSObserver] = None, ): from robotframework_ls.impl.libspec_manager import LibspecManager if libspec_manager is None: try: libspec_manager = LibspecManager(observer=observer) except: log.exception("Unable to properly initialize the LibspecManager.") raise self.libspec_manager = libspec_manager PythonLanguageServer.__init__(self, read_from, write_to) self._version = None self._next_time = partial(next, itertools.count(0))
def __init__(self, rx, tx) -> None: from robocorp_ls_core.pluginmanager import PluginManager from robotframework_ls.rf_interactive_integration import _RfInterpretersManager from robotframework_ls.server_manager import ServerManager from robotframework_ls.ep_providers import DefaultConfigurationProvider from robotframework_ls.ep_providers import DefaultEndPointProvider from robotframework_ls.ep_providers import DefaultDirCacheProvider from robocorp_ls_core import watchdog_wrapper from robocorp_ls_core.remote_fs_observer_impl import RemoteFSObserver from robocorp_ls_core.options import Setup PythonLanguageServer.__init__(self, rx, tx) from robocorp_ls_core.cache import DirCache from robotframework_ls import robot_config home = robot_config.get_robotframework_ls_home() cache_dir = os.path.join(home, ".cache") log.debug(f"Cache dir: {cache_dir}") self._dir_cache = DirCache(cache_dir) self._pm = PluginManager() self._config_provider = DefaultConfigurationProvider(self.config) self._pm.set_instance(EPConfigurationProvider, self._config_provider) self._pm.set_instance(EPDirCacheProvider, DefaultDirCacheProvider(self._dir_cache)) self._pm.set_instance(EPEndPointProvider, DefaultEndPointProvider(self._endpoint)) self._rf_interpreters_manager = _RfInterpretersManager( self._endpoint, self._pm) watch_impl = os.environ.get("ROBOTFRAMEWORK_LS_WATCH_IMPL", "auto") if watch_impl not in ("watchdog", "fsnotify", "auto"): log.info( f"ROBOTFRAMEWORK_LS_WATCH_IMPL should be 'auto', 'watchdog' or 'fsnotify'. Found: {watch_impl} (falling back to auto)" ) watch_impl = "auto" if watch_impl == "auto": # In auto mode we use watchdog for windows and fsnotify (polling) # for Linux and Mac. The reason for that is that on Linux and Mac # if big folders are watched the system may complain due to the # lack of resources, which may prevent the extension from working # properly. # # If users want to opt-in, they can change to watchdog (and # ideally install it to their env to get native extensions). if sys.platform == "win32": watch_impl = "watchdog" else: watch_impl = "fsnotify" self._fs_observer = watchdog_wrapper.create_remote_observer( watch_impl, (".py", ".libspec", "robot", ".resource")) remote_observer = typing.cast(RemoteFSObserver, self._fs_observer) log_file = Setup.options.log_file if not isinstance(log_file, str): log_file = None remote_observer.start_server(log_file=log_file) self._server_manager = ServerManager(self._pm, language_server=self) self._lint_manager = _LintManager(self._server_manager, self._lsp_messages)
def __init__(self, read_stream, write_stream): from robocorp_code.rcc import Rcc from robocorp_ls_core.cache import DirCache from robocorp_ls_core.pluginmanager import PluginManager from robocorp_ls_core.ep_providers import DefaultConfigurationProvider from robocorp_ls_core.ep_providers import EPConfigurationProvider from robocorp_ls_core.ep_providers import DefaultDirCacheProvider from robocorp_ls_core.ep_providers import EPDirCacheProvider from robocorp_ls_core.ep_providers import DefaultEndPointProvider from robocorp_ls_core.ep_providers import EPEndPointProvider user_home = os.getenv("ROBOCORP_CODE_USER_HOME", None) if user_home is None: user_home = os.path.expanduser("~") cache_dir = os.path.join(user_home, ".robocorp-code", ".cache") log.debug(f"Cache dir: {cache_dir}") try: import ssl except: # This means that we won't be able to download drivers to # enable the creation of browser locators! # Let's print a bit more info. env_vars_info = "" related_vars = [ "LD_LIBRARY_PATH", "PATH", "DYLD_LIBRARY_PATH", "DYLD_FALLBACK_LIBRARY_PATH", ] for v in related_vars: libpath = os.environ.get(v, "") libpath = "\n ".join(libpath.split(os.pathsep)) if libpath: libpath = "\n " + libpath + "\n" else: libpath = " <not set>\n" env_vars_info += f"{v}: {libpath}" log.critical(f"SSL module could not be imported.\n" f"sys.executable: {sys.executable}\n" f"Env vars info: {env_vars_info}\n") self._dir_cache = DirCache(cache_dir) self._rcc = Rcc(self) self._track = True self._local_list_robots_cache: Dict[ Path, CachedFileInfo[LocalRobotMetadataInfoDict]] = {} PythonLanguageServer.__init__(self, read_stream, write_stream) self._pm = PluginManager() self._config_provider = DefaultConfigurationProvider(self.config) self._pm.set_instance(EPConfigurationProvider, self._config_provider) self._pm.set_instance(EPDirCacheProvider, DefaultDirCacheProvider(self._dir_cache)) self._pm.set_instance(EPEndPointProvider, DefaultEndPointProvider(self._endpoint)) from robocorp_code.plugins.resolve_interpreter import register_plugins register_plugins(self._pm) self._locators_in_thread_api = _LocatorsInThreadAPI()
def __init__(self, read_from, write_to): from typing import Optional from robocorp_code.locators.locator_webdriver import Webdriver PythonLanguageServer.__init__(self, read_from, write_to) self._webdriver: Optional[Webdriver] = None