The discussion revolves around an issue with emoji autocompletion in code blocks on the SWI-Prolog Discourse forum. Jan_Wielemaker reports that the :- syntax in Prolog is being converted into a smiley, disrupting code readability. Falco suggests adjusting the emoji autocomplete min chars setting to 3 or 4, which helps but doesn’t fully resolve the issue. Jan_Wielemaker expresses a preference for disabling emoji autocompletion entirely within code. sam explains the technical challenge of detecting code blocks due to the complexity of parsing editor text. The community acknowledges the need for better code handling, with Falco noting that a fix is being developed, referencing a GitHub pull request here.
We poor Prolog users at https://swi-prolog.discourse.group have some trouble trying to enter the most basic part of the Prolog syntax: rules have :- between head and body and it is good practice to put a line break after the :-. This however insists on inserting a smiley, so our code looks like this
p :-1:
q.
instead of
p :-
q.
As you can see, the smiley doesn’t even show up inside the code. It would be nice if smiley completion was disabled inside code blocks.
Thanks. The default is not 3 but 0 and 3 is long enough. This is a big improvement for us. Somehow it still feels right not to do emoji autocompletion at all inside code …
Understood, it is very tricky though with our current parser cause we can not efficiently reverse map text in the editor to type of element that you are in the middle of typing.
A trivial regex here counting ``` which are followed by a bit of text and a newline, kind of works but then there is [code] and 3 space indent as well to worry about.
This is definitely something we are thinking about and have similar request (basic markdown highlighting) which would also lean on a similar feature.