vscode-pi-companion 0.1.5 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/index.ts +7 -3
- package/package.json +1 -1
package/extensions/index.ts
CHANGED
|
@@ -47,6 +47,7 @@ let lastWidgetKey = "";
|
|
|
47
47
|
let widgetDebounceTimer: NodeJS.Timeout | undefined;
|
|
48
48
|
let reconnectTimer: NodeJS.Timeout | undefined;
|
|
49
49
|
let sseRequest: http.ClientRequest | undefined;
|
|
50
|
+
let isConnected = false;
|
|
50
51
|
|
|
51
52
|
function isRunningInVSCode(): boolean {
|
|
52
53
|
return process.env.TERM_PROGRAM === "vscode";
|
|
@@ -137,13 +138,15 @@ async function getLivePort(): Promise<number | undefined> {
|
|
|
137
138
|
function updateWidget(): void {
|
|
138
139
|
if (!currentCtx) return;
|
|
139
140
|
|
|
141
|
+
const connectionStatus = isConnected ? "Connected" : "Disconnected";
|
|
142
|
+
|
|
140
143
|
if (!currentContext || !currentContext.workspaceState.openFiles.length) {
|
|
141
|
-
currentCtx.ui.setWidget("pi-companion", [
|
|
144
|
+
currentCtx.ui.setWidget("pi-companion", [`VS Code: ${connectionStatus} • No files open`]);
|
|
142
145
|
return;
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
const { workspaceState } = currentContext;
|
|
146
|
-
const lines: string[] = [];
|
|
149
|
+
const lines: string[] = [`VS Code: ${connectionStatus}`];
|
|
147
150
|
const activeFile = workspaceState.openFiles.find((f) => f.isActive);
|
|
148
151
|
|
|
149
152
|
if (activeFile) {
|
|
@@ -190,6 +193,8 @@ async function connectSSE(): Promise<void> {
|
|
|
190
193
|
path: "/context/stream",
|
|
191
194
|
},
|
|
192
195
|
(res) => {
|
|
196
|
+
isConnected = true;
|
|
197
|
+
updateWidget();
|
|
193
198
|
let buffer = "";
|
|
194
199
|
|
|
195
200
|
res.on("data", (chunk: string) => {
|
|
@@ -260,7 +265,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
260
265
|
|
|
261
266
|
const port = await getLivePort();
|
|
262
267
|
if (port) {
|
|
263
|
-
ctx.ui.notify("PI Companion: Connected to VS Code", "info");
|
|
264
268
|
await connectSSE();
|
|
265
269
|
} else {
|
|
266
270
|
ctx.ui.notify("PI Companion: VS Code companion server not running. Run 'PI Companion: Start Server' in VS Code.", "warning");
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"displayName": "PI Companion",
|
|
4
4
|
"description": "Share VS Code context with pi coding agent",
|
|
5
5
|
"repository": "https://github.com/ravshansbox/vscode-pi-companion",
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.9",
|
|
7
7
|
"publisher": "ravshansbox",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"pi-package"
|