Skip to content

Commit ee40c06

Browse files
committed
Adjust code completion according to namebinding changes
1 parent b836674 commit ee40c06

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

lib/eco/astanalyser.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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:

lib/eco/nodeeditor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,7 @@ def action():
10831083
def createCCFunc(self, text):
10841084
def action():
10851085
self.tm.pasteCompletion(text)
1086+
self.update()
10861087
return action
10871088

10881089
def selectSubgrammar(self, item):

0 commit comments

Comments
 (0)