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
If the user option
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
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
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
Dependency on /usr/local/lib/swipl/library/lists.pl, resolves calls to flatten/2, member/2