Wrong start Prolog in SublimeREPL

543 Views Asked by At

I want to use Prolog in SublimeREPL. I set up correctly the interpreter (swipl or gprolog) in the config file of SublimeREPL and everything works fine except for one thing: the start character "?-" of the line never show up, an if a get a result like "X=1" when I press Enter what happen in the terminal is print a dot "X=1." and make a new line starting with "?-". In SublimeREPL there is no dot and the new line doesn't start with anything. Is there a solution for have the same behavior of the terminal?

1

There are 1 best solutions below

8
On

I have partial success with Sublime Text 2 running on MacOS X by using the following Main.sublime-menu file contents:

[
     {
        "id": "tools",
        "children":
        [{
            "caption": "SublimeREPL",
            "mnemonic": "r",
            "id": "SublimeREPL",
            "children":
            [
                {"command": "repl_open", 
                 "caption": "Prolog",
                 "id": "repl_prolog",
                 "mnemonic": "l",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "cmd": ["gprolog"],
                    "cwd": "$file_path",
                    "external_id": "prolog",
                    "syntax": "Packages/Logtalk/Logtalk.tmLanguage"
                    }
                }
            ]   
        }]
    }
]

I get the GNU Prolog startup banner and I can type queries and get the query results. But there's an issue that I have not yet solved with the handling of new lines: when typing ; to ask the Prolog interpreter for the next proof, I cannot get the last one. For example:

GNU Prolog 1.4.4 (64 bits)
Compiled Apr 23 2013, 17:24:33 with /opt/local/bin/gcc-apple-4.2
By Daniel Diaz
Copyright (C) 1999-2013 Daniel Diaz
| ?- member(X, [1,2,3]).


X = 1 ? ;
;

X = 2 ? 

yes
| ?- 

Seems to be a problem handling echo and new lines. The first ; is echoed but then I don't get a chance to type a second ; after getting the second solution.