Home Download Buy Blog Forum Support

Configuring SublimeLinter to use AS3 and/or HaXe Syntax?

Configuring SublimeLinter to use AS3 and/or HaXe Syntax?

Postby Krankles on Mon Apr 09, 2012 6:00 pm

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.
Krankles
 
Posts: 7
Joined: Sat Apr 07, 2012 5:19 pm

Re: Configuring SublimeLinter to use AS3 and/or HaXe Syntax?

Postby Reezy on Thu Apr 12, 2012 10:55 am

BUMP and good luck!!!!
Reezy
 
Posts: 1
Joined: Thu Apr 12, 2012 10:54 am

Re: Configuring SublimeLinter to use AS3 and/or HaXe Syntax?

Postby aparajita on Fri Apr 13, 2012 3:25 am

There is a section called "Creating New Linters" new linters in the README. Silly place to put it, I know. ;)

And yes, you should take the time to learn some python.
aparajita
 
Posts: 177
Joined: Sun Jul 24, 2011 10:42 pm

Re: Configuring SublimeLinter to use AS3 and/or HaXe Syntax?

Postby Krankles on Fri Apr 13, 2012 7:17 pm

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: Select all
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)


I named the file "haxe.py"

If I'm doing anything wrong and someone knows how to implement this into SublimeLinter, please post.
Krankles
 
Posts: 7
Joined: Sat Apr 07, 2012 5:19 pm

Re: Configuring SublimeLinter to use AS3 and/or HaXe Syntax?

Postby aparajita on Fri Apr 13, 2012 11:03 pm

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
aparajita
 
Posts: 177
Joined: Sun Jul 24, 2011 10:42 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 15 guests