Hi, your language must utilize koLanguageKeywordBase. Something like this worked for me:
# Registers the Test language in Komodo.
import logging
from koLanguageKeywordBase import KoLanguageKeywordBase
from koLanguageServiceBase import koLangSvcStyleInfo
from koUDLLanguageBase import KoUDLLanguage
log = logging.getLogger("koTestLanguage")
#log.setLevel(logging.DEBUG)
def registerLanguage(registry):
log.debug("Registering language Test")
registry.registerLanguage(KoTestLanguage())
class KoTestLanguage(KoUDLLanguage, KoLanguageKeywordBase):
# ------------ Komodo Registration Information ------------ #
name = "Test"
lexresLangName = "Test"
_reg_desc_ = "%s Language" % name
_reg_contractid_ = "@activestate.com/koLanguage?language=%s;1" % name
_reg_categories_ = [("komodo-language", name)]
_reg_clsid_ = "70b8b1fe-d5f6-4378-895d-995e274dc63b"
defaultExtension = '.test'
primary = 1 # Whether the language shows up in Komodo's first level language menus.
# ------------ Commenting Controls ------------ #
commentDelimiterInfo = {
"line": [
#'//', # C-style one line comments
#'#', # Hash-style one line comments
#'--', # SQL-style one line comments
#';', # Lisp-style one line comments
#'%', # Erlang-style one line comments
],
"block": [
#('/*', '*/') # C-style block comments
#('(*', '*)') # Pascal-style block comments
],
}
# ------------ Indentation Controls ------------ #
# To support automatic indenting and dedenting after "{([" and "})]"
supportsSmartIndent = "keyword"
# Other smart indenting types are:
# 'text', 'python', 'XML' and 'keyword'
# Indent/dedent after these words.
_indenting_statements = ['foo']
_dedenting_statements = ['bar']
_keyword_dedenting_keywords = ['baz']
# ------------ Sub-language Controls ------------ #
#Check: Update 'lang_from_udl_family' as appropriate for your
# lexer definition. There are four UDL language families:
# M (markup), i.e. HTML or XML
# CSL (client-side language), e.g. JavaScript
# SSL (server-side language), e.g. Perl, PHP, Python
# TPL (template language), e.g. RHTML, Django, Smarty
# 'lang_from_udl_family' maps each UDL family code (M,
# CSL, ...) to the sub-language name in your language.
# Some examples:
# lang_from_udl_family = { # A PHP file can contain
# 'M': 'HTML', # HTML
# 'SSL': 'PHP', # PHP
# 'CSL': 'JavaScript', # JavaScript
# }
# lang_from_udl_family = { # An RHTML file can contain
# 'M': 'HTML', # HTML
# 'SSL': 'Ruby', # Ruby
# 'CSL': 'JavaScript', # JavaScript
# 'TPL': 'RHTML', # RHTML template code
# }
# lang_from_udl_family = { # A plain XML can just contain
# 'M': 'XML', # XML
# }
lang_from_udl_family = {'SSL': 'Test'}
def __init__(self):
KoLanguageKeywordBase.__init__(self)
KoUDLLanguage.__init__(self)
# Manually set up styles since the defaults are no good thanks to Ruby.
from xpcom import components
ScintillaConstants = components.interfaces.ISciMoz
self._style_info = koLangSvcStyleInfo(
_indent_styles = [ScintillaConstants.SCE_UDL_SSL_OPERATOR],
_indent_open_styles = [ScintillaConstants.SCE_UDL_SSL_OPERATOR],
_indent_close_styles = [ScintillaConstants.SCE_UDL_SSL_OPERATOR],
_lineup_close_styles = [ScintillaConstants.SCE_UDL_SSL_OPERATOR],
_lineup_styles = [ScintillaConstants.SCE_UDL_SSL_OPERATOR],
_comment_styles=[ScintillaConstants.SCE_UDL_SSL_COMMENT,
ScintillaConstants.SCE_UDL_SSL_COMMENTBLOCK],
_block_comment_styles=[ScintillaConstants.SCE_UDL_SSL_COMMENT,
ScintillaConstants.SCE_UDL_SSL_COMMENTBLOCK],
_keyword_styles = [ScintillaConstants.SCE_UDL_SSL_WORD],
_number_styles = [ScintillaConstants.SCE_UDL_SSL_NUMBER],
_string_styles = [ScintillaConstants.SCE_UDL_SSL_STRING],
_regex_styles = [ScintillaConstants.SCE_UDL_SSL_REGEX],
_variable_styles = [ScintillaConstants.SCE_UDL_SSL_VARIABLE],
_default_styles = [ScintillaConstants.SCE_UDL_SSL_DEFAULT],
_multiline_styles = [ScintillaConstants.SCE_UDL_SSL_STRING]
)
def _keyPressed(self, ch, scimoz, style_info):
return KoLanguageKeywordBase._keyPressed(self, ch, scimoz, style_info)
def _keyPressedAux(self, ch, scimoz, style_info):
return KoLanguageKeywordBase._keyPressedAux(self, ch, scimoz, style_info)