Skip to content

Commit 4482f88

Browse files
committed
Fix cannot show results after changed active TextEditor.
1 parent c3f52aa commit 4482f88

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Decorator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const colorMap = {
2323
'Console': '#457abb',
2424
'Error': 'red',
2525
}
26+
// TODO: if Node's Version of VSCode >=9.9, use option `compact`
2627
const inspectOptions = { maxArrayLength: null, depth: null };
2728

2829
type Data = { line: number, type: 'Expression' | 'Terminal', value: any };

src/ReplClient.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ export default class ReplClient {
3838
this.decorator = new Decorator(outputChannel);
3939

4040
this.changeActiveDisposable = window.onDidChangeActiveTextEditor(async (editor) => {
41-
if (this.editor === editor)
41+
if (this.editor && this.editor.document === editor.document) {
42+
this.init(editor, editor.document);
4243
this.interpret();
44+
}
4345
});
4446

4547
this.closeTextDocumentDisposable = workspace.onDidCloseTextDocument(async (document) => {
@@ -122,8 +124,6 @@ export default class ReplClient {
122124
if (this.outputChannel)
123125
this.outputChannel.appendLine(`Disposing REPL server.`);
124126

125-
this.editor = null;
126-
127127
this.repl.send({ operation: 'exit' });
128128
this.repl = null;
129129
}

0 commit comments

Comments
 (0)