How to use the abap-adt-api.CreatableTypes.get function in abap-adt-api

To help you get started, we’ve selected a few abap-adt-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marcellourbani / vscode_abap_remote_fs / client / src / adt / operations / AdtObjectCreator.ts View on Github external
const base = hierarchy[0]
    // if I picked the root node,a direct descendent or a package just ask the user to select any object type
    // if not, for abap nodes pick child objetc types (if any)
    // for non-abap nodes if it's an object type guess the type from the children
    if (hierarchy.length > 2)
      if (isAbapNode(base) && base.abapObject.type.match(/FUGR\/F/))
        return selectObjectType(base.abapObject.type)
      else {
        const child = base.isFolder
          ? [...base]
              .map(c => c[1])
              .find(c => isAbapNode(c) && c.abapObject.type !== PACKAGE)
          : base
        if (child && isAbapNode(child)) {
          const typeid = child.abapObject.type as CreatableTypeIds
          const guessed = CreatableTypes.get(typeid)
          if (guessed) return guessed
        }
      }
    // default...
    return selectObjectType()
  }