Skip to content

Commit

Permalink
terminal conflict, infinite scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
LinceMathew committed Aug 26, 2024
1 parent 9ccace6 commit 453342d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/panels/RequestPanel.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import * as vscode from "vscode"
import * as path from "path"
import ChokiExtension from "../utilities/watchFile"
import { getLama2Command, getShowLama2Term } from "../utilities/utils"
import { splitLama2Output } from "../commands/ExecuteCurrentFile/parseOut"
import { getUri } from "../utilities/getUri"
import { getNonce } from "../utilities/getNonce"
import { exec } from "child_process"
import * as fs from "fs"

export class Lama2Panel {
public static currentPanel: Lama2Panel | undefined
Expand Down Expand Up @@ -42,6 +39,8 @@ export class Lama2Panel {
Lama2Panel.currentPanel._panel.reveal(vscode.ViewColumn.Two, true)
} else {
console.log("opening new panel")
vscode.commands.executeCommand('workbench.action.closePanel');

// If a webview panel does not already exist create and show a new one
const panel = vscode.window.createWebviewPanel(
// Panel view type
Expand Down Expand Up @@ -90,12 +89,19 @@ export class Lama2Panel {
const { cmd, rflag, rfile, rlog } = lama2Command
this.rfile = rfile
this.rlog = rlog
this.terminal = getShowLama2Term("AutoLama2")
this.setLama2Watch(rflag)

// Execute command and capture output
this.terminal = getShowLama2Term("AutoLama2")


this.terminal.sendText(cmd, true)
this.terminal.show(true)
vscode.commands.executeCommand('workbench.action.closePanel');


console.log("terminal", this.terminal.name)
console.log("terminal-process", this.terminal.processId)
}
catch (error) {
console.error("Error executing Lama2 command:", error)
Expand All @@ -105,6 +111,8 @@ export class Lama2Panel {

private setLama2Watch(rflag: string) {
let c = new ChokiExtension()
console.log("setLama2Watch", rflag)
console.log(this.terminal?.name)
c.pathAddTrigger(rflag, this.onLama2Finish, this)
}

Expand All @@ -124,6 +132,7 @@ export class Lama2Panel {
}

private async onLama2Finish(output: string) {
console.log("onLama2Finish", output)
try {
output = this.rfile
if (typeof output === "string" && output.trim().startsWith("<")) {
Expand Down
1 change: 1 addition & 0 deletions webview/src/pages/Response.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const Response: React.FC = () => {
useEffect(() => {
const messageListener = (event: MessageEvent) => {
const message = event.data
console.log("message", message)
if (message.command === "update") {
// console.log("message", message);

Expand Down

0 comments on commit 453342d

Please sign in to comment.