Skip to content

Commit

Permalink
Implement Record and Requirements completions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaushik Ghose committed Jul 20, 2019
1 parent ec474be commit c71a09a
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions benten/models/languagemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ def parse(self,
return

for k, v in itr:

if not self.is_dict and v is None:
continue

if self.is_dict:
key_lookup_node = KeyLookup.from_key(node, k)
key_lookup_node.completer_node = self
Expand All @@ -681,6 +685,9 @@ def parse(self,

value_lookup_node = ValueLookup.from_value(node, k)

if self.name == "requirements":
parent_completer_node = RequirementsCompleter([t.name for t in self.types])

if self.name == "steps":
step_id = k if self.is_dict else v.get("id")
parent_completer_node = completer.wf_completer.get_step_completer(step_id)
Expand Down Expand Up @@ -708,12 +715,11 @@ def parse(self,
problems=problems,
requirements=requirements)

def completion(self):
if self.is_dict:
return [
CompletionItem(label=t.name)
for t in self.types
]

class RequirementsCompleter(CompleterNode):

def __init__(self, req_types):
super().__init__(completions=req_types)


class CWLRecordType(CWLBaseType):
Expand Down Expand Up @@ -857,6 +863,9 @@ def parse(self,
problems=problems,
requirements=requirements)

def completion(self):
return [CompletionItem(label=k) for k in self.fields.keys()]


class CWLFieldType(CWLBaseType):

Expand Down Expand Up @@ -1014,7 +1023,8 @@ def parse_step_interface(doc_uri, step):

if isinstance(run_field, str):
_step_path = resolve_file_path(doc_uri, run_field)
run_field = fast_load.load(_step_path)
if _step_path.exists() and _step_path.is_file():
run_field = fast_load.load(_step_path)

inputs = []
outputs = []
Expand Down

0 comments on commit c71a09a

Please sign in to comment.