@@ -260,7 +260,15 @@ def merge_lbox_data(self, node, path):
260260
261261 def convert_uri (self , newkind , prev , path ):
262262 uri = prev
263- if len (prev .path ) >= 1 :
263+ # There is currently no easy way to find out if a namebinding rule
264+ # belongs to the top-level grammar rule. However, the top-level
265+ # namebinding rule typically doesn't have a name as there is no need for
266+ # it to have one. So we can use this to determine which rule is the
267+ # top-level and then remove it when merging a sublanguage's rules into
268+ # the outer language. However, if a user decides to give the top-level
269+ # namebinding rule a name, cross-language namebinding won't work, and
270+ # we currently can't guard against that.
271+ if len (prev .path ) > 0 and prev .path [0 ].name is None :
264272 # Replace language box's top level with current location
265273 uri .path .pop (0 )
266274 for p in reversed (path ):
@@ -372,8 +380,6 @@ def get_completion(self, scope):
372380 lbox = root .get_magicterminal ()
373381 analyser = self .get_lboxanalyser (root )
374382 lboxresults = []
375- if analyser and analyser is not self :
376- lboxresults = analyser .get_completion (scope )
377383 if analyser is self :
378384 lbox = None
379385 astnode = self .get_correct_astnode (scope , analyser , lbox )
@@ -404,9 +410,6 @@ def get_correct_astnode(self, scope, analyser=None, lbox=None):
404410 # astnode must have a corresponding entry in self.data
405411 if nbrule :
406412 deftype = nbrule .get_deftype ()
407- if lbox and lbox .symbol .name == "<Python + PHP>" :
408- if deftype == "variable" : # convert to find it in data
409- deftype = "function"
410413 if self .data .has_key (deftype ):
411414 for e in self .data [deftype ]:
412415 if e .astnode is astnode :
0 commit comments