parent
fc016f1716
commit
1e7e2d9db9
|
@ -1,4 +1,8 @@
|
||||||
import color, mode, tab
|
import os.path
|
||||||
|
import time
|
||||||
|
import tab
|
||||||
|
from mode import Fundamental
|
||||||
|
from method.shell import Interact
|
||||||
from lex import Grammar, PatternRule, RegionRule, PatternMatchRule
|
from lex import Grammar, PatternRule, RegionRule, PatternMatchRule
|
||||||
from point import Point
|
from point import Point
|
||||||
|
|
||||||
|
@ -83,7 +87,24 @@ class JavascriptTabber2(tab.StackTabber2):
|
||||||
return t.fqname() in ('spaces', 'eol', 'comment', 'comment.start',
|
return t.fqname() in ('spaces', 'eol', 'comment', 'comment.start',
|
||||||
'comment.data', 'comment.null', 'comment.end')
|
'comment.data', 'comment.null', 'comment.end')
|
||||||
|
|
||||||
class Javascript(mode.Fundamental):
|
class RhinoStart(Interact):
|
||||||
|
args = []
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
cmd = w.application.config.get('rhino.cmd', 'rhino')
|
||||||
|
Interact._execute(self, w, bname='*Rhino*', cmd=cmd)
|
||||||
|
|
||||||
|
class RhinoLoadFile(RhinoStart):
|
||||||
|
args = []
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
RhinoStart._execute(self, w, **vargs)
|
||||||
|
b = w.application.get_buffer_by_name('*Rhino*')
|
||||||
|
path = os.path.realpath(w.buffer.path)
|
||||||
|
time.sleep(0.5)
|
||||||
|
b.pipe_write('load("env.js");\n')
|
||||||
|
time.sleep(0.5)
|
||||||
|
b.pipe_write('load("%s");\n' % path)
|
||||||
|
|
||||||
|
class Javascript(Fundamental):
|
||||||
name = 'Javascript'
|
name = 'Javascript'
|
||||||
extensions = ['.js']
|
extensions = ['.js']
|
||||||
grammar = JavascriptGrammar
|
grammar = JavascriptGrammar
|
||||||
|
@ -104,6 +125,8 @@ class Javascript(mode.Fundamental):
|
||||||
'js_regex.escaped': ('magenta', 'default', 'bold'),
|
'js_regex.escaped': ('magenta', 'default', 'bold'),
|
||||||
'js_regex.end': ('cyan', 'default', 'bold'),
|
'js_regex.end': ('cyan', 'default', 'bold'),
|
||||||
}
|
}
|
||||||
|
config = {'rhino.cmd': 'rhino'}
|
||||||
|
actions = [RhinoStart, RhinoLoadFile]
|
||||||
_bindings = {
|
_bindings = {
|
||||||
'close-paren': (')',),
|
'close-paren': (')',),
|
||||||
'close-brace': ('}',),
|
'close-brace': ('}',),
|
||||||
|
|
Loading…
Reference in New Issue