In See Semantic Highlighting, we talked about how Sweep performs semantic analysis to determine the meaning of different terms in different contexts and highlight them accordingly. Beyond highlighting, Sweep can also tell you exactly what different tokens in Prolog code mean by annotating them with a textual description that’s displayed when you hover over them with the mouse.
Whether to annotate Prolog tokens with help text via the
help-echo
text property. Defaults to t
.
Display the help-echo
text of the token at point in the echo
area (display-local-help
).
If the user option sweeprolog-enable-help-echo
is
non-nil
, as it is by default, Sweep annotates Prolog tokens
with a short description of their meaning in that specific context.
This is done by adding the help-echo
text property to different
parts of the buffer based on semantic analysis. The help-echo
text is automatically displayed at the mouse tooltip when you hover
over different tokens in the buffer.
Alternatively, you can display the help-echo
text for the token
at point in the echo area by typing C-h . (C-h followed by
a dot).
The help-echo
description of file specification in import
directives is especially useful as it tells you which predicates that
the current buffer uses actually come from the imported file. For
example, if we have a Prolog file with the following contents:
:- use_module(library(lists)). foo(Foo, Bar) :- flatten(Bar, Baz), member(Foo, Baz).
Then hovering over library(lists)
shows:
Dependency on /usr/local/lib/swipl/library/lists.pl, resolves calls to flatten/2, member/2