Skip to content

Commit 341380c

Browse files
authored
Merge pull request #601 from devchat-ai/feat/add-plugin-version-service
feat: Add extension version retrieval endpoint and update GUI submodule
2 parents 53d764c + 0103014 commit 341380c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/ide_services/services.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import { getDiagnosticsInRange } from "./endpoints/documentRangeDiagnostics";
1818
import { getExtensionToolsPath } from "./endpoints/getToolsPath";
1919
import { getCollapsedCode } from "./endpoints/getCollapsedCode";
2020

21+
import * as vscode from 'vscode';
22+
2123
const functionRegistry: any = {
2224
/**
2325
* Official IDE Service Protocol Endpoints
@@ -30,6 +32,19 @@ const functionRegistry: any = {
3032
keys: [],
3133
handler: getLocalServicePort,
3234
},
35+
"/get_extension_version": {
36+
keys: [],
37+
handler: () => {
38+
// 从package.json中获取版本号
39+
const extension = vscode.extensions.all.find(ext =>
40+
ext.packageJSON.name === 'devchat' // 只匹配 name,不匹配 publisher
41+
);
42+
if (extension) {
43+
return extension.packageJSON.version;
44+
}
45+
return undefined;
46+
}
47+
},
3348
"/install_python_env": {
3449
keys: ["command_name", "requirements_file"],
3550
handler: installPythonEnv,

0 commit comments

Comments
 (0)