prolog input field does not work
I am amazed that this plugin can run Prolog with no installation required. I always liked Prolog, and running it in Obsidian is soo cool! But I have found an issue. So here is my prolog code :
pere(serge,sylvain).
pere(serge,remi).
pere(remi,nathan).
pere(sylvain,erin).
pere(sylvain,anaelle).
grandPere(G,P) :- pere(G,F), pere(F,P).
% query
grandPere(X,Y).
It works, and give the expected results:
X = serge, Y = erin
X = serge, Y = anaelle
X = serge, Y = nathan
Running it also creates a text input field just below, to enter new goals, which is fine. What is not is, when I entered a new goal in this field such as "pere(serge,Y).", there is no output. The input field does not work.
I tried to debug this, and opened the debugger. I found the issue seems to be in Outputter.ts, where the function processInput calls this.emit("data", input);. with input being my query string. Fine, but it seems that the emit function needs to find a handler using const handler = events[type]; with type = "data". The problem is, events does not have any properties and so the handler gets undefined and the function returns false.
Hoping this short analysis helps a bit to find the origine of this bug, best regards.
It doesn't run "real" prolog (that's why extensions like CHR don't work) but Tau Prolog, a JavaScript implementation of Prolog. The input field that pops up is considered a bug we are working on.
But I think your Idea to add new queries is really good. We will consider adding this instead of just fixing it.