
highlight.pl -- Highlight token server
This 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.
- To be done
- - Use websockets
current_highlight_state(?UUID, -State) is nondet- Return info on the current highlighter
prolog:xref_open_source(+UUID, -Stream)[multifile]- Open a source. As we cannot open the same source twice we must
lock it. As of 7.3.32 this can be done through the
prolog:xref_close_source/2 hook. In older versions we get no
callback on the close, so we must leave the editor unlocked.
show_mirror(+Role) is det
server_tokens(+Role) is det- These predicates help debugging the server side. show_mirror/0
displays the text the server thinks is in the client editor. The
predicate server_tokens/1 dumps the token list.
- Arguments:
-
Role | - is one of source or query , expressing the role of
the editor in the SWISH UI. |
swish_config:config(-Name, -Styles) is nondet[multifile]- Provides the object
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.
- To be done
- - Provide summary information
- css(?Context, ?Selector, -Style) is nondet[multifile]
- Multifile hook to define additional style to apply in a specific
context. Currently defined contexts are:
- hover
- Used for CodeMirror hover extension.
- Arguments:
-
Selector | - is a CSS selector, which is refined by Context |
Style | - is a list of Name(Value) terms. |
token_info(+Token:dict)// is det[multifile]- Generate HTML, providing details about Token. Token is a dict,
providing the enriched token as defined by style/3. This
multifile non-terminal can be hooked to provide details for user
defined style extensions.
Undocumented predicates
The following predicates are exported, but not or incorrectly documented.
man_predicate_summary(Arg1, Arg2)