1
1
import * as vscode from "vscode"
2
- import * as path from "path"
3
2
import ChokiExtension from "../utilities/watchFile"
4
3
import { getLama2Command , getShowLama2Term } from "../utilities/utils"
5
4
import { splitLama2Output } from "../commands/ExecuteCurrentFile/parseOut"
6
5
import { getUri } from "../utilities/getUri"
7
6
import { getNonce } from "../utilities/getNonce"
8
- import { exec } from "child_process"
9
- import * as fs from "fs"
10
7
11
8
export class Lama2Panel {
12
9
public static currentPanel : Lama2Panel | undefined
@@ -42,6 +39,8 @@ export class Lama2Panel {
42
39
Lama2Panel . currentPanel . _panel . reveal ( vscode . ViewColumn . Two , true )
43
40
} else {
44
41
console . log ( "opening new panel" )
42
+ vscode . commands . executeCommand ( 'workbench.action.closePanel' ) ;
43
+
45
44
// If a webview panel does not already exist create and show a new one
46
45
const panel = vscode . window . createWebviewPanel (
47
46
// Panel view type
@@ -90,12 +89,19 @@ export class Lama2Panel {
90
89
const { cmd, rflag, rfile, rlog } = lama2Command
91
90
this . rfile = rfile
92
91
this . rlog = rlog
92
+ this . terminal = getShowLama2Term ( "AutoLama2" )
93
93
this . setLama2Watch ( rflag )
94
94
95
95
// Execute command and capture output
96
- this . terminal = getShowLama2Term ( "AutoLama2" )
96
+
97
+
97
98
this . terminal . sendText ( cmd , true )
99
+ this . terminal . show ( true )
100
+ vscode . commands . executeCommand ( 'workbench.action.closePanel' ) ;
101
+
102
+
98
103
console . log ( "terminal" , this . terminal . name )
104
+ console . log ( "terminal-process" , this . terminal . processId )
99
105
}
100
106
catch ( error ) {
101
107
console . error ( "Error executing Lama2 command:" , error )
@@ -105,6 +111,8 @@ export class Lama2Panel {
105
111
106
112
private setLama2Watch ( rflag : string ) {
107
113
let c = new ChokiExtension ( )
114
+ console . log ( "setLama2Watch" , rflag )
115
+ console . log ( this . terminal ?. name )
108
116
c . pathAddTrigger ( rflag , this . onLama2Finish , this )
109
117
}
110
118
@@ -124,6 +132,7 @@ export class Lama2Panel {
124
132
}
125
133
126
134
private async onLama2Finish ( output : string ) {
135
+ console . log ( "onLama2Finish" , output )
127
136
try {
128
137
output = this . rfile
129
138
if ( typeof output === "string" && output . trim ( ) . startsWith ( "<" ) ) {
0 commit comments