vscode-pi-companion 0.1.5 → 0.2.0
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";
|
|
@@ -138,7 +139,9 @@ function updateWidget(): void {
|
|
|
138
139
|
if (!currentCtx) return;
|
|
139
140
|
|
|
140
141
|
if (!currentContext || !currentContext.workspaceState.openFiles.length) {
|
|
141
|
-
|
|
142
|
+
// Show "Connected" only while waiting for file context, or "Disconnected" if not connected
|
|
143
|
+
const status = isConnected ? "VS Code: Connected" : "VS Code: Disconnected";
|
|
144
|
+
currentCtx.ui.setWidget("pi-companion", [status]);
|
|
142
145
|
return;
|
|
143
146
|
}
|
|
144
147
|
|
|
@@ -159,7 +162,7 @@ function updateWidget(): void {
|
|
|
159
162
|
|
|
160
163
|
const otherCount = workspaceState.openFiles.length - 1;
|
|
161
164
|
if (otherCount > 0) {
|
|
162
|
-
lines.push(` +${otherCount} more file${otherCount > 1 ? "s" : ""}
|
|
165
|
+
lines.push(` +${otherCount} more file${otherCount > 1 ? "s" : ""}`);
|
|
163
166
|
}
|
|
164
167
|
|
|
165
168
|
const widgetKey = lines.join("|");
|
|
@@ -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.
|
|
6
|
+
"version": "0.2.0",
|
|
7
7
|
"publisher": "ravshansbox",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"pi-package"
|