def list_items(self):
     return [
         sublime.ListInputItem(
             'Additive', False,  '<strong>Logic:</strong> <em>adds matches to current selection</em>'),
         sublime.ListInputItem(
             'Subtractive', True,  '<strong>Logic:</strong> <em>removes matches from current selection</em>')
     ]
Esempio n. 2
0
File: ui.py Progetto: dveng/first
    def list_items(self):
        self.window = sublime.active_window()
        self.prefs = sublime.load_settings(PREFS_FILE)

        self.original = self.prefs.get('color_scheme', DEFAULT_CS)
        self.pre_selection = self.prefs.get(self.setting_name,
                                            self.default_value)

        show_legacy = self.prefs.get("show_legacy_color_schemes", False)

        items = []
        if not self.variant:
            kind_info = sublime.KIND_AMBIGUOUS
            if self.pre_selection == "auto":
                kind_info = CURRENT_KIND
            items.append(
                sublime.ListInputItem(
                    'Auto',
                    'auto',
                    details=
                    'Switches between light and dark color schemes to match OS appearance',
                    kind=kind_info))
        selected = -1
        package_set = set()

        files = sublime.find_resources('*.tmTheme')
        trimmed_names = set()
        for f in files:
            name, ext = os.path.splitext(os.path.basename(f))
            trimmed_names.add(name)

        # Add all the sublime-color-scheme files, but not the overrides
        for f in sublime.find_resources('*.sublime-color-scheme'):
            name, ext = os.path.splitext(os.path.basename(f))
            if name not in trimmed_names:
                trimmed_names.add(name)
                files.append(f)

        for cs in files:
            kind_info = sublime.KIND_AMBIGUOUS
            if self.pre_selection and cs == self.pre_selection:
                selected = len(items)
                kind_info = CURRENT_KIND
            if len(cs.split('/', 2)) != 3:  # Not in a package
                continue
            pkg = os.path.dirname(cs)
            if pkg == "Packages/Color Scheme - Legacy" and not show_legacy:
                continue
            if pkg.startswith("Packages/"):
                pkg = pkg[len("Packages/"):]
            name, ext = os.path.splitext(os.path.basename(cs))
            items.append(
                sublime.ListInputItem(name, cs, details=pkg, kind=kind_info))
            package_set.add(pkg)

        return (items, selected)
Esempio n. 3
0
    def list_items(self):
        self.window = sublime.active_window()
        self.prefs = sublime.load_settings(PREFS_FILE)

        self.original = os.path.basename(self.prefs.get(
            'theme', DEFAULT_THEME))
        self.pre_selection = os.path.basename(
            self.prefs.get(self.setting_name, self.default_value))

        items = []
        selected = -1

        if not self.variant:
            kind_info = sublime.KIND_AMBIGUOUS
            if self.pre_selection == "auto":
                kind_info = CURRENT_KIND
                selected = 0

            items.append(
                sublime.ListInputItem(
                    'Auto',
                    'auto',
                    details=
                    'Switches between light and dark themes to match OS appearance',
                    kind=kind_info))

        nameset = set()

        for theme in sublime.find_resources('*.sublime-theme'):
            pkg, basename = os.path.split(theme)
            name, ext = os.path.splitext(basename)

            # Themes with the same name, but in different packages, are
            # considered a single logical theme, as the data from the
            # different files is merged. Ensure there's only one entry per
            # basename
            if name in nameset:
                continue
            nameset.add(name)

            kind_info = sublime.KIND_AMBIGUOUS
            if self.pre_selection and basename == self.pre_selection:
                selected = len(items)
                kind_info = CURRENT_KIND

            if pkg.startswith("Packages/"):
                pkg = pkg[len("Packages/"):]

            items.append(
                sublime.ListInputItem(name,
                                      basename,
                                      details=pkg,
                                      kind=kind_info))

        return (items, selected)
Esempio n. 4
0
 def list_items(self):
     return [
         sublime.ListInputItem(
             "Var",
             "var",
             details="Run the test defined by the var under the caret.",
             annotation="<code>deftest</code>"),
         sublime.ListInputItem(
             "Namespace",
             "ns",
             details="Run all tests in the current namespace."),
     ]
    def list_items(self):

        s = sublime.load_settings('Preferences.sublime-settings')
        return [
            sublime.ListInputItem(
                OPTIONAL_SETTINGS[index]['title'], index,
                '%s' % (OPTIONAL_SETTINGS[index]['description']))
            for index in OPTIONAL_SETTINGS
        ]
Esempio n. 6
0
 def list_items(self):
     return [
         sublime.ListInputItem(
             "Clojure",
             "clj",
             details=
             "A dynamic and functional Lisp that runs on the Java Virtual Machine."
         ),
         sublime.ListInputItem(
             "ClojureScript",
             "cljs",
             annotation="shadow-cljs only",
             details="A compiler for Clojure that targets JavaScript."),
         sublime.ListInputItem(
             "Babashka",
             "bb",
             details="A fast, native Clojure scripting runtime.")
     ]
Esempio n. 7
0
 def list_items(self):
     items: list[sublime.ListInputItem] = []
     for index, value in enumerate(self.values):
         items.append(
             sublime.ListInputItem(value.text,
                                   index,
                                   details=value.details,
                                   kind=value.kind))
     return (items, self.index)
Esempio n. 8
0
 def list_items(self):
     return [
         sublime.ListInputItem(
             "Adjacent Form",
             "form",
             details=
             "The form (not necessarily S-expression) adjacent to the caret."
         ),
         sublime.ListInputItem(
             "Innermost S-expression",
             "innermost",
             details=
             "The innermost S-expression with respect to the caret position."
         ),
         sublime.ListInputItem(
             "Outermost S-expression",
             "outermost",
             details=
             "The outermost S-expression with respect to the caret position.",
             annotation="ignores (comment)"),
         sublime.ListInputItem(
             "Active View",
             "view",
             details="The entire contents of the currently active view."),
         sublime.ListInputItem(
             "Input",
             "input",
             details="Tutkain prompts you for input to evaluate."),
         sublime.ListInputItem(
             "Namespace Declarations",
             "ns",
             details=
             "Every namespace declaration (<code>ns</code> form) in the active view."
         ),
     ]
Esempio n. 9
0
    def list_items(self):
        items: list[sublime.ListInputItem] = []
        for index, value in enumerate(self.values):
            items.append(
                sublime.ListInputItem(value.text,
                                      index,
                                      details=value.details,
                                      kind=value.kind,
                                      annotation=value.annotation))

        if (not items):
            return ['Nothing Here\terror?']

        return (items, self.index)
 def list_items(self):
     return [
         sublime.ListInputItem(str(item), item) for item in [True, False]
     ]
 def list_items(self):
     stashed_regions = self.view.settings().get('meu_pop_stashed_regions', {})
     options = [
         sublime.ListInputItem(f'Item: {key}', key, f'<em>{stashed_regions[key].split("|")[0]}</em>', stashed_regions[key].split('|')[1]) for key in stashed_regions.keys()
     ]
     return options
import sublime
import sublime_plugin
import re
from datetime import datetime
import uuid
import html
from collections import namedtuple

from .selection_fields import get_settings
from .utils import get_new_regions

COMMENT_SELECTOR = "comment - punctuation.definition.comment"

MULTI_FIND_MENU = [
    sublime.ListInputItem("Case +    Word +", 0,
                          '<strong>Matches:</strong> <em>case, word</em>'),
    sublime.ListInputItem("Case +    Word -",
                          1, '<strong>Matches:</strong> <em>case</em> <strong>Ignores:</strong> <em>word</em>'),
    sublime.ListInputItem("Case -    Word +",
                          2, '<strong>Matches:</strong> <em>word</em> <strong>Ignores:</strong> <em>case</em>'),
    sublime.ListInputItem("Case -    Word -",
                          3, '<strong>Ignores:</strong> <em>case, word</em>'),
    sublime.ListInputItem(
        "Case +    Word +  Comments -", 4, '<strong>Matches:</strong> <em>case, word</em>\t<strong>Ignores:</strong> <em>matches inside comments</em>')
]


class MultiFindMenuCommand(sublime_plugin.TextCommand):

    def run(self, edit, operation):
        if operation == 0:
Esempio n. 13
0
    def list_items(self):
        self.window = sublime.active_window()
        self.prefs = sublime.load_settings(PREFS_FILE)

        self.original = self.prefs.get('color_scheme', DEFAULT_CS)
        self.pre_selection = self.prefs.get(self.setting_name,
                                            self.default_value)

        # sublime-color-scheme's are unique on the name, but tmTheme's are
        # unique on the path
        if self.original.endswith(".sublime-color-scheme"):
            self.original = os.path.basename(self.original)
        if self.pre_selection.endswith(".sublime-color-scheme"):
            self.pre_selection = os.path.basename(self.pre_selection)

        show_legacy = self.prefs.get("show_legacy_color_schemes", False)

        items = []
        selected = -1

        if not self.variant:
            kind_info = sublime.KIND_AMBIGUOUS
            if self.pre_selection == "auto":
                kind_info = CURRENT_KIND
                selected = 0

            items.append(
                sublime.ListInputItem(
                    'Auto',
                    'auto',
                    details=
                    'Switches between light and dark color schemes to match OS appearance',
                    kind=kind_info))

        files = []
        nameset = set()
        for f in sublime.find_resources('*.tmTheme'):
            files.append((f, f))
            nameset.add(os.path.splitext(os.path.basename(f))[0])

        # Color schemes with the same name are merged, but that's not the case
        # for tmTheme.
        for f in sublime.find_resources('*.sublime-color-scheme'):
            basename = os.path.basename(f)
            name = os.path.splitext(basename)[0]
            if name not in nameset:
                nameset.add(name)
                files.append((f, basename))

        for cs, unique_path in files:
            pkg, basename = os.path.split(cs)
            name = os.path.splitext(basename)[0]

            if pkg == "Packages/Color Scheme - Legacy" and not show_legacy:
                continue

            kind_info = sublime.KIND_AMBIGUOUS
            if self.pre_selection and self.pre_selection == unique_path:
                kind_info = CURRENT_KIND
                selected = len(items)

            if pkg.startswith("Packages/"):
                pkg = pkg[len("Packages/"):]

            items.append(
                sublime.ListInputItem(name,
                                      unique_path,
                                      details=pkg,
                                      kind=kind_info))

        return (items, selected)