def __init__(self, backend): super().__init__() # The backend, whose support functions we invoke: self.backend = backend # (Re-)Inspection state: self.cabal_to_load = Atomics.AtomicList() self.dirty_files = Atomics.AtomicDuck() self.dirty_paths = Atomics.AtomicList() self.busy = False
def load(self): settings = get_settings() self.check_preferences(settings) with self.wlock: for (attr, preference) in self.config_properties.items(): value = settings.get(preference) ## Uncomment to debug. Do NOT use logging because it causes a circular dependency. ## print('Settings.load: {0} = {1}'.format(attr, value)) setattr(self, attr, value) install_updater(settings, self, attr) self.changes = Atomics.AtomicDuck()
def __init__(self): self.language_pragmas = [] self.flags_pragmas = [] # cabal name => set of modules, where cabal name is 'cabal' for cabal or sandbox path # for cabal-devs self.module_completions = Atomics.AtomicDuck() # keywords self.keywords = ['do', 'case', 'of', 'let', 'in', 'data', 'instance', 'type', 'newtype', 'where', 'deriving', 'import', 'module'] self.current_filename = None # filename ⇒ preloaded completions + None ⇒ all completions self.cache = CompletionCache()
def __init__(self): # Property value holders: self._add_default_completions = False self._add_standard_dirs = True self._add_to_path = [] self._add_word_completions = False self._auto_build_mode = 'normal-then-warnings' self._auto_complete_imports = True self._auto_complete_language_pragmas = True self._auto_completion_popup = False self._backends = {} self._component_debug = [] self._enable_auto_build = False self._enable_auto_check = True self._enable_auto_lint = True self._enable_infer_types = True self._enable_hdocs = False self._ghc_opts = [] self._ghci_opts = [] self._haskell_build_tool = 'stack' self._hindent_options = [] self._hsdev_log_config = 'use silent' self._hsdev_log_level = 'warning' self._inspect_modules = True self._inspect_modified = False self._inspect_modified_idle = 1 self._lint_check_fly = False self._lint_check_fly_idle = 5 self._lint_opts = [] self._log = 1 self._prettify_on_save = False self._prettify_executable = 'stylish-haskell' self._show_error_window = True self._show_only = {'errors': True, 'warnings': True, 'hints': True} self._show_output_window = None self._stylish_options = [] self._unicode_symbol_info = True self._use_improved_syntax = True # Additional change callbacks to propagate: self.changes = Atomics.AtomicDuck() # Write-access lock self.wlock = threading.RLock()
def reset_cache(): global WHICH_CACHE WHICH_CACHE = Atomics.AtomicDuck()
import os import os.path import SublimeHaskell.internals.atomics as Atomics import SublimeHaskell.internals.utils as Utils def is_exe(fpath): return os.path.isfile(fpath) and os.access(fpath, os.X_OK) # Tool name -> executable path cache. Avoids probing the file system multiple times. WHICH_CACHE = Atomics.AtomicDuck() def which(cmd, env_path): cmd_is_list = isinstance(cmd, list) the_cmd = cmd[0] if cmd_is_list else cmd cmd_args = cmd[1:] if cmd_is_list else [] if os.path.isabs(the_cmd): return cmd with WHICH_CACHE as cache: cval = cache.get(the_cmd) if cval is not None: return [cval] + cmd_args if cmd_is_list else cval else: exe_exts = [''] if not Utils.is_windows() else ['.exe', '.cmd', '.bat']
def __init__(self, backend_mgr): # Primitive socket pool: self.backend_mgr = backend_mgr self.socket_pool = [] self.rcvr_event = threading.Event() self._request_map = Atomics.AtomicDuck()