Beispiel #1
0
def theme_data():
	settings = sublime.load_settings(pref)
	themr = sublime.load_settings('themr.sublime-settings')
	packages = os.listdir(sublime.packages_path())
	ignored_packages = settings.get('ignored_packages')
	themes = []
	commands = []

	for package in (package for package in packages if package.startswith('Theme -') and package not in ignored_packages):
		theme = os.listdir(os.path.join(sublime.packages_path(), package))

		for filename in (filenames for filenames in theme if filenames.endswith('.sublime-theme')):
			themes.append(filename)

	themr.set('discovered_themes', themes)
	sublime.save_settings('themr.sublime-settings')

	for theme in themes:
		commands.append({'caption': 'Themr: ' + os.path.splitext(theme)[0], 'command': 'switch_theme', 'args': { 't': theme }})

	commands.append({'caption': 'Themr: Reload themes', 'command': 'reload_themes'})
	c = open(os.path.join(sublime.packages_path(), 'Themr', 'Default.sublime-commands'), 'w')
	c.write(json.dumps(commands, indent = 4) + '\n')
	c.close

	sublime.status_message('Themr: ' + str(len(themes)) + ' theme(s) found.')
Beispiel #2
0
def update_language_extensions(ext_added):
    """
    Process the extensions for each language
    """

    for lang, exts in ext_added.items():
        updated = False
        settings_file = lang + ".sublime-settings"
        lang_settings = sublime.load_settings(settings_file)
        extension_file = sublime.load_settings(EXT_SETTINGS)
        lang_ext = set(lang_settings.get("extensions", []))
        apsy_ext = set(extension_file.get(lang, []))

        for ext in list(exts):
            if ext not in lang_ext:
                # Append extension to current sublime extension list
                lang_ext.add(ext)
                # Track which extensions were specifically added by apply syntax
                apsy_ext.add(ext)
                updated = True

        if updated:
            devlog("============" + settings_file + "============")
            devlog("Updated Extensions: %s" % str(lang_ext))
            lang_settings.set("extensions", list(lang_ext))
            if len(apsy_ext):
                extension_file.set(lang, sorted(list(apsy_ext)))
            else:
                extension_file.erase(sorted(lang))
            sublime.save_settings(settings_file)
            sublime.save_settings(EXT_SETTINGS)
Beispiel #3
0
 def api_key(self):
   settings = sublime.load_settings('Thesaurus.sublime-settings')
   if settings.get("api_key"):
     return settings.get("api_key")
   else:
     settings = sublime.load_settings('Preferences.sublime-settings')
     return settings.get("thesaurus_api_key")
 def apply_setting(self, name):
     """Directly apply the provided theme or color scheme."""
     if any(sublime.find_resources(os.path.basename(name))):
         sublime.load_settings(self.PREFS_FILE).set(self.KEY, name)
         sublime.save_settings(self.PREFS_FILE)
     else:
         sublime.status_message(name + " does not exist!")
Beispiel #5
0
    def run_command(self, command, callback=None, show_status=True,
            filter_empty_args=True, no_save=False, **kwargs):
        if filter_empty_args:
            command = [arg for arg in command if arg]
        if 'working_dir' not in kwargs:
            kwargs[str('working_dir')] = str(self.get_working_dir())
        if 'fallback_encoding' not in kwargs and self.active_view() and self.active_view().settings().get('fallback_encoding'):
            kwargs[str('fallback_encoding')] = str(self.active_view().settings().get('fallback_encoding').rpartition('(')[2].rpartition(')')[0])

        s = sublime.load_settings("Git.sublime-settings")
        if s.get('save_first') and self.active_view() and self.active_view().is_dirty() and not no_save:
            self.active_view().run_command('save')
        if command[0] == 'git':
            us = sublime.load_settings('Preferences.sublime-settings')
            if s.get('git_command') or us.get('git_binary'):
                command[0] = s.get('git_command') or us.get('git_binary')
            elif GIT:
                command[0] = GIT
        if command[0] == 'gitk' and s.get('gitk_command'):
            if s.get('gitk_command'):
                command[0] = s.get('gitk_command')
            elif GITK:
                command[0] = GITK
        if command[0] == 'git' and command[1] == 'flow' and s.get('git_flow_command'):
            command[0] = s.get('git_flow_command')
            del(command[1])
        if not callback:
            callback = self.generic_done

        thread = CommandThread(command, callback, **kwargs)
        thread.start()

        if show_status:
            message = kwargs.get('status_message', False) or ' '.join(command)
            sublime.status_message(message)
Beispiel #6
0
def plugin_loaded():
    global settings

    settings = sublime.load_settings('LocalHistory.sublime-settings')
    settings.add_on_change('reload', sublime.load_settings('LocalHistory.sublime-settings'))

    status_msg('Target directory: "' + get_history_root() + '"')
    def run(self, edit, key=None):
        assert(not key is None)
        list_to_map = lambda seq: dict([(el["from"], el["to"]) for el in seq])
        if not hasattr(self, "_settings"):
            default_settings = sublime.load_settings("MetaSubstitution.sublime-settings")
            user_settings = sublime.load_settings("Preferences.sublime-settings")
            meta_substitutions = list_to_map(default_settings.get("meta_substitutions", []))
            meta_substitutions.update(list_to_map(user_settings.get("meta_substitutions", [])))
            setattr(self, "_settings", meta_substitutions)
        selection = self.view.sel()
        stored_cursor_positions = []
        substitute_for = None

        for k, v in self._settings.items():
            if k == key:
                substitute_for = v
        
        if substitute_for is None:
            return
        
        for subselection in selection:
            if subselection.empty():
                self.view.insert(edit, subselection.a, substitute_for)
            else:
                stored_cursor_positions.append(sublime.Region(subselection.begin() + 1))
                self.view.replace(edit, subselection, substitute_for)

        if stored_cursor_positions:
            selection.clear()
            for cursor_position in new_cursor_positions:
                selection.add(cursor_position)
Beispiel #8
0
def init_plugin():
    """Setup plugin variables and objects."""

    global sh_thread
    global sh_settings

    # Preferences Settings
    pref_settings = sublime.load_settings('Preferences.sublime-settings')

    # Setup settings
    sh_settings = sublime.load_settings('scope_hunter.sublime-settings')

    # Setup color scheme
    init_color_scheme()

    pref_settings.clear_on_change('scopehunter_reload')
    pref_settings.add_on_change('scopehunter_reload', reinit_plugin)

    sh_settings.clear_on_change('reload')

    # Setup thread
    if sh_thread is not None:
        # This shouldn't be needed, but just in case
        sh_thread.kill()
    sh_thread = ShThread()
    sh_thread.start()
	def init(self, isST2):
		self.isST2 = isST2
		self.projects_index_cache = {}
		self.index_cache_location = os.path.join(
			sublime.packages_path(),
			'User',
			'AngularJS.cache'
		)
		self.is_indexing = False
		self.attributes = []
		self.settings = sublime.load_settings('AngularJS-sublime-package.sublime-settings')
		self.settings_completions = sublime.load_settings('AngularJS-completions.sublime-settings')
		self.settings_js_completions = sublime.load_settings('AngularJS-js-completions.sublime-settings')

		try:
			json_data = open(self.index_cache_location, 'r').read()
			self.projects_index_cache = json.loads(json_data)
			json_data.close()
		except:
			pass

		self.settings_completions.add_on_change('core_attribute_list', self.process_attributes)
		self.settings_completions.add_on_change('extended_attribute_list', self.process_attributes)
		self.settings_completions.add_on_change('AngularUI_attribute_list', self.process_attributes)
		self.settings.add_on_change('enable_data_prefix', self.process_attributes)
		self.settings.add_on_change('enable_AngularUI_directives', self.process_attributes)
		self.process_attributes()
    def init(self):
        if self.inited:
            return

        sets = sublime.load_settings(settings_file)
        if get_version() < 3000:
            if sets.get("ha_style").startswith("underlined"):
                sets.set("ha_style", "outlined")
            if sets.get("icons"):
                sets.set("icons", False)
            if sets.get("icons_all"):
                sets.set("icons_all", False)
            sublime.save_settings(settings_file)

        for k in ["enabled", "style", "ha_style", "icons_all", "icons", "color_formats"]:
            self.settings[k] = sets.get(k)

        self.settings["color_fmts"] = list(map(get_format, self.settings["color_formats"]))

        sets.clear_on_change("ColorHighlighter")
        sets.add_on_change("ColorHighlighter", lambda: self.on_ch_settings_change())

        sets = sublime.load_settings("Preferences.sublime-settings")

        self.settings["color_scheme"] = sets.get("color_scheme")

        sets.clear_on_change("ColorHighlighter")
        sets.add_on_change("ColorHighlighter", lambda: self.on_g_settings_change())

        self.inited = True

        for w in sublime.windows():
            for v in w.views():
                self.init_view(v)
 def is_enabled(self, save_to_file=False):
     enabled = True
     if save_to_file and not bool(sublime.load_settings(self.settings).get("enable_save_to_file_commands", False)):
         enabled = False
     elif not save_to_file and not bool(sublime.load_settings(self.settings).get("enable_show_in_buffer_commands", False)):
         enabled = False
     return enabled
Beispiel #12
0
    def run(self):
        """Run command."""

        errors = False
        full_name = path.join(FuzzyFileNavCommand.cwd, FuzzyPanelText.get_content())
        FuzzyPanelText.clear_content()
        multi_file = (
            bool(sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_after_action", False)) and
            "delete" not in sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_exceptions", [])
        )

        if not multi_file:
            self.window.run_command("hide_overlay")
            FuzzyFileNavCommand.reset()
        else:
            FuzzyFileNavCommand.fuzzy_reload = True

        if sublime.ok_cancel_dialog("Delete %s?\n\nWarning: this is permanent!" % full_name):
            try:
                if path.isdir(full_name):
                    shutil.rmtree(full_name)
                else:
                    os.remove(full_name)
            except Exception:
                errors = True
                error("Error deleting %d!" % full_name)

        if multi_file:
            if errors:
                FuzzyFileNavCommand.reset()
            else:
                self.window.run_command("hide_overlay")
                self.window.run_command("fuzzy_file_nav", {"start": FuzzyFileNavCommand.cwd})
Beispiel #13
0
    def run(self):
        """Run command."""

        errors = False
        full_name = path.join(FuzzyFileNavCommand.cwd, FuzzyPanelText.get_content())
        FuzzyPanelText.clear_content()
        multi_file = (
            bool(sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_after_action", False)) and
            "mkdir" not in sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_exceptions", [])
        )
        if not multi_file:
            self.window.run_command("hide_overlay")
            FuzzyFileNavCommand.reset()
        else:
            FuzzyFileNavCommand.fuzzy_reload = True

        try:
            os.makedirs(full_name)
        except Exception:
            errors = True
            error("Could not create %d!" % full_name)

        if multi_file:
            if errors:
                FuzzyFileNavCommand.reset()
            else:
                self.window.run_command("hide_overlay")
                self.window.run_command("fuzzy_file_nav", {"start": FuzzyFileNavCommand.cwd})
Beispiel #14
0
    def run(self):
        """Run the command."""

        file_name = FuzzyPanelText.get_content()
        FuzzyPanelText.clear_content()
        proj_file = self.window.project_file_name()
        data = self.window.project_data()
        if data is None:
            data = {}
        new_folder = path.join(FuzzyFileNavCommand.cwd, file_name)
        if not path.exists(new_folder):
            return
        if not path.isdir(new_folder):
            new_folder = path.dirname(new_folder)
        if "folders" not in data:
            data["folders"] = []
        already_exists = self.compare(data["folders"], new_folder, proj_file)

        if not already_exists:
            true_path = get_path_true_case(new_folder)
            if true_path is not None:
                if (
                    sublime.load_settings(FUZZY_SETTINGS).get("add_folder_to_project_relative", False) and
                    proj_file is not None
                ):
                    new_folder = path.relpath(new_folder, path.dirname(proj_file))
                follow_sym = sublime.load_settings(FUZZY_SETTINGS).get("add_folder_to_project_follow_symlink", True)
                data["folders"].append({'follow_symlinks': follow_sym, 'path': new_folder})
                self.window.set_project_data(data)
            else:
                error("Couldn't resolve case for path %s!" % new_folder)
Beispiel #15
0
    def paste(self):
        """Paste files."""

        errors = False
        self.to_path = path.join(FuzzyFileNavCommand.cwd, FuzzyPanelText.get_content())
        FuzzyPanelText.clear_content()
        move = (self.cls.action == "cut")
        self.from_path = self.cls.clips[0]
        self.cls.clear_entries()
        multi_file = (
            bool(sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_after_action", False)) and
            "paste" not in sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_exceptions", [])
        )

        if not multi_file:
            self.window.run_command("hide_overlay")
            FuzzyFileNavCommand.reset()
        else:
            FuzzyFileNavCommand.fuzzy_reload = True

        if path.exists(self.from_path):
            if path.isdir(self.from_path):
                self.action = shutil.copytree if not bool(move) else shutil.move
                errors = self.dir_copy()
            else:
                self.action = shutil.copyfile if not bool(move) else shutil.move
                errors = self.file_copy()
        if multi_file:
            if errors:
                FuzzyFileNavCommand.reset()
            else:
                self.window.run_command("hide_overlay")
                self.window.run_command("fuzzy_file_nav", {"start": FuzzyFileNavCommand.cwd})
Beispiel #16
0
    def run(self, edit, option):
        s = sublime.load_settings('phpfmt.sublime-settings')
        options = {
            "autocomplete":"autocomplete",
            "autoimport":"dependency autoimport",
            "enable_auto_align":"auto align",
            "format_on_save":"format on save",
            "psr1":"PSR1",
            "psr1_naming":"PSR1 Class and Method Naming",
            "psr2":"PSR2",
            "readini":"look for .php.tools.ini",
            "smart_linebreak_after_curly":"smart linebreak after curly",
            "skip_if_ini_missing":"skip if ini file is missing",
            "visibility_order":"visibility order",
            "yoda":"yoda mode",
        }
        s = sublime.load_settings('phpfmt.sublime-settings')
        value = s.get(option, False)

        if value:
            s.set(option, False)
            msg = "phpfmt: "+options[option]+" disabled"
            print_debug(msg)
            sublime.status_message(msg)
        else:
            s.set(option, True)
            msg = "phpfmt: "+options[option]+" enabled"
            print_debug(msg)
            sublime.status_message(msg)

        sublime.save_settings('phpfmt.sublime-settings')
    def run(self, edit):
        sortorder = ''
        self.settings = sublime.load_settings("CSScomb.sublime-settings")
        if not self.settings.has('sorter'):
            self.settings.set('sorter', 'local')
        sublime.save_settings('CSScomb.sublime-settings')

        if self.settings.get('custom_sort_order') == True:
            self.order_settings = sublime.load_settings("Order.sublime-settings")
            sortorder = self.order_settings.get('sort_order')
            sublime.status_message('Sorting with custom sort order...')

        selections = self.get_selections()
        SorterCall = self.get_sorter()

        threads = []
        for sel in selections:
            selbody = self.view.substr(sel)
            selbody = selbody.encode('utf-8')
            thread = SorterCall(sel, selbody, sortorder)

            threads.append(thread)
            thread.start()

        self.handle_threads(edit, threads, selections, offset=0, i=0)
Beispiel #18
0
def do(renderer, keymap_counter):
	default_packages = ['Default']
	user_packages = ['User']
	global_settings = sublime.load_settings("Preferences.sublime-settings")
	ignored_packages = global_settings.get("ignored_packages", [])
	package_control_settings = sublime.load_settings("Package Control.sublime-settings")
	installed_packages = package_control_settings.get("installed_packages", [])
	if len(installed_packages) == 0:
		includes = ('.sublime-package')
		os_packages = []
		for (root, dirs, files) in os.walk(sublime.installed_packages_path()):
			for file in files:
				if file.endswith(includes):
					os_packages.append(file.replace(includes, ''))
		for (root, dirs, files) in os.walk(sublime.packages_path()):
			for dir in dirs:
				os_packages.append(dir)
			break	# just the top level
		installed_packages = []
		[installed_packages.append(package) for package in os_packages if package not in installed_packages]

	diff = lambda l1,l2: [x for x in l1 if x not in l2]
	active_packages = diff( default_packages + installed_packages + user_packages, ignored_packages)

	keymapsExtractor = KeymapsExtractor(active_packages, keymap_counter)
	worker_thread = WorkerThread(keymapsExtractor, renderer)
	worker_thread.start()
	ThreadProgress(worker_thread, 'Searching ' + MY_NAME, 'Done.', keymap_counter)
    def load_settings(self):
        self.settings = sublime.load_settings('GitGutter.sublime-settings')
        self.user_settings = sublime.load_settings(
            'Preferences.sublime-settings')

        # Git Binary Setting
        self.git_binary_path = 'git'
        git_binary = self.user_settings.get(
            'git_binary') or self.settings.get('git_binary')
        if git_binary:
            self.git_binary_path = git_binary

        # Ignore White Space Setting
        self.ignore_whitespace = self.settings.get('ignore_whitespace')
        if self.ignore_whitespace == 'all':
            self.ignore_whitespace = '-w'
        elif self.ignore_whitespace == 'eol':
            self.ignore_whitespace = '--ignore-space-at-eol'
        else:
            self.ignore_whitespace = ''

        # Patience Setting
        self.patience_switch = ''
        patience = self.settings.get('patience')
        if patience:
            self.patience_switch = '--patience'

        # Untracked files
        self.show_untracked = self.settings.get(
            'show_markers_on_untracked_file')
Beispiel #20
0
def plugin_loaded():
	global settings_base
	global Pref

	settings = sublime.load_settings('Word Highlight.sublime-settings')
	if int(sublime.version()) >= 2174:
		settings_base = sublime.load_settings('Preferences.sublime-settings')
	else:
		settings_base = sublime.load_settings('Base File.sublime-settings')

	class Pref:
		def load(self):
			Pref.color_scope_name                                    = settings.get('color_scope_name', "comment")
			Pref.highlight_delay                                     = settings.get('highlight_delay', 0)
			Pref.case_sensitive                                      = (not bool(settings.get('case_sensitive', True))) * sublime.IGNORECASE
			Pref.draw_outlined                                       = bool(settings.get('draw_outlined', True)) * sublime.DRAW_OUTLINED
			Pref.mark_occurrences_on_gutter                          = bool(settings.get('mark_occurrences_on_gutter', False))
			Pref.icon_type_on_gutter                                 = settings.get("icon_type_on_gutter", "dot")
			Pref.highlight_when_selection_is_empty                   = bool(settings.get('highlight_when_selection_is_empty', False))
			Pref.highlight_word_under_cursor_when_selection_is_empty = bool(settings.get('highlight_word_under_cursor_when_selection_is_empty', False))
			Pref.word_separators                                     = settings_base.get('word_separators')
			Pref.show_status_bar_message                             = bool(settings.get('show_word_highlight_status_bar_message', True))
			Pref.file_size_limit                                     = int(settings.get('file_size_limit', 4194304))
			Pref.when_file_size_limit_search_this_num_of_characters  = int(settings.get('when_file_size_limit_search_this_num_of_characters', 20000))
			Pref.timing                                              = time.time()
			Pref.enabled                                             = True
			Pref.prev_selections                                     = None
			Pref.prev_regions                                        = None

	Pref = Pref()
	Pref.load()

	settings.add_on_change('reload', lambda:Pref.load())
	settings_base.add_on_change('wordhighlight-reload', lambda:Pref.load())
    def run(self):
        mm_response = None
        args = self.get_arguments()
        global_config.debug('>>> running thread arguments on next line!')
        global_config.debug(args)
        if self.debug_mode or 'darwin' not in sys.platform:
            print(self.payload)
            python_path = sublime.load_settings('mavensmate.sublime-settings').get('mm_python_location')

            if 'darwin' in sys.platform or sublime.load_settings('mavensmate.sublime-settings').get('mm_debug_location') != None:
                mm_loc = sublime.load_settings('mavensmate.sublime-settings').get('mm_debug_location')
            else:
                mm_loc = os.path.join(config.mm_dir,"mm","mm.py")
            #p = subprocess.Popen("{0} {1} {2}".format(python_path, pipes.quote(mm_loc), args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
        
            if 'linux' in sys.platform or 'darwin' in sys.platform:
                #osx, linux
                p = subprocess.Popen('\'{0}\' \'{1}\' {2}'.format(python_path, mm_loc, self.get_arguments()), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
            else:
                #windows
                if sublime.load_settings('mavensmate.sublime-settings').get('mm_debug_mode', False):
                    #user wishes to use system python
                    python_path = sublime.load_settings('mavensmate.sublime-settings').get('mm_python_location')
                    p = subprocess.Popen('"{0}" "{1}" {2}'.format(python_path, mm_loc, self.get_arguments()), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
                else:
                    python_path = os.path.join(os.environ["ProgramFiles"],"MavensMate","App","python.exe")
                    if not os.path.isfile(python_path):
                        python_path = python_path.replace("Program Files", "Program Files (x86)")
                    p = subprocess.Popen('"{0}" -E "{1}" {2}'.format(python_path, mm_loc, self.get_arguments()), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)

            #process = subprocess.Popen("{0} {1} {2}".format(python_path, pipes.quote(mm_loc), self.get_arguments()), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
        else:
            p = subprocess.Popen("{0} {1}".format(pipes.quote(self.mm_path), args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
        #print("PAYLOAD: ",self.payload)
        #print("PAYLOAD TYPE: ",type(self.payload))
        if self.payload != None and type(self.payload) is str:
            self.payload = self.payload.encode('utf-8')
        p.stdin.write(self.payload)
        p.stdin.close()
        if p.stdout is not None: 
            mm_response = p.stdout.readlines()
        elif p.stderr is not None:
            mm_response = p.stderr.readlines()
        
        #response_body = '\n'.join(mm_response.decode('utf-8'))
        strs = []
        for line in mm_response:
            strs.append(line.decode('utf-8'))   
        response_body = '\n'.join(strs)

        global_config.debug('>>> got a response body')
        global_config.debug(response_body)

        if '--html' not in args:
            try:
                valid_json = json.loads(response_body)
            except:
                response_body = generate_error_response(response_body)

        self.response = response_body
def on_loaded():
    global hostplatform_settings, host_settings, platform_settings, user_settings
    global _plugin_loaded

    if _plugin_loaded:
        debug.log("Plugin already loaded")
        return

    hostplatform_settings = sublime.load_settings(
        get_hostplatform_settings_filename())

    host_settings = sublime.load_settings(
        get_host_settings_filename())

    platform_settings = sublime.load_settings(
        get_platform_settings_filename())

    user_settings = sublime.load_settings(
        get_settings_filename())

    on_debug_change()

    debug.log('Registering Settings Callbacks')

    hostplatform_settings.add_on_change('debug', on_debug_change)
    user_settings.add_on_change('debug', on_debug_change)
    platform_settings.add_on_change('debug', on_debug_change)
    host_settings.add_on_change('debug', on_debug_change)

    if _on_plugin_loaded_callbacks is not None:
        for callback in _on_plugin_loaded_callbacks:
            callback()

    _plugin_loaded = True
    del _on_plugin_loaded_callbacks[:]
Beispiel #23
0
def post_match(view, name, style, first, second, center, bfr, threshold):
    """
    Given two brackets, determine if they contain a tag.

    Decide whether it is an opening or closing, and then
    find its respective closing or opening.
    """

    # We need to know the mode during the highlight event, so track the last mode.
    global last_mode
    left, right = first, second
    threshold = [0, len(bfr)] if threshold is None else threshold
    bh_settings = sublime.load_settings("bh_core.sublime-settings")
    tag_settings = sublime.load_settings("bh_tag.sublime-settings")
    tag_mode = get_tag_mode(view, tag_settings.get("tag_mode", []))
    tag_style = tag_settings.get("tag_style", {}).get(tag_mode, '?')
    last_mode = tag_mode
    outside_adj = bh_settings.get("bracket_outside_adjacent", False)

    bracket_style = style

    if first is not None and tag_mode is not None:
        matcher = TagMatch(view, bfr, threshold, first, second, center, outside_adj, tag_mode)
        left, right = matcher.match()
        if not matcher.no_tag:
            bracket_style = tag_style

    return left, right, bracket_style
Beispiel #24
0
    def run(self):
        error = False
        full_name = path.join(FuzzyFileNavCommand.cwd, FuzzyPanelText.get_content())
        FuzzyPanelText.clear_content()
        multi_file = (
            bool(sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_after_action", False)) and
            "mkfile" not in sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_exceptions", [])
        )
        if not multi_file:
            self.window.run_command("hide_overlay")
            FuzzyFileNavCommand.reset()
        else:
            FuzzyFileNavCommand.fuzzy_reload = True

        try:
            with open(full_name, "a"):
                pass
            self.window.open_file(full_name)
        except:
            error = True
            sublime.error_message("Could not create %s!" % full_name)

        if multi_file:
            if error:
                FuzzyFileNavCommand.reset()
            else:
                self.window.run_command("fuzzy_file_nav", {"start": FuzzyFileNavCommand.cwd})
    def run(self, edit, parser='markdown', target='browser'):
        settings = sublime.load_settings('MarkdownPreview.sublime-settings')

        # backup parser+target for later saves
        self.view.settings().set('parser', parser)
        self.view.settings().set('target', target)

        html, body = compiler.run(self.view, parser)

        if target in ['disk', 'browser']:
            # check if LiveReload ST2 extension installed and add its script to the resulting HTML
            livereload_installed = ('LiveReload' in os.listdir(sublime.packages_path()))
            # build the html
            if livereload_installed:
                port = sublime.load_settings('LiveReload.sublime-settings').get('port', 35729)
                html += '<script>document.write(\'<script src="http://\' + (location.host || \'localhost\').split(\':\')[0] + \':%d/livereload.js?snipver=1"></\' + \'script>\')</script>' % port
            # update output html file
            tmp_fullpath = getTempMarkdownPreviewPath(self.view)
            save_utf8(tmp_fullpath, html)
            # now opens in browser if needed
            if target == 'browser':
                self.__class__.open_in_browser(tmp_fullpath, settings.get('browser', 'default'))
        elif target == 'sublime':
            # create a new buffer and paste the output HTML
            embed_css = settings.get('embed_css_for_sublime_output', True)
            if embed_css:
                new_scratch_view(self.view.window(), html)
            else:
                new_scratch_view(self.view.window(), body)
            sublime.status_message('Markdown preview launched in sublime')
        elif target == 'clipboard':
            # clipboard copy the full HTML
            sublime.set_clipboard(html)
            sublime.status_message('Markdown export copied to clipboard')
def _toggle_debug_mode(setting=None):
    if setting is not None:
        if isinstance(setting, tuple):
            settings_name = setting[0] + '.sublime-settings'
            preferences = load_settings(settings_name)
            setting = setting[1]
        else:
            settings_name = 'Preferences.sublime-settings'
            preferences = load_settings(settings_name)

        flag = not preferences.get(setting)
        if flag:
            preferences.set(setting, True)
        else:
            preferences.erase(setting)

        save_settings(settings_name)

        return flag
    else:
        global _DEBUG
        _DEBUG = not _DEBUG
        _set_debug_mode(_DEBUG)

        return _DEBUG
Beispiel #27
0
 def load_settings(self):
     self.settings = sublime.load_settings('GitGutter.sublime-settings')
     self.user_settings = sublime.load_settings('Preferences.sublime-settings')
     self.git_binary_path = 'git'
     git_binary = self.user_settings.get('git_binary') or self.settings.get('git_binary')
     if git_binary:
         self.git_binary_path = git_binary
Beispiel #28
0
    def __init__(self, window):
        RdioCommand.__init__(self,window)

        self.just_opened = True
        self.typed = ""
        self.last_content = ""

        self.suggestion_selector = "→"
        self.selected_suggestion_index = None

        self.input_view_width = 0

        # Two way producer / consumer
        self.last_sent_query = ""
        self.query_q = Queue()
        self.suggestion_q = Queue()
        self.suggestions = []
        self.END_OF_SUGGESTIONS = ''
        self.STOP_THREAD_MESSAGE = 'END_OF_THREAD_TIME' # passed as a query to stop the thread

        settings = sublime.load_settings("Preferences.sublime-settings")
        self.user_tab_complete_value = settings.get("tab_completion", None)

        rdio_settings = sublime.load_settings("Rdio.sublime-settings")
        self.enable_search_suggestions = rdio_settings.get("enable_search_suggestions")
    def update_url_highlights(self, view, force):
        settings = sublime.load_settings(UrlHighlighter.SETTINGS_FILENAME)
        if not force and not settings.get('auto_find_urls', True):
            return

        should_highlight_urls = settings.get('highlight_urls', True)
        max_url_limit = settings.get('max_url_limit', UrlHighlighter.DEFAULT_MAX_URLS)
        file_folder_regex = settings.get('file_folder_regex', '')
        combined_regex = '({})|({})'.format(UrlHighlighter.URL_REGEX, file_folder_regex) if file_folder_regex else UrlHighlighter.URL_REGEX

        if view.id() in UrlHighlighter.ignored_views:
            return

        urls = view.find_all(combined_regex)

        # Avoid slowdowns for views with too much URLs
        if len(urls) > max_url_limit:
            print("UrlHighlighter: ignoring view with %u URLs" % len(urls))
            UrlHighlighter.ignored_views.append(view.id())
            return

        UrlHighlighter.urls_for_view[view.id()] = urls

        should_highlight_urls = sublime.load_settings(UrlHighlighter.SETTINGS_FILENAME).get('highlight_urls', True)
        if (should_highlight_urls):
            self.highlight_urls(view, urls)
Beispiel #30
0
	def run(self, version="default"):
		AutoHotKeyExePath = ""

		AutoHotKeyExePath = sublime.load_settings("AutoHotkey.sublime-settings").get("AutoHotKeyExePath")[version]

		# Also try old settings format where path is stored as a named-key in a dictionary.
		if not os.path.isfile(AutoHotKeyExePath):
			print("AutoHotkey ahkexec.py run(): Trying default version, because could not find AutoHotKeyExePath for version=" + str(version))
			AutoHotKeyExePath = sublime.load_settings("AutoHotkey.sublime-settings").get("AutoHotKeyExePath")["default"]

		# Also try old settings format where path is stored as a list of paths
		if not os.path.isfile(AutoHotKeyExePath):
			print("AutoHotkey ahkexec.py run(): Trying string list (without dictionary key-pairs old format), because could not find AutoHotKeyExePath for version=" + str(version) + " or version=default")
			AutoHotKeyExePathList = sublime.load_settings("AutoHotkey.sublime-settings").get("AutoHotKeyExePath")
			for AutoHotKeyExePath in AutoHotKeyExePathList:
				if os.path.isfile(AutoHotKeyExePath):
					print ("Not valid AutoHotKeyExePath=" + AutoHotKeyExePath)
					break
				else:
					print ("Not valid AutoHotKeyExePath=" + AutoHotKeyExePath)
					continue

		if not os.path.isfile(AutoHotKeyExePath):
			print(r"ERROR: AutoHotkey ahkexec.py run(): Could not find AutoHotKeyExePath. Please create a Data\Packages\User\AutoHotkey.sublime-settings file to specify your custom path.")
		else:
			filepath = self.window.active_view().file_name()
			cmd = [AutoHotKeyExePath, "/ErrorStdOut", filepath]
			regex = "(.*) \(([0-9]*)\)() : ==> (.*)"
			self.window.run_command("exec", {"cmd": cmd, "file_regex": regex})
Beispiel #31
0
def get_ignored_packages():
    __settings = sublime.load_settings(SETTINGS_USER_FILE)
    custom_packages = []
    for ignored_package in __settings.get('ignore_packages'):
        custom_packages.append(ignored_package)
    return custom_packages
Beispiel #32
0
 def run(self, edit):
     prefs = sublime.load_settings('Preferences.sublime-settings')
     prefs.set('tailwind_completion_enabled', False)
     prefs.save_settings('Preferences.sublime-settings')
Beispiel #33
0
def is_installed_by_package_control():
    """Check if installed by package control."""

    settings = sublime.load_settings('Package Control.sublime-settings')
    return str(__pc_name__ in set(settings.get('installed_packages', [])))
    def disable_packages(self, packages, type='upgrade'):
        """
        Disables one or more packages before installing or upgrading to prevent
        errors where Sublime Text tries to read files that no longer exist, or
        read a half-written file.

        :param packages:
            The string package name, or an array of strings

        :param type:
            The type of operation that caused the package to be disabled:
             - "upgrade"
             - "remove"
             - "install"
             - "disable"
             - "loader"
        """

        if not isinstance(packages, list):
            packages = [packages]

        disabled = []

        settings = sublime.load_settings(preferences_filename())
        ignored = load_list_setting(settings, 'ignored_packages')

        pc_settings = sublime.load_settings(pc_settings_filename())
        in_process = load_list_setting(pc_settings, 'in_process_packages')

        self.old_syntaxes = {}
        self.old_color_schemes = {}

        for package in packages:
            if not package in ignored:
                in_process.append(package)
                ignored.append(package)
                disabled.append(package)

            if type in ['upgrade', 'remove']:
                version = self.get_version(package)
                tracker_type = 'pre_upgrade' if type == 'upgrade' else type
                events.add(tracker_type, package, version)

            for window in sublime.windows():
                for view in window.views():
                    view_settings = view.settings()
                    syntax = view_settings.get('syntax')
                    if syntax.find('Packages/' + package + '/') != -1:
                        if package not in self.old_syntaxes:
                            self.old_syntaxes[package] = []
                        self.old_syntaxes[package].append([view, syntax])
                        view_settings.set('syntax', 'Packages/Text/Plain text.tmLanguage')
                    scheme = view_settings.get('color_scheme')
                    if scheme.find('Packages/' + package + '/') != -1:
                        if package not in self.old_color_schemes:
                            self.old_color_schemes[package] = []
                        self.old_color_schemes[package].append([view, scheme])
                        view_settings.set('color_scheme', 'Packages/Color Scheme - Default/Monokai.tmTheme')

            # Change the color scheme before disabling the package containing it
            if settings.get('color_scheme').find('Packages/' + package + '/') != -1:
                self.old_color_scheme_package = package
                self.old_color_scheme = settings.get('color_scheme')
                settings.set('color_scheme', 'Packages/Color Scheme - Default/Monokai.tmTheme')

            # Change the theme before disabling the package containing it
            if package_file_exists(package, settings.get('theme')):
                self.old_theme_package = package
                self.old_theme = settings.get('theme')
                settings.set('theme', 'Default.sublime-theme')

        # We don't mark a package as in-process when disabling it, otherwise
        # it automatically gets re-enabled the next time Sublime Text starts
        if type != 'disable':
            pc_settings.set('in_process_packages', in_process)
            sublime.save_settings(pc_settings_filename())

        settings.set('ignored_packages', ignored)
        sublime.save_settings(preferences_filename())

        return disabled
    def reenable_package(self, package, type='upgrade'):
        """
        Re-enables a package after it has been installed or upgraded

        :param package:
            The string package name

        :param type:
            The type of operation that caused the package to be re-enabled:
             - "upgrade"
             - "remove"
             - "install"
             - "enable"
             - "loader"
        """

        settings = sublime.load_settings(preferences_filename())
        ignored = load_list_setting(settings, 'ignored_packages')

        if package in ignored:

            if type in ['install', 'upgrade']:
                version = self.get_version(package)
                tracker_type = 'post_upgrade' if type == 'upgrade' else type
                events.add(tracker_type, package, version)
                events.clear(tracker_type, package, future=True)
                if type == 'upgrade':
                    events.clear('pre_upgrade', package)

            elif type == 'remove':
                events.clear('remove', package)

            settings.set('ignored_packages',
                list(set(ignored) - set([package])))
            sublime.save_settings(preferences_filename())

            if type == 'remove' and self.old_theme_package == package:
                sublime.message_dialog(u"Package Control\n\n" +
                    u"Your active theme was just removed and the Default " +
                    u"theme was enabled in its place. You may see some " +
                    u"graphical corruption until you restart Sublime Text.")

            # By delaying the restore, we give Sublime Text some time to
            # re-enable the package, making errors less likely
            def delayed_settings_restore():
                if type == 'upgrade' and package in self.old_syntaxes:
                    for view_syntax in self.old_syntaxes[package]:
                        view, syntax = view_syntax
                        view.settings().set('syntax', syntax)

                if type == 'upgrade' and package in self.old_color_schemes:
                    for view_scheme in self.old_color_schemes[package]:
                        view, scheme = view_scheme
                        view.settings().set('color_scheme', scheme)

                if type == 'upgrade' and self.old_theme_package == package:
                    settings.set('theme', self.old_theme)
                    sublime.message_dialog(u"Package Control\n\n" +
                        u"Your active theme was just upgraded. You may see some " +
                        u"graphical corruption until you restart Sublime Text.")

                if type == 'upgrade' and self.old_color_scheme_package == package:
                    settings.set('color_scheme', self.old_color_scheme)

                sublime.save_settings(preferences_filename())

            sublime.set_timeout(delayed_settings_restore, 1000)

        pc_settings = sublime.load_settings(pc_settings_filename())
        in_process = load_list_setting(pc_settings, 'in_process_packages')

        if package in in_process:
            in_process.remove(package)
            pc_settings.set('in_process_packages', in_process)
            sublime.save_settings(pc_settings_filename())
Beispiel #36
0
def plugin_loaded():
	Schemr.preferences = sublime.load_settings('Preferences.sublime-settings')
	Schemr.favorites = sublime.load_settings('SchemrFavorites.sublime-settings')
	print('schemr ready')
Beispiel #37
0
 def get_setting(self,string,view=None):
     if view and view.settings().get(string):
         return view.settings().get(string)
     else:
         return sublime.load_settings('autofilename.sublime-settings').get(string)
Beispiel #38
0
 def on_done(i):
     if i >= 0:
         settings = sublime.load_settings(
             "Preferences.sublime-settings")
         settings.set("dictionary", items[i])
         sublime.save_settings("Preferences.sublime-settings")
Beispiel #39
0
 def settings(self):
     '''plugin settings, lazy loading for API readiness'''
     if self.__settings is None:
         self.__settings = sublime.load_settings(SETTINGS_FILE)
     return self.__settings
Beispiel #40
0
 def get_setting(self, attr):
     settings = sublime.load_settings('MarkdownTOC.sublime-settings')
     return settings.get(attr)
Beispiel #41
0
 def is_enabled(self):
     return not sublime.load_settings("Preferences.sublime-settings").get(
         'show_definitions')
class HighlightDodgyChars(sublime_plugin.EventListener): 
 def getSettings(): global users_whitelist        settings = sublime.load_settings('HighlightDodgyChars.sublime-settings')
        users_whitelist = settings.get('whitelist_chars')
Beispiel #43
0
def get_settings():
    ret = sublime.load_settings("sublime-open-command.sublime-settings")
    return ret
Beispiel #44
0
    def complete_auto_match(self, view, edit, insert_char):
        '''
        Completes brackets if auto_match is enabled; also implements the
        "smart_bracket_auto_trigger" logic, which tries to complete the nearest
        open bracket intelligently.

        :param view:
            the current view

        :param edit:
            the current edit

        :param insert_char:
            the character to try to automatch
        '''
        if sublime.load_settings('Preferences.sublime-settings').get(
                'auto_match_enabled', True):
            # simple case: we have an insert char, insert closing char,
            # if its defined
            if insert_char:
                self.insert_at_end(view, edit,
                                   self.get_match_char(insert_char))

                # if the insert_char is a bracket, move cursor to middle of
                # bracket and return
                if insert_char in self.MATCH_CHARS:
                    new_regions = []
                    for sel in view.sel():
                        if not sel.empty():
                            new_regions.append(sel)
                        else:
                            new_point = sel.end() - 1
                            new_regions.append(getRegion(new_point, new_point))

                    self.update_selections(view, new_regions)
                    return
            elif get_setting('smart_bracket_auto_trigger', True):
                # more complex: if we do not have an insert_char, try to close
                # the nearest bracket that occurs before each selection
                new_regions = []

                for sel in view.sel():
                    word_region = self.get_current_word(view, sel)
                    close_bracket = self.get_closing_bracket(view, word_region)
                    # we should close the bracket
                    if close_bracket:
                        # insert the closing bracket
                        view.insert(edit, word_region.end(), close_bracket)

                        if sel.empty():
                            if word_region.empty():
                                new_regions.append(
                                    getRegion(word_region.end(),
                                              word_region.end()))
                            else:
                                new_point = word_region.end() + len(
                                    close_bracket)
                                new_regions.append(
                                    getRegion(new_point, new_point))
                        else:
                            new_regions.append(
                                getRegion(
                                    sel.begin(),
                                    word_region.end() + len(close_bracket)))
                    else:
                        new_regions.append(sel)

                self.update_selections(view, new_regions)
 def on_pre_save(self, view):
     settings = sublime.load_settings("Rubyfmt.sublime-settings")
     if settings.get("format_on_save", False):
         view.run_command("format_code")
Beispiel #46
0
 def run(self):
     sublime.active_window().run_command('hide_popup')
     s = sublime.load_settings("Preferences.sublime-settings")
     toggle_setting(s, 'show_definitions')
     sublime.save_settings("Preferences.sublime-settings")
Beispiel #47
0
def get_setting(view_settings, key, default_value):
  defaults = sublime.load_settings('Breadcrumbs.sublime-settings')
  return view_settings.get(key, defaults.get(key, default_value))
 def __init__(self, view):
     self.settings = sublime.load_settings("Rubyfmt.sublime-settings")
     self.view = view
Beispiel #49
0
    def run(
            self,
            cmd=None,
            shell_cmd=None,
            file_regex="",
            line_regex="",
            working_dir="",
            encoding="utf-8",
            env={},
            quiet=False,
            kill=False,
            update_phantoms_only=False,
            hide_phantoms_only=False,
            word_wrap=True,
            syntax="Packages/Text/Plain text.tmLanguage",
            # Catches "path" and "shell"
            **kwargs):

        if update_phantoms_only:
            if self.show_errors_inline:
                self.update_phantoms()
            return
        if hide_phantoms_only:
            self.hide_phantoms()
            return

        # clear the text_queue
        self.text_queue_lock.acquire()
        try:
            self.text_queue.clear()
            self.text_queue_proc = None
        finally:
            self.text_queue_lock.release()

        if kill:
            if self.proc:
                self.proc.kill()
                self.proc = None
                self.append_string(None, "[Cancelled]")
            return

        if not hasattr(self, 'output_view'):
            # Try not to call get_output_panel until the regexes are assigned
            self.output_view = self.window.create_output_panel("exec")

        # Default the to the current files directory if no working directory was given
        if working_dir == "" and self.window.active_view(
        ) and self.window.active_view().file_name():
            working_dir = os.path.dirname(
                self.window.active_view().file_name())

        self.output_view.settings().set("result_file_regex", file_regex)
        self.output_view.settings().set("result_line_regex", line_regex)
        self.output_view.settings().set("result_base_dir", working_dir)
        self.output_view.settings().set("word_wrap", word_wrap)
        self.output_view.settings().set("line_numbers", False)
        self.output_view.settings().set("gutter", False)
        self.output_view.settings().set("scroll_past_end", False)
        self.output_view.assign_syntax(syntax)

        # Call create_output_panel a second time after assigning the above
        # settings, so that it'll be picked up as a result buffer
        self.window.create_output_panel("exec")

        self.encoding = encoding
        self.quiet = quiet

        self.proc = None
        if not self.quiet:
            if shell_cmd:
                print("Running " + shell_cmd)
            elif cmd:
                print("Running " + " ".join(cmd))
            sublime.status_message("Building")

        show_panel_on_build = sublime.load_settings(
            "Preferences.sublime-settings").get("show_panel_on_build", True)
        if show_panel_on_build:
            self.window.run_command("show_panel", {"panel": "output.exec"})

        self.hide_phantoms()
        self.show_errors_inline = sublime.load_settings(
            "Preferences.sublime-settings").get("show_errors_inline", True)

        merged_env = env.copy()
        if self.window.active_view():
            user_env = self.window.active_view().settings().get('build_env')
            if user_env:
                merged_env.update(user_env)

        # Change to the working dir, rather than spawning the process with it,
        # so that emitted working dir relative path names make sense
        if working_dir != "":
            os.chdir(working_dir)

        self.debug_text = ""
        if shell_cmd:
            self.debug_text += "[shell_cmd: " + shell_cmd + "]\n"
        else:
            self.debug_text += "[cmd: " + str(cmd) + "]\n"
        self.debug_text += "[dir: " + str(os.getcwd()) + "]\n"
        if "PATH" in merged_env:
            self.debug_text += "[path: " + str(merged_env["PATH"]) + "]"
        else:
            self.debug_text += "[path: " + str(os.environ["PATH"]) + "]"

        try:
            # Forward kwargs to AsyncProcess
            self.proc = AsyncProcess(cmd, shell_cmd, merged_env, self,
                                     **kwargs)

            self.text_queue_lock.acquire()
            try:
                self.text_queue_proc = self.proc
            finally:
                self.text_queue_lock.release()

        except Exception as e:
            self.append_string(None, str(e) + "\n")
            self.append_string(None, self.debug_text + "\n")
            if not self.quiet:
                self.append_string(None, "[Finished]")
Beispiel #50
0
def make_breadcrumbs(view, current_row, shorten=False):
  if len(view.sel()) == 0:
    return []

  tab_size = get_tab_size(view)
  settings = sublime.load_settings('Breadcrumbs.sublime-settings')
  breadcrumb_length_limit = settings.get('breadcrumb_length_limit', 100)

  def get_row_start(row):
    return view.text_point(row, 0)

  def get_points_by_row(row):
    return xrange(get_row_start(row), get_row_start(row + 1))

  if is_white_row(view, get_points_by_row(current_row)):
    while 0 <= current_row and is_white_row(view, get_points_by_row(current_row)):
      current_row -= 1

    if current_row < 0:
      return []

    indentation = get_row_indentation(get_row_start(current_row), view, tab_size) + 1
  else:
    indentation = get_row_indentation(get_row_start(current_row), view, tab_size)
    current_row -= 1

  breadcrumbs = []
  last_line_start = view.text_point(current_row + 1, 0)
  while 0 <= current_row and 0 < indentation:
    line_start = get_row_start(current_row)
    line_end = last_line_start
    last_line_start = line_start
    current_indentation = get_row_indentation(line_start, view, tab_size, indentation)
    if current_indentation < indentation and not is_white_row(view, xrange(line_start, line_end)):
      indentation = current_indentation
      this_breadcrumb = get_breadcrumb(view, line_start, line_end, get_regex(view.settings()), breadcrumb_length_limit)
      if this_breadcrumb is not None:
        breadcrumbs.append(this_breadcrumb)

    current_row -= 1

  breadcrumbs.reverse()
  if shorten:
    total_breadcrumbs_length_limit = settings.get('total_breadcrumbs_length_limit', 200)
    lengths = [len(breadcrumb) for breadcrumb in breadcrumbs]
    sorted_lengths = sorted(lengths)
    previous_length = 0
    number_of_characters_left = max(0, total_breadcrumbs_length_limit - len(lengths) * len(get_separator(view.settings())))
    for (number_of_shorter, current_length) in enumerate(sorted_lengths):
      if previous_length < current_length:
        previous_length = current_length
        number_of_not_shorter = len(breadcrumbs) - number_of_shorter
        if number_of_characters_left < current_length * number_of_not_shorter:
          length_of_short_trim = number_of_characters_left // number_of_not_shorter
          length_of_long_trim = length_of_short_trim + 1
          number_of_long_trimmed = number_of_characters_left % number_of_not_shorter
          number_of_short_trimmed = number_of_not_shorter - number_of_long_trimmed
          for (index_of_breadcrumb, breadcrum_length) in enumerate(lengths):
            if current_length <= breadcrum_length:
              if 0 < number_of_short_trimmed:
                length_of_trim = length_of_short_trim
                number_of_short_trimmed -= 1
              else:
                length_of_trim = length_of_long_trim
              breadcrumbs[index_of_breadcrumb] = breadcrumbs[index_of_breadcrumb][0:length_of_trim]
          break
      number_of_characters_left -= current_length
  return breadcrumbs
Beispiel #51
0
def Settings():
    """
    动态获取配置文件
    """

    return sublime.load_settings("Pandoc.sublime-settings")
Beispiel #52
0
def get_settings():
    return sublime.load_settings('FocusGroup.sublime-settings')
Beispiel #53
0
 def load_last_run(self):
     self.load_config()
     s = sublime.load_settings("RubyTest.last-run")
     return (s.get("last_test_run"), s.get("last_test_working_dir"))
Beispiel #54
0
 def run(self, settings):
     s = sublime.load_settings(settings)
     s.set('color_pick_return', True)
Beispiel #55
0
 def __init__(self):
     self.settings = sublime.load_settings("RubyTest.sublime-settings")
Beispiel #56
0
def plugin_loaded():
    global s
    s = sublime.load_settings("JsFormat.sublime-settings")
Beispiel #57
0
def plugin_unloaded():  # noqa: D401
    """Called when plugin is getting unloaded."""
    if Settings(sublime.load_settings(COLOR_HIGHLIGHTER_SETTINGS_NAME)).debug:
        print("ColorHighlighter: action=stop st=%s" % (st_helper.st_version()))
    ColorHighlighterPlugin.deinit()
Beispiel #58
0
    def save_test_run(self, command, working_dir):
        s = sublime.load_settings("RubyTest.last-run")
        s.set("last_test_run", command)
        s.set("last_test_working_dir", working_dir)

        sublime.save_settings("RubyTest.last-run")
Beispiel #59
0
 def provide_color_scheme(self):  # pylint: disable=no-self-use
     """Provide a current color scheme."""
     settings = sublime.load_settings(PREFERENCES_SETTINGS_NAME)  # pylint: disable=assignment-from-none
     color_scheme = settings.get("color_scheme", None)
     return color_scheme
Beispiel #60
0
	def run(self):
		self.settings = sublime.load_settings('Help.sublime-settings')
		if not self.settings.has('urls'):
			self.settings.set('urls',defaultSettings)
			sublime.save_settings('Help.sublime-settings')
		self.list_urls();