All predicatesShow sourcetemplate_hint.pl -- Generate template hints for CondeMirror

Provide templates for the Prolog template-hinting functionality of the SWISH editor.

To be done
- For which predicates should we generate templates? Should we provide templates on demand?
- What about safely?
- Dedicated template for the rendering support?
Source visible_predicate_templates(+Module, +Options, -Templates) is det
True when Templates is a JSON dict holding autocompletion templates for Module.
Source visible_predicate(?PI, +Module, +Options) is nondet
True when PI is a plain predicate indicator for a predicate that can be called in Module. Additional options:
safe(+Boolean)
If true, filter out unsafe predicates.
autoload(+Boolean)
Load autoloadable predicates.
Source visible_from(+Spec, -PI, +Module, +Options) is nondet[private]
Provide complates from a selected specification. Defined specifications are built_in or the specification of a file, e.g., library(lists).
Source safe(+Goal, +Options) is semidet[private]
True if Goal is sometimes safe. Note that meta-predicates are never immediately safe.
Source predicate_template(:PI, -Template:json) is semidet
Arguments:
Template- is a dict holding the keys below. Only mode is guaranteed to be present.
mode
String holding the mode-line. Always present.
summary
Summary description.
iso
true if the predicate is an ISO predicate.
determinism
Determinism indicator (if known)
To be done
- Deal with locally redefined predicates, etc.
Source man_predicate_info(+PI, -Pair) is nondet[private]
Extract the mode line from the SWI-Prolog manual.
Source pldoc_predicate_info(+PI, -ModeLine) is semidet[private]
Source rendering_template(-Template)[private]
Create a template for the SWISH rendering modules.
Source library_template(-Template, +Options) is det[private]
Produce a template for selecting libraries. By default, this enumerates all Prolog files under the file alias library. If Options includes from(FromList), this is interpreted similar to visible_predicate/3.
Source library_files(+Alias, +SubDir, -Files, -Dirs)[private]
True when Files is a list of files that can be loaded from Alias(SubDir) and Dirs is a list of sub directories of Files.
Source library_template_from(+From:list, -Template) is det[private]
As library_template/1, but build the completion list from a given set of libraries.
Source imported_library(+Module, -Library) is nondet[private]
True when Library is imported into Module.
Source visible_lib(+Module, -Lib) is nondet[private]
Enumerate modules imported into Module and generally useful modules.
Source swish_config:config(-Name, -Styles) is det[multifile]
Provides the object config.swish.templates, a JSON object that provides the templates for hinting in CodeMirror.