Skip to content

Commit

Permalink
Make reconnect work again
Browse files Browse the repository at this point in the history
Fixes #194
  • Loading branch information
PEZ committed May 30, 2019
1 parent 539c3a0 commit caf1a5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Binary file modified alpha-build/clojure4vscode-2.0.0-SNAPSHOT.vsix
Binary file not shown.
16 changes: 9 additions & 7 deletions calva/repl-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ import select from './select';
// REPL

export function activeReplWindow() {
let currentDoc: vscode.TextDocument = util.getDocument({});
if (!currentDoc.fileName.match(/\.clj[cs]$/)) {
for (let w in replWindows) {
if (replWindows[w].panel.active)
return replWindows[w];
}
for (let w in replWindows) {
if (replWindows[w].panel.active)
return replWindows[w];
}
return undefined;
}
Expand Down Expand Up @@ -187,12 +184,17 @@ export async function reconnectReplWindow(mode: "clj" | "cljs") {
}

export async function openReplWindow(mode: "clj" | "cljs" = "clj", preserveFocus: boolean = false) {
let session = mode == "clj" ? cljSession : cljsSession,
nreplClient = session.client;

if (replWindows[mode]) {
if (!nreplClient.sessions[replWindows[mode].session.sessionId]) {
replWindows[mode].session = await session.clone();
}
replWindows[mode].panel.reveal(vscode.ViewColumn.Two, preserveFocus);
return replWindows[mode];
}

let session = mode == "clj" ? cljSession : cljsSession;
if (!session) {
vscode.window.showErrorMessage("Not connected to nREPL");
return;
Expand Down

0 comments on commit caf1a5b

Please sign in to comment.