-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathlang_mustache.py
More file actions
69 lines (52 loc) · 2.01 KB
/
lang_mustache.py
File metadata and controls
69 lines (52 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python
# Copyright (c) 2015 ActiveState Software Inc.
# See LICENSE.txt for license details.
"""Mustache support for codeintel"""
from __future__ import absolute_import
import logging
from codeintel2.common import *
from codeintel2.langintel import LangIntel
from codeintel2.udl import UDLLexer, UDLBuffer, UDLCILEDriver, XMLParsingBufferMixin
if _xpcom_:
from xpcom.server import UnwrapObject
#---- globals
lang = "Mustache"
log = logging.getLogger("codeintel.mustache")
#---- language support
class MustacheLexer(UDLLexer):
lang = lang
class MustacheBuffer(UDLBuffer, XMLParsingBufferMixin):
lang = lang
tpl_lang = lang
m_lang = "HTML"
css_lang = "CSS"
csl_lang = "JavaScript"
# Characters that should close an autocomplete UI:
# - wanted for XML completion: ">'\" "
# - wanted for CSS completion: " ('\";},.>"
# - wanted for JS completion: "~`!@#%^&*()-=+{}[]|\\;:'\",.<>?/ "
# - dropping ':' because I think that may be a problem for XML tag
# completion with namespaces (not sure of that though)
# - dropping '[' because need for "<!<|>" -> "<![CDATA[" cpln
# - dropping '-' because causes problem with CSS (bug 78312)
# - dropping '!' because causes problem with CSS "!important" (bug 78312)
cpln_stop_chars = "'\" (;},~`@#%^&*()=+{}]|\\;,.<>?/"
class MustacheLangIntel(LangIntel):
lang = lang
def trg_from_pos(self, buf, pos, implicit=True, DEBUG=False):
return None
class MustacheCILEDriver(UDLCILEDriver):
lang = lang
csl_lang = "JavaScript"
tpl_lang = lang
css_lang = "CSS"
#---- registration
def register(mgr):
"""Register language support with the Manager."""
mgr.set_lang_info(lang,
silvercity_lexer=MustacheLexer(),
buf_class=MustacheBuffer,
langintel_class=MustacheLangIntel,
import_handler_class=None,
cile_driver_class=MustacheCILEDriver,
is_cpln_lang=True)