Skip to content

Commit

Permalink
Fixed settings preloading
Browse files Browse the repository at this point in the history
  • Loading branch information
mvoidex committed Dec 3, 2012
1 parent b082c18 commit d146348
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
1 change: 0 additions & 1 deletion autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ def init_ghcmod_completions(self):

# Init LANGUAGE completions
autocompletion.language_completions = call_ghcmod_and_wait(['lang']).splitlines()
log("Reading LANGUAGE completions from ghc-mod")

# Init import module completion
autocompletion.module_completions = call_ghcmod_and_wait(['list']).splitlines()
Expand Down
19 changes: 10 additions & 9 deletions sublime_haskell_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@
# And then setting can be get from any thread with get_setting_async
# But setting must be loaded at least once from main thread
# Some settings are loaded only from secondary threads, so we loading them here for first time
class SublimeHaskellSettingsLoader(sublime_plugin.EventListener):
def __init__(self):
# Now we can use get_setting_async for 'add_to_PATH' safely
get_setting('add_to_PATH')
get_setting('use_cabal_dev')
get_setting('cabal_dev_sandbox')
get_setting('cabal_dev_sandbox_list')
get_setting('enable_auto_build')
get_setting('show_output_window')
def preload_settings():
# Now we can use get_setting_async for 'add_to_PATH' safely
get_setting('add_to_PATH')
get_setting('use_cabal_dev')
get_setting('cabal_dev_sandbox')
get_setting('cabal_dev_sandbox_list')
get_setting('enable_auto_build')
get_setting('show_output_window')

# SublimeHaskell settings dictionary
# used to retrieve it async from any thread
Expand Down Expand Up @@ -204,6 +203,8 @@ def get_setting(key, default=None):
get_settings().add_on_change(key, lambda: update_setting(key))
return result

preload_settings()

def update_setting(key):
"Updates setting as it was changed"
sublime_haskell_settings[key] = get_setting(key)
Expand Down

0 comments on commit d146348

Please sign in to comment.