nrepl: allow customizing nrepl port (#334)

Fixes #320
This commit is contained in:
Tyler Wilding 2024-01-25 21:26:52 -05:00 committed by GitHub
parent 6f045ccc3f
commit b3ce6e7ef4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 2 deletions

View file

@ -191,6 +191,11 @@
"id": "opengoal-repl",
"title": "REPL",
"properties": {
"opengoal.replPort": {
"type": "number",
"default": 8181,
"description": "Port for the nREPL server"
},
"opengoal.replAutoJackIn": {
"type": "boolean",
"default": false,

View file

@ -5,6 +5,7 @@ export function getConfig() {
return {
opengoalParinferMode: configOptions.get<string>("parinferMode"),
replPort: configOptions.get<number>("replPort"),
autoReplJackIn: configOptions.get<boolean>("replAutoJackIn"),
reloadFileOnSave: configOptions.get<boolean>("reloadFileOnSave"),
launchLspOnStartup: configOptions.get<boolean>("launchLspOnStartup"),

View file

@ -37,8 +37,11 @@ export async function jackIn() {
socket = new PromiseSocket();
socket.setEncoding("utf8");
socket.socket.setTimeout(100);
await socket.connect(8181, "127.0.0.1");
jackedIn = true;
const port = getConfig().replPort;
if (port !== undefined) {
await socket.connect(port, "127.0.0.1");
jackedIn = true;
}
} catch (e) {
console.error(e);
socket = undefined;