Sublime Forum

Configuring SublimeLinter to use AS3 and/or HaXe Syntax?

#1

Hi, I installed SublimeLinter, and unfortunately, there wasn’t any support for other languages such as ActionScript 3 and HaXe. I would like to create my own linter, but I don’t know how to. I know I should learn Python before diving in but the programming shouldn’t be that different from C++ or AS3. Any small guides will be greatly appreciated. If anyone could add support and do this for me, that would be even better (so I could learn it from there) as I would like to also add some Plug-ins, etc for Sublime Text 2.

Thanks.

0 Likes

#2

BUMP and good luck!!!

0 Likes

#3

There is a section called “Creating New Linters” new linters in the README. Silly place to put it, I know. :wink:

And yes, you should take the time to learn some python.

0 Likes

#4

Yeah, I already saw that but it doesn’t really work at all. “* Create a new file in sublimelinter/modules. If your linter uses an external executable, you will probably want to copy perl.py. If your linter uses built in code, copy objective-j.py. The convention is to name the file the same as the language that will be linted.”

I copied objective-j.py and changed some stuff so it’ll work with HaXe. Surprisingly it works, but the linter lints everything because it doesn’t recognize the HaXe syntax. So I was just basically wondering how I could get that to work; and yes, I’m thinking onto learning Python, but I was wondering if I could wing it and get it to work. This is what I had:

[code]from capp_lint import LintChecker
from base_linter import BaseLinter

CONFIG = {
‘language’: ‘HaXe’
}

class Linter(BaseLinter):
def built_in_check(self, view, code, filename):
checker = LintChecker(view)
checker.lint_text(code, filename)
return checker.errors

def parse_errors(self, view, errors, lines, errorUnderlines, violationUnderlines, warningUnderlines, errorMessages, violationMessages, warningMessages):
    for error in errors:
        lineno = error'lineNum']
        self.add_message(lineno, lines, error'message'], errorMessages if type == LintChecker.ERROR_TYPE_ILLEGAL else warningMessages)

        for position in error.get('positions', ]):
            self.underline_range(view, lineno, position, errorUnderlines if type == LintChecker.ERROR_TYPE_ILLEGAL else warningUnderlines)

[/code]

I named the file “haxe.py”

If I’m doing anything wrong and someone knows how to implement this into SublimeLinter, please post.

0 Likes

#5

You need to learn some python, you are linting HaXe with an Objective-J linter, which is probably why it considers everything wrong. You need to do the following:

]Learn python./]
]Find out how HaXe is linted now, external to Sublime Text./]
]Write a linter module for SublimeLinter that will provide the glue between the HaXe linter and Sublime Text./]

  • Aparajita
0 Likes