
highlight.pl -- Highlight token serverThis module provides the Prolog part of server-assisted highlighting for SWISH. It is implemented by managing a shadow copy of the client editor on the server. On request, the server computes a list of semantic tokens.
codemirror_change(+Request)[private]list(atom) of removed textlist(atom) of inserted text
Reply is JSON and either 200 with true or 409 indicating that
the editor is not known.
apply_change(+TB, -Changed, +Changes) is det[private]
create_editor(+UUID, -Editor, +Change) is det[private]
current_highlight_state(?UUID, -State) is nondet
uuid_like(+UUID) is semidet[private]
destroy_editor(+UUID)[private]
gc_editors[private]
fetch_editor(+UUID, -MemFile) is semidet[private]
check_unlocked(+Reason)[private]
update_access(+UUID)[private]
prolog:xref_open_source(+UUID, -Stream)[multifile]
codemirror_leave(+Request)[private]
mark_changed(+MemFile, ?Changed) is det[private]
xref(+UUID) is det[private]
xref_source_id(+Editor, -SourceID) is det[private]
xref_state_module(+UUID, -Module) is semidet[private]
codemirror_tokens(+Request)[private]
json_source_id(+Input, -SourceID)[private]
shadow_editor(+Data, -MemoryFile) is det[private]text property, create one
from the text.role property, create an empty one.This predicate fails if the server thinks we have an editor with state that must be reused, but this is not true (for example because we have been restarted).
show_mirror(+Role) is det
server_tokens(+Role) is det
server_tokens(+TextBuffer, -Tokens) is det[private]
group_by_term(+Tokens, -Nested) is det[private]fullstop token
that is emitted at the end of each input term.
json_token(+TB, -Start, -JSON) is nondet[private]
style(+StyleIn) is semidet[private]
style(+StyleIn, -SWISHType:atomOrPair, -Attributes:list)[private]text.
The latter is mapped to text(String), where String contains the
text that matches the token character range.
The resulting JSON token object has a property type,
containing the SWISHType and the properties defined by
Attributes.
Additional translations can be defined by adding rules for the
multifile predicate style/3. The base type, which refers
to the type generated by the SWISH tokenizer must be specified
by adding an attribute base(BaseType). For example, if the
colour system classifies an atom as refering to a database
column, library(prolog_colour) may emit db_column(Name) and the
following rule should ensure consistent mapping:
swish_highlight:style(db_column(Name),
db_column, [text, base(atom)]).
goal_arity(+Goal, -Arity) is det[private]
swish_config:config(-Name, -Styles) is nondet[multifile]config.swish.style, a JSON object that
maps style properties of user-defined extensions of
library(prolog_colour). This info is used by the server-side
colour engine to populate the CodeMirror styles.
x11_color(+Name, -R, -G, -B)[private]
token_info(+Request)[private]
token_info(+Token:dict)// is det[multifile]
token_predicate_module(+Token, -Module) is semidet[private]
predicate_info(+PI, -Info:list(dict)) is det[private]true if the predicate is an ISO predicate
predicate_info(?PI, -Key, -Value) is nondet[private]The following predicates are exported, but not or incorrectly documented.
man_predicate_summary(Arg1, Arg2)