vscode-pi-companion 0.2.9 → 0.2.11
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 +13 -6
- package/extensions/package.json +1 -0
- package/package.json +1 -11
package/extensions/index.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
8
9
|
import * as fs from "fs";
|
|
9
10
|
import * as path from "path";
|
|
10
11
|
import * as os from "os";
|
|
@@ -135,21 +136,25 @@ async function getLivePort(): Promise<number | undefined> {
|
|
|
135
136
|
return (await isPortAlive(info.port)) ? info.port : undefined;
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
function setWidget(text: string): void {
|
|
140
|
+
currentCtx?.ui.setWidget("pi-companion", () => new Text(text, 0, 0));
|
|
141
|
+
}
|
|
142
|
+
|
|
138
143
|
function updateWidget(): void {
|
|
139
144
|
if (!currentCtx) return;
|
|
140
145
|
|
|
141
146
|
if (!isConnected) {
|
|
142
|
-
|
|
147
|
+
setWidget("vscode: disconnected");
|
|
143
148
|
return;
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
if (!currentContext) {
|
|
147
|
-
|
|
152
|
+
setWidget("vscode: connected");
|
|
148
153
|
return;
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
if (!currentContext.workspaceState.openFiles.length) {
|
|
152
|
-
|
|
157
|
+
setWidget("vscode: no files");
|
|
153
158
|
return;
|
|
154
159
|
}
|
|
155
160
|
|
|
@@ -162,17 +167,19 @@ function updateWidget(): void {
|
|
|
162
167
|
let location = "";
|
|
163
168
|
if (activeFile.selectionStart && activeFile.selectionEnd) {
|
|
164
169
|
const start = activeFile.selectionStart.line;
|
|
165
|
-
const end = activeFile.selectionEnd.line
|
|
170
|
+
const end = activeFile.selectionEnd.character === 1 && activeFile.selectionEnd.line > start
|
|
171
|
+
? activeFile.selectionEnd.line - 1
|
|
172
|
+
: activeFile.selectionEnd.line;
|
|
166
173
|
location = start === end ? ` L${start}` : ` L${start}:${end}`;
|
|
167
174
|
}
|
|
168
175
|
const label = filenames.length === 1
|
|
169
176
|
? `${filename}${location}`
|
|
170
177
|
: `${filename}${location} +${filenames.length - 1}`;
|
|
171
|
-
|
|
178
|
+
setWidget(label);
|
|
172
179
|
return;
|
|
173
180
|
}
|
|
174
181
|
|
|
175
|
-
|
|
182
|
+
setWidget(filenames.join(", "));
|
|
176
183
|
}
|
|
177
184
|
|
|
178
185
|
async function connectSSE(): Promise<void> {
|
package/extensions/package.json
CHANGED
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.2.
|
|
6
|
+
"version": "0.2.11",
|
|
7
7
|
"publisher": "ravshansbox",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"pi-package"
|
|
@@ -49,16 +49,6 @@
|
|
|
49
49
|
"onStartupFinished"
|
|
50
50
|
],
|
|
51
51
|
"contributes": {
|
|
52
|
-
"configuration": {
|
|
53
|
-
"title": "PI Companion",
|
|
54
|
-
"properties": {
|
|
55
|
-
"piCompanion.port": {
|
|
56
|
-
"type": "number",
|
|
57
|
-
"default": 8765,
|
|
58
|
-
"description": "Port for MCP server"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
52
|
"commands": [
|
|
63
53
|
{
|
|
64
54
|
"command": "pi-companion.start",
|