1

I want to add completion for string sequence like

addCompletion[expr___] :=
    FE`Evaluate@FEPrivate`AddSpecialArgCompletion[expr];

list=Alphabet[]; f[x__String]:=( addCompletion["f"->{list}]; {x}(some codes here) );

Here addCompletion is from Argument completions for user-defined functions, and list stores some long strings that can be modified by some other functions.

But now only the first argument of f can be completed. I tried (and am not satisfied)

$fcompletion=4;

f[x__String]:=( addCompletion["f"->Table[list,$fcompletion]]; {x}(some codes here) );

Is there a method of completion adapted for __?

Lacia
  • 2,253
  • 3
  • 19

1 Answers1

2

There is a simple answer. We can wrap the string sequence by List or Association, then the strings are all in the first argument.

setArgumentCompletion[{"f"}][{"a","b"},{"c","d"}];
f[x_]:={x};

where setArgumentCompletion is basically FEPrivate`AddSpecialArgCompletion from https://mathematica.stackexchange.com/a/195670/86893.

enter image description here

enter image description here

Lacia
  • 2,253
  • 3
  • 19
  • You know how to set that completions in a case like this: functionname->{option->{suboption1, subption2}}. I've tried, but the sub-options don't show up. – E. Chan-López Jun 27 '23 at 00:10
  • 1
    @E.Chan-López you may try this one https://mathematica.stackexchange.com/q/78935/86893. Currently I stop using FEPrivate`AddSpecialArgCompletion since this is quite unstable and can cause the frontend broken. – Lacia Jun 27 '23 at 01:28
  • Thanks, Lacia, you're really kind for giving me this information :-) – E. Chan-López Jun 27 '23 at 01:42