Example #1
0
    def cmd(self):
        """
        Return the command line to execute.

        We override this method, so we can add extra flags and include paths
        based on the 'include_dirs' and 'extra_flags' settings.

        """

        result = self.base_cmd

        if persist.get_syntax(self.view) in ['c', 'c improved']:
            result += ' -x c '
        elif persist.get_syntax(self.view) in ['c++', 'c++11']:
            result += ' -x c++ '

        settings = self.get_view_settings()
        result += apply_template( settings.get('extra_flags', '') )

        include_dirs = settings.get('include_dirs', [])

        if include_dirs:
            result += apply_template( ' '.join([' -I ' + shlex.quote(include) for include in include_dirs]) )

        return result + ' -'
Example #2
0
    def cmd(self):
        """Return the command line to execute."""
        command = [self.executable, '--result-format', 'json', '--format']
        try:
            file_format = {'plain text': 'plain',
                           'markdown': 'markdown',
                           'wiki': 'wiki',
                           'javaproperties': 'properties',
                           'latex': 'latex',
                           'asciidoc': 'asciidoc',
                           }[persist.get_syntax(self.view)]
            command.append(file_format)
        except KeyError:
            raise KeyError('Illegal syntax. \'{}\''.format(self.view))

        settings = self.get_view_settings()
        conf_file_path = settings.get('conf', '')
        if conf_file_path != '':
            if os.path.exists(conf_file_path):
                command.append('--conf')
                command.append(conf_file_path)
            else:
                persist.printf('ERROR: Config file is not exist. \'{}\''.format(conf_file_path))
        command.append('@')
        return command
    def cmd(self):
        """
        Return the command line to execute.

        We override this method, so we can add extra flags and include paths
        based on the 'include_dirs' and 'extra_flags' settings.

        """

        result = self.base_cmd

        if persist.get_syntax(self.view) == 'c++':
            result += ' -x c++ '

        settings = self.get_view_settings()
        result += settings.get('extra_flags', '')

        include_dirs = settings.get('include_dirs', [])

        # make include paths relative to project file (if it exitst)
        proj_file = sublime.active_window().project_file_name()
        if proj_file:
            src_path = os.path.dirname(self.filename)
            proj_path = os.path.dirname(proj_file)
            rel_path = os.path.relpath(proj_path, src_path)
            include_dirs = [os.path.join(rel_path, i) for i in include_dirs]

        if include_dirs:
            result += ' '.join([' -I ' + shlex.quote(include) for include in include_dirs])

        return result
Example #4
0
    def cmd(self):
        """
        Return the command line to execute.

        We override this method, so we can add extra flags and include paths
        based on the 'include_dirs' and 'extra_flags' settings.

        """

        result = self.base_cmd

        syntax = persist.get_syntax(self.view)

        settings = self.get_view_settings()

        if syntax == 'c' or syntax == 'c improved':
            result += ' -x c -fexceptions '
            result += settings.get('extra_flags_c', '')

        elif syntax == 'c++' or syntax == 'c++11':
            result += ' -x c++ -fcxx-exceptions -std=c++11 -stdlib=libc++'
            result += settings.get('extra_flags_cxx', '')

        result += " "
        result += settings.get('extra_flags_all', '')

        include_dirs = settings.get('include_dirs', [])

        if include_dirs:
            result += ' '.join([' -I' + shlex.quote(include) for include in include_dirs])

        return result + ' -'  # read from standard input
Example #5
0
    def cmd(self):
        """Return a tuple with the command line to execute."""

        command = [self.executable_path, '--jslint', '--stdin']

        if persist.get_syntax(self.view) == 'coffeescript_literate':
            command.append('--literate')

        return command
    def cmd(self):
        """Return a tuple with the command line to execute."""

        command = [self.executable_path, '--jslint', '--stdin']

        if persist.get_syntax(self.view) == 'coffeescript_literate':
            command.append('--literate')

        return command
Example #7
0
def get_syntax():
    """
    Return the lowercase syntax name of the current view.
    """

    view = sublime.active_window().active_view()

    if get_SL_version() == 3:
        return persist.get_syntax(view)
    else:
        return util.get_syntax(view)
    def cmd(self):
        """Return a tuple with the command line to execute."""

        command = [self.executable_path, '--reporter', 'jslint']

        if persist.get_syntax(self.view) == 'coffeescript_literate':
            command.append('--literate')

        base_dir = os.path.dirname(self.view.file_name())
        coffeelint_json = self.get_config_file(base_dir)
        if coffeelint_json:
            command += ('-f', coffeelint_json)

        command.append('@')
        return command
Example #9
0
    def cmd(self):
        """
        Return the command line to be executed.

        We override this method, so we can change executable, add extra flags
        and include paths based on settings.
        """

        settings = self.get_view_settings()

        if persist.get_syntax(self.view) in self.c_syntaxes:
            c_or_cpp = 'c'
        else:
            c_or_cpp = 'c++'

        base_settings = {
            'executable':
            settings.get('executable', self.default_settings['executable']),
            'extra_flags':
            settings.get('extra_flags', self.default_settings['extra_flags']),
            'include_dirs':
            settings.get('include_dirs',
                         self.default_settings['include_dirs']),
        }

        merged_settings = {
            'executable':
            settings.get(c_or_cpp + '_executable',
                         base_settings['executable']),
            'extra_flags':
            settings.get(c_or_cpp + '_extra_flags',
                         base_settings['extra_flags']),
            'include_dirs':
            settings.get(c_or_cpp + '_include_dirs',
                         base_settings['include_dirs']),
        }

        return self.cmd_template.format(
            executable=merged_settings['executable'],
            common_flags=self.common_flags,
            extra_flags=apply_template(merged_settings['extra_flags']),
            include_dirs=apply_template(''.join({
                ' -I' + shlex.quote(include_dir)
                for include_dir in merged_settings['include_dirs']
            })),
            c_or_cpp=c_or_cpp,
        )