<commit_before>import {Server} from './server';
import {TextEditor, OutputChannel, TextEditorEdit} from 'vscode';
import * as vscode from 'vscode';

let outputChannel : OutputChannel;

export function displayGoalAtPosition(
    server : Server,
    editor : TextEditor,
    edit : TextEditorEdit,
    args : any[])
{
    outputChannel = vscode.window.createOutputChannel("Lean: Proof Context");

    let cursor = editor.selection.active;
    let fileName = editor.document.fileName;

    server.info(fileName, cursor.line + 1, cursor.character).then((response) => {
        if (response.record && response.record.state) {
            outputChannel.appendLine(response.record.state);
            // Ensure we perserve focus.
            outputChannel.show(true)
        } else {
            return null;
        }
    });
}<commit_msg>Attempt at addressing issue #2, only use a single channel<commit_after>import {Server} from './server';
import {TextEditor, OutputChannel, TextEditorEdit} from 'vscode';
import * as vscode from 'vscode';

let outputChannel : OutputChannel;

export function displayGoalAtPosition(
    server : Server,
    editor : TextEditor,
    edit : TextEditorEdit,
    args : any[])
{
    outputChannel = outputChannel || vscode.window.createOutputChannel("Lean: Proof Context");

    let cursor = editor.selection.active;
    let fileName = editor.document.fileName;

    server.info(fileName, cursor.line + 1, cursor.character).then((response) => {
        if (response.record && response.record.state) {
            outputChannel.clear();
            outputChannel.appendLine(response.record.state);
            // Ensure we perserve focus.
            outputChannel.show(true)
        } else {
            return null;
        }
    });
}
{'fraction_non_alphanumeric': 0.11224489795918367, 'fraction_numerical': 0.0017006802721088435, 'mean_word_length': 2.975225225225225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5722226', 'n_tokens_mistral': 485, 'n_tokens_neox': 482, 'n_words': 121}