boolgroup-773565: Update Argument.beget

Make all options be optional (i.e. text)
Return 'this' if nothing has changed
Add 'suffixSpace' option to be used in completion
Make ScriptArgument.beget use Argument.beget
Move the 'moveSpaces' calculation to its own function so it can be shared
  between the ctor and beget
Remove the special ScriptArgument.beget({ normalize: true }) option
  SelectionTooltipField should never have used it, also fix the text param
  JavascriptField can create a new ScriptArgument instead and should do
    this consistently.
Have Requisition.complete use beget({ suffixSpace:true })
boolgroup-773565: Don't use exports alias

Previously we aliased 'exports' so when we moved code from one module to
another, we wouldn't need to redirect calls to functions in the original
module. While a worthy goal, it's often confusing, and in this case not
relevant because there isn't any of that kind of intra-module function
calling.
boolgroup-773565: Move incr/decr to Requisition

Minor refactor: We're debugging completion, part of which is making
Requistion.setAssignment() update the underlying arg list properly. If we
make the increment and decrement process be part of Requisition (rather
than Assignment) then we can get them to use Requistion.setAssignment()
too.

In general, the events that GCLI uses to update various parts of the UI
are too complex. This is, in part, due to Assignments being adjustable by
the UI directly, so the Assignments need to inform the Requisition that
they have changed, so we get an event storm. This helps make Requisition
into a gatekeeper for all change.
boolgroup-773565: TrueNamedArgument needs an Argument

As previously noted Arguments have 2 uses, one is really a Token, i.e. a
digestable lump. The other is something that has been understood, and
assigned to a parameter. TrueNamedArgument bridged both worlds. This
stops that. Now it's something that can be assigned, not a token, so there
is always an underlying 'token' (called Argument until we get around to
finishing off that refactor)
boolgroup-773565: Upgrade Argument.beget()

Previously there was a bug in Argument.beget, in that it would always make
instances of Argument, not whatever the subclass was called. So we add an
option to specify a subclass to create. This means that all subclasses
need to be able to construct themselves from a prefix/text/suffix trio.

So this change:
- Adds options.type and documents its use
- Makes the NamedArgument ctor able to use prefix/text/suffix
- Adds TrueNamedArgument.beget and NamedArgument.beget
- Upgrades ScriptArgument.beget to use options.type
boolgroup-773565: setAssignment should update all args

Previously Requisition.setAssignment just looked for a single argument
(more properly 'token') when it was updating what the user typed. When
NamedArguments were being completed, this broken. so we now use the array
of arguments (tokens) provided to do the update.

This exposed a bug in the implementation of NamedArgument.getArgs where
it was returning the valueArg even in the case were the user had not typed
one.
easyargs-660765: Remove complex arg logic

Previously we were doing some nasty messing to patch up what the user
typed. With recent changes to fix completion, this is no longer needed.
boolgroup-773565: Update tests

Add in some unit tests.
Also update the test harness to put quotes around strings so we can see
trailing spaces more easily.
boolgroup-773565: Calculate the 'next' param properly

In a couple of places we were assuming that the next parameter was just
the parameter defined 'after' this one. This is OK if all of your params
are positional, but when you're doing named parameters, then we might
enter the paremters out of order, so we define a new function called
Requisition._getFirstBlankPositionalAssignment() and use this in place of
(paramIndex + 1) in a couple of places.

This fixes a bug with completion, so we also update a test to check that
we get this right.
boolgroup-773565: Extract addSpace function

The final thing that we need to fix is the need to add a space in the
'already-complete' case, in addition to the current case. So it makes
sense to extract an addSpace function to handle both.

In addition there is some code that I don't understand, but which is
required. I raised bug 779443 to sort it out.
boolgroup-773565: TAB should add space

No predictions generally means we shouldn't change anything on TAB, but
TAB has the connotation of 'next thing' and when we're at the end of
a thing that implies that we should add a space.
So call _addSpace() in this extra case.

Also add tests for this case, and the cases were this should not fire.
boolgroup-773565: Fix test harness

Yikes! Discovered that helpers was testing "if (x)" which was not running
tests when the thing to check for was empty string. The check should be
"if (x != null)".

The bad news is that this simple mistake was made many times.

The good news is that this only affected one test, and that was a case of
the test being wrong rather than being an undetected bug.
boolgroup-773565: Move getPredictionAt

Conversion had a getPredictionAt function. Moving this to Assignment will
allow us to exclude predictions when we in the name part of a named
argument (although that is not part of this changeset).

This also defaults the index to zero, which seems sensible, and fixes some
cut and paste documentation in Conversion.constrainPredictionIndex()
boolgroup-773565: Add Assignment.isInName()

Create a separate function to detect if we are in the name part of a named
argument.
boolgroup-773565: Upgrade Argument.beget

We previously assumed that you would only need to add spaces to the start
of a prefix or end of a suffix, however the split nature of a named
argument means we also need to add a space to the end of a prefix. So we
add a prefixPostSpace option.

Also NamedArgument used to create valueArg replacements whether or not they
were needed. This blocks the fix that we're currently working on so we
only add a valueArg replacement when there is one already or we need one
to hold added text.
boolgroup-773565: Make named arg completions more normal

Alter Assignment.getPredictionAt to not show predictions when we're in the
name part of a named argument, and use getPredictionAt rather than
getPredictions().length to decide how to complete. This means we handle
predictions for named arguments just like other arguments.

Also add a space if TAB is pressed we are in the name part of an
assignment to match the behaviour when we press TAB at the end of a
command.

This changeset also tidies up a few tests by moving some tests into a new
testNoTab function, and removes a blank testBlank function.
boolgroup-773565: Make all hints visible

Earlier in this branch we tried an experiment with not showing some of the
hints when we had directTabText for named arguments. The goal of allowing the
user to 'concentrate on the thing in hand' is a good one, but deciding when
to simplify is complex and often debatable. So this changeset makes all hints
available always.

This change also breaks some tests, they will be fixed by the very next commit.
While this is bisect unsafe, it is my estimation that this breakage will cost
less than the time to rebase between the 2 changesets.
boolgroup-773565: Tests and Completer updates

The previous commit broke some tests around spaces in the completer. This
fixes that.

The problem was that adding space prefixes is complex. Much better to use
space suffixes and not worry about trailing spaces. So this changeset
simplifies completer.js to use space suffixes.

The effect of this is to break a huge number of tests because we need to move
spaces around. So I took this opportunity to combine directTabText,
emptyParameters, and arrowTabText into a single test called 'hints'.
boolgroup-773565: Hide local testing file from git

Now you don't need to edit index.html with test stuff
boolgroup-773565: Add test case

There is a case that we have not fixed, but this branch is already too big
so I've raised a bug and we can come back to it.