0

I'm trying to set up a Sublime Text Repl for Postgres using Sublime Repl.

I've set up a new folder in Users/Packages/SublimeRepl/config called Postgres and added two files:

Main.sublime-menu has the following content

[
     {
        "id": "tools",
        "children":
        [{
            "caption": "SublimeREPL",
            "mnemonic": "R",
            "id": "SublimeREPL",
            "children":
            [
                {"command": "repl_open", 
                 "caption": "PSQL",
                 "id": "repl_psql",
                 "mnemonic": "Q",
                 "args": {
                    "type": "subprocess",
                    "encoding": {"windows": "$win_cmd_encoding",
                                 "linux": "utf-8",
                                 "osx": "utf-8"},
                    "cmd": {"windows": ["psql.exe", "-a"],
                            "linux": ["psql","-U","tahnoon"],
                            "osx": ["psql","-U","tahnoon"]},
                    "cwd": "$file_path",
                    "cmd_postfix": "\n", 
                    "env": {},
                    "suppress_echo": false, 
                    "syntax": "Packages/SQL/SQL.tmLanguage"
                    }
                }
            ]   
        }]
    }
]

and Default.sublime-commands has the following content

[
    {
        "caption": "SublimeREPL: PSQL",
        "command": "run_existing_window_command", "args":
        {
            "id": "repl_psql",
            "file": "config/Postgres/Main.sublime-menu"
        }
    }
]

If I launch a repl and try and Eval from a file called test.sql with Ctrl+,F I get an error message Cannot Find Repl for 'sql'.

What am I doing wrong?

MattDMo
  • 100,794
  • 21
  • 241
  • 231
Tahnoon Pasha
  • 5,848
  • 14
  • 49
  • 75

1 Answers1

0

Discovered that the following key-value "external_id":"sql" does the trick:

[
     {
        "id": "tools",
        "children":
        [{
            "caption": "SublimeREPL",
            "mnemonic": "R",
            "id": "SublimeREPL",
            "children":
            [
                {"command": "repl_open", 
                 "caption": "PSQL",
                 "id": "repl_sql",
                 "mnemonic": "Q",
                 "args": {
                    "type": "subprocess",
                    "encoding": {"windows": "$win_cmd_encoding",
                                 "linux": "utf-8",
                                 "osx": "utf-8"},
                    "cmd": {"windows": ["psql.exe","-U","tahnoon"],
                            "linux": ["psql","-U","tahnoon"],
                            "osx": ["psql","-U","tahnoon"]},
                    "cwd": "$file_path",
                    "cmd_postfix": "\n", 
                    "cwd": "$file_path",
                    "external_id": "sql",
                    "suppress_echo": false, 
                    "syntax": "Packages/SQL/SQL.tmLanguage"
                    }
                }
            ]   
        }]
    }
]
Tahnoon Pasha
  • 5,848
  • 14
  • 49
  • 75