Fix tab-completion for :break (#17989)
In tab-completion for the :break
command, only those
identifiers should be shown, that are accepted in the
:break
command. Hence these identifiers must be
- defined in an interpreted module
- top-level
- currently in scope
- listed in a
ModBreaks
value as a possible breakpoint.
The identifiers may be qualified or unqualified.
To get all possible top-level breakpoints for tab-completeion with the correct qualification do:
-
Build the list called
pifsBreaks
of all pairs of (Identifier, module-filename) from theModBreaks
values. Here all identifiers are unqualified. -
Build the list called
pifInscope
of all pairs of (Identifiers, module-filename) with identifiers from theGlobalRdrEnv
. Take only those identifiers that are in scope and have the correct prefix. Here the identifiers may be qualified. -
From the
pifInscope
list seclect all pairs that can be found in thepifsBreaks
list, by comapring only the unqualified part of the identifier. The remaining identifiers can be used for tab-completion.
This ensures, that we show only identifiers, that can be used
in a :break
command.