docs: def add_completions(
      replace_list: list, belstr: str, replace_span: Span, completion_text: str
  ) -> List[Mapping[str, Any]]:
      """Create completions to return given replacement list
  
      Args:
          replace_list: list of completion replacement values
          belstr: BEL String
          replace_span: start, stop of belstr to replace
          completion_text: text to use for completion - used for creating highlight
      Returns:
          [{
              "replacement": replacement,
              "cursor_loc": cursor_loc,
              "highlight": highlight,
              "label": label,
          }]
      """
  
      completions = []
  
      for r in replace_list:
  
          # if '(' not in belstr:
          #     replacement = f'{r["replacement"]}()'
          #     cursor_loc = len(replacement) - 1  # inside parenthesis
          # elif r['type'] == 'Function' and replace_span[1] == len(belstr) - 1:
  
          if len(belstr) > 0:
              belstr_end = len(belstr) - 1
          else:
              belstr_end = 0
  
          log.debug(
              f'Replace list {r}  Replace_span {replace_span}  BELstr: {belstr} Len: {belstr_end} Test1 {r["type"] == "Function"}  Test2 {replace_span[1] + 1 == len(belstr)}'
          )
  
          # Put a space between comma and following function arg
          if (
              r["type"] == "Function"
              and replace_span[0] > 0
              and belstr[replace_span[0] - 1] == ","
          ):
              log.debug("prior char is a comma")
              replacement = (
                  belstr[0 : replace_span[0]]
                  + " "
                  + f"{r['replacement']}()"
                  + belstr[replace_span[1] + 1 :]
              )
              cursor_loc = len(
                  belstr[0 : replace_span[0]] + " " + f"{r['replacement']}()"
              )
          # Put a space between comman and following NSArg or StrArg
          elif replace_span[0] > 0 and belstr[replace_span[0] - 1] == ",":
              log.debug("prior char is a comma")
              replacement = (
                  belstr[0 : replace_span[0]]
                  + " "
                  + r["replacement"]
                  + belstr[replace_span[1] + 1 :]
              )
              cursor_loc = len(belstr[0 : replace_span[0]] + " " + r["replacement"])
          # Add function to end of belstr
          elif r["type"] == "Function" and replace_span[1] >= belstr_end:
              replacement = belstr[0 : replace_span[0]] + f"{r['replacement']}()"
              cursor_loc = len(replacement) - 1  # inside parenthesis
              log.debug(f"Replacement: {replacement}")
          # Insert replacement in beginning or middle of belstr
          else:
              replacement = (
                  belstr[0 : replace_span[0]]
                  + r["replacement"]
                  + belstr[replace_span[1] + 1 :]
              )
              cursor_loc = len(
                  belstr[0 : replace_span[0]] + r["replacement"]
              )  # move cursor just past replacement
  
          completions.append(
              {
                  "replacement": replacement,
                  "cursor_loc": cursor_loc,
                  "highlight": r["highlight"],
                  "label": r["label"],
              }
          )
  
      return completions