parent
e382dcf8bb
commit
b123ac8a60
21
mode/perl.py
21
mode/perl.py
|
@ -495,21 +495,25 @@ class PerlOpenModule(method.Method):
|
|||
else:
|
||||
w.set_error("Could not find module %r" % vargs['module'])
|
||||
class PerlOpenModuleWord(method.Method):
|
||||
namechars = string.letters + string.digits + '_'
|
||||
def _execute(self, w, **vargs):
|
||||
word = pkg = w.get_token().string
|
||||
path = None
|
||||
while pkg and pkg[0] not in self.namechars:
|
||||
pkg = pkg[1:]
|
||||
while True:
|
||||
path = w.mode.find_module(pkg)
|
||||
if path:
|
||||
break
|
||||
parent = pkg.rsplit('::')[0]
|
||||
parent = pkg.rsplit('::', 1)[0]
|
||||
if parent == pkg:
|
||||
break
|
||||
parent = pkg
|
||||
else:
|
||||
pkg = parent
|
||||
if path:
|
||||
w.application.methods['open-file'].execute(w, filename=path)
|
||||
else:
|
||||
w.set_error("Could not find module related to %r" % pkg)
|
||||
w.set_error("Could not find module related to %r" % word)
|
||||
|
||||
class PerlFunctionCompleter(completer.Completer):
|
||||
def get_candidates(self, s, w=None):
|
||||
|
@ -536,9 +540,11 @@ class PerlContext(context.Context):
|
|||
g = highlights.tokens[i]
|
||||
if (not stack and len(g) > 2 and g[0].name == 'perl_keyword' and
|
||||
g[0].string == 'sub' and g[2].name == 'sub'):
|
||||
curr = g[2].string
|
||||
curr = g[2].string
|
||||
starting = True
|
||||
|
||||
if curr is not None and curr not in self.names:
|
||||
self.names[curr] = i
|
||||
starting = True
|
||||
|
||||
if i == y2 - 1 and curr != self.namelines[i][0] and y2 < blen:
|
||||
y2 += 1
|
||||
|
@ -691,10 +697,9 @@ class Perl(mode.Fundamental):
|
|||
self.add_bindings('perl-view-module-perldoc', ('C-c v',))
|
||||
self.add_bindings('perl-view-word-perldoc', ('C-c p',))
|
||||
self.add_bindings('perl-wrap-paragraph', ('M-q',))
|
||||
self.add_bindings('perl-init-functions', ('C-c M-g',))
|
||||
self.add_bindings('perl-goto-function', ('C-c M-g',))
|
||||
self.add_bindings('perl-which-function', ('C-c w',))
|
||||
self.add_bindings('perl-list-functions', ('C-c W',))
|
||||
self.add_bindings('perl-open-module', ('C-c C-f',))
|
||||
self.add_bindings('perl-open-module-word', ('C-c M-f',))
|
||||
self.add_bindings('close-paren', (')'))
|
||||
self.add_bindings('close-bracket', (']'))
|
||||
self.add_bindings('close-brace', ('}'))
|
||||
|
|
Loading…
Reference in New Issue