vscode-pi-companion 0.0.10
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/.github/workflows/publish.yml +62 -0
- package/.github/workflows/release.yml +19 -0
- package/.vscode/launch.json +17 -0
- package/.vscode/tasks.json +12 -0
- package/.vscodeignore +12 -0
- package/LICENSE +1 -0
- package/README.md +83 -0
- package/extensions/index.ts +370 -0
- package/extensions/package.json +9 -0
- package/package.json +88 -0
- package/screenshot.png +0 -0
- package/src/extension.ts +84 -0
- package/src/ide-server.ts +381 -0
- package/src/open-files-manager.ts +249 -0
- package/src/types.ts +66 -0
- package/tsconfig.json +16 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A file that is open in the IDE.
|
|
5
|
+
*/
|
|
6
|
+
export const FileSchema = z.object({
|
|
7
|
+
path: z.string(),
|
|
8
|
+
timestamp: z.number(),
|
|
9
|
+
isActive: z.boolean().optional(),
|
|
10
|
+
selectedText: z.string().optional(),
|
|
11
|
+
cursor: z.object({
|
|
12
|
+
line: z.number(),
|
|
13
|
+
character: z.number(),
|
|
14
|
+
}).optional(),
|
|
15
|
+
content: z.string().optional(),
|
|
16
|
+
});
|
|
17
|
+
export type File = z.infer<typeof FileSchema>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The context of the IDE.
|
|
21
|
+
*/
|
|
22
|
+
export const IdeContextSchema = z.object({
|
|
23
|
+
workspaceState: z.object({
|
|
24
|
+
openFiles: z.array(FileSchema).optional(),
|
|
25
|
+
isTrusted: z.boolean().optional(),
|
|
26
|
+
workspacePath: z.string().optional(),
|
|
27
|
+
}).optional(),
|
|
28
|
+
});
|
|
29
|
+
export type IdeContext = z.infer<typeof IdeContextSchema>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A notification that the IDE context has been updated.
|
|
33
|
+
*/
|
|
34
|
+
export const IdeContextNotificationSchema = z.object({
|
|
35
|
+
jsonrpc: z.literal('2.0'),
|
|
36
|
+
method: z.literal('ide/contextUpdate'),
|
|
37
|
+
params: IdeContextSchema,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Request to read a specific file.
|
|
42
|
+
*/
|
|
43
|
+
export const ReadFileRequestSchema = z.object({
|
|
44
|
+
path: z.string(),
|
|
45
|
+
});
|
|
46
|
+
export type ReadFileRequest = z.infer<typeof ReadFileRequestSchema>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Request to goto a location in the IDE.
|
|
50
|
+
*/
|
|
51
|
+
export const GotoRequestSchema = z.object({
|
|
52
|
+
path: z.string(),
|
|
53
|
+
line: z.number().optional(),
|
|
54
|
+
character: z.number().optional(),
|
|
55
|
+
});
|
|
56
|
+
export type GotoRequest = z.infer<typeof GotoRequestSchema>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Connection info written to temp file.
|
|
60
|
+
*/
|
|
61
|
+
export const ConnectionInfoSchema = z.object({
|
|
62
|
+
port: z.number(),
|
|
63
|
+
workspacePath: z.string(),
|
|
64
|
+
authToken: z.string(),
|
|
65
|
+
});
|
|
66
|
+
export type ConnectionInfo = z.infer<typeof ConnectionInfoSchema>;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"outDir": "./out",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"moduleResolution": "node"
|
|
13
|
+
},
|
|
14
|
+
"include": ["src/**/*"],
|
|
15
|
+
"exclude": ["node_modules", "out"]
|
|
16
|
+
}
|