Exemple #1
0
def test_has_file_ext():
    view = mock.Mock()

    view.file_name.return_value = "foo.bar"
    assert su_lib_view.has_file_ext(view, "bar")

    view.file_name.return_value = 'foo.'
    assert not su_lib_view.has_file_ext(view, ".")

    view.file_name.return_value = ''
    assert not su_lib_view.has_file_ext(view, ".")

    view.file_name.return_value = ''
    assert not su_lib_view.has_file_ext(view, '')

    view.file_name.return_value = 'foo'
    assert not su_lib_view.has_file_ext(view, '')

    view.file_name.return_value = 'foo'
    assert not su_lib_view.has_file_ext(view, 'foo')

    view.file_name.return_value = None
    assert not su_lib_view.has_file_ext(view, None)

    view.file_name.return_value = None
    assert not su_lib_view.has_file_ext(view, '.any')
Exemple #2
0
def test_has_file_ext():
    view = mock.Mock()

    view.file_name.return_value = "foo.bar"
    assert su_lib_view.has_file_ext(view, "bar")

    view.file_name.return_value = 'foo.'
    assert not su_lib_view.has_file_ext(view, ".")

    view.file_name.return_value = ''
    assert not su_lib_view.has_file_ext(view, ".")

    view.file_name.return_value = ''
    assert not su_lib_view.has_file_ext(view, '')    

    view.file_name.return_value = 'foo'
    assert not su_lib_view.has_file_ext(view, '')

    view.file_name.return_value = 'foo'
    assert not su_lib_view.has_file_ext(view, 'foo')

    view.file_name.return_value = None
    assert not su_lib_view.has_file_ext(view, None)

    view.file_name.return_value = None
    assert not su_lib_view.has_file_ext(view, '.any')
    def run(self, **kwargs):
        v = self.window.active_view()
        path = v.file_name()
        if not (os.path.exists(path) and has_file_ext(v, 'JSON-tmLanguage')):
            print "[AAAPackageDev] Not a valid JSON-tmLanguage file. (%s)" % path
            return

        assert os.path.exists(path), "Need a path to a .JSON-tmLanguage file."
        self.make_tmlanguage_grammar(path)
    def run(self, **kwargs):
        v = self.window.active_view()
        path = v.file_name()
        if not (os.path.exists(path) and has_file_ext(v, 'JSON-tmLanguage')):
            print "[AAAPackageDev] Not a valid JSON-tmLanguage file. (%s)" % path
            return

        assert os.path.exists(path), "Need a path to a .JSON-tmLanguage file."
        self.make_tmlanguage_grammar(path)
    def run(self, **kwargs):
        v = self.window.active_view()
        path = v.file_name()
        if not (os.path.exists(path) and has_file_ext(v, 'JSON-tmLanguage')):
            # XXX: Can we/Should we use sublimelog.log?
            print "[AAAPackageDev] Not a valid JSON-tmLanguage file. (%s)" % path
            return

        build_cmd = root_at_data("Packages/AAAPackageDev/Support/make_tmlanguage.py")
        file_regex = r"Error:\s+'(.*?)'\s+.*?\s+line\s+(\d+)\s+column\s+(\d+)"
        cmd = ["python", build_cmd, path]

        self.window.run_command("exec", {"cmd": cmd, "file_regex": file_regex})
Exemple #6
0
    def run(self, **kwargs):
        v = self.window.active_view()
        path = v.file_name()
        if not (os.path.exists(path) and has_file_ext(v, 'JSON-tmLanguage')):
            # XXX: Can we/Should we use sublimelog.log?
            print "[AAAPackageDev] Not a valid JSON-tmLanguage file. (%s)" % path
            return

        build_cmd = root_at_data(
            "Packages/AAAPackageDev/Support/make_tmlanguage.py")
        file_regex = r"Error:\s+'(.*?)'\s+.*?\s+line\s+(\d+)\s+column\s+(\d+)"
        cmd = ["python", build_cmd, path]

        self.window.run_command("exec", {"cmd": cmd, "file_regex": file_regex})
Exemple #7
0
 def is_enabled(self):
     return has_file_ext(self.view, 'sublime-snippet')
 def is_enabled(self):
     return has_file_ext(self.window.active_view(), '.JSON-tmLanguage')
Exemple #9
0
 def is_enabled(self):
     return has_file_ext(self.window.active_view(), '.JSON-tmLanguage')