Merge branch 'main' of https://github.com/LSTM-Kirigaya/openmcp-client
This commit is contained in:
commit
a8cde189e5
9490
package-lock.json
generated
9490
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
88
package.json
88
package.json
@ -1,58 +1,36 @@
|
|||||||
{
|
{
|
||||||
"name": "openmcp",
|
"name": "openmcp",
|
||||||
"displayName": "openmcp",
|
"displayName": "openmcp",
|
||||||
"description": "A MCP Client for MCP/OpenMCP",
|
"description": "A MCP Client for MCP/OpenMCP",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.98.0"
|
"vscode": "^1.98.0"
|
||||||
},
|
},
|
||||||
"categories": [
|
"categories": [
|
||||||
"Other"
|
"Other"
|
||||||
],
|
],
|
||||||
"activationEvents": [
|
"activationEvents": [
|
||||||
"*"
|
],
|
||||||
],
|
"main": "./dist/extension.js",
|
||||||
"main": "./dist/extension.js",
|
"contributes": {
|
||||||
"contributes": {
|
"viewsContainers": {
|
||||||
"commands": [
|
"activitybar": [
|
||||||
{
|
{
|
||||||
"command": "openmcp.helloWorld",
|
"id": "openmcp-sidebar",
|
||||||
"title": "Hello World"
|
"title": "OpenMCP",
|
||||||
}
|
"icon": "./icons/protocol.svg"
|
||||||
],
|
|
||||||
"views": {
|
|
||||||
"explorer": [
|
|
||||||
{
|
|
||||||
"id": "webview-sidebar.view",
|
|
||||||
"icon": "./icons/protocol.svg",
|
|
||||||
"name": "WebView"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
},
|
"views": {
|
||||||
"scripts": {
|
"openmcp-sidebar": [
|
||||||
"vscode:prepublish": "npm run package",
|
{
|
||||||
"compile": "webpack",
|
"id": "webview-sidebar.view",
|
||||||
"watch": "webpack --watch",
|
"icon": "./icons/protocol.svg",
|
||||||
"package": "webpack --mode production --devtool hidden-source-map",
|
"name": "chatbot",
|
||||||
"compile-tests": "tsc -p . --outDir out",
|
"type": "webview"
|
||||||
"watch-tests": "tsc -p . -w --outDir out",
|
}
|
||||||
"pretest": "npm run compile-tests && npm run compile && npm run lint",
|
]
|
||||||
"lint": "eslint src",
|
}
|
||||||
"test": "vscode-test"
|
}
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/vscode": "^1.98.0",
|
|
||||||
"@types/mocha": "^10.0.10",
|
|
||||||
"@types/node": "20.x",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
|
||||||
"@typescript-eslint/parser": "^8.25.0",
|
|
||||||
"eslint": "^9.21.0",
|
|
||||||
"typescript": "^5.7.3",
|
|
||||||
"ts-loader": "^9.5.2",
|
|
||||||
"webpack": "^5.98.0",
|
|
||||||
"webpack-cli": "^6.0.1",
|
|
||||||
"@vscode/test-cli": "^0.0.10",
|
|
||||||
"@vscode/test-electron": "^2.4.1"
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,17 +1,10 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
export function activate(context: vscode.ExtensionContext) {
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
// 注册 WebView 视图
|
console.log('activate openmcp'); // 确保插件已激活
|
||||||
console.log('activate');
|
|
||||||
|
|
||||||
const provider = new WebviewViewProvider(context.extensionUri);
|
const provider = new WebviewViewProvider(context.extensionUri);
|
||||||
|
|
||||||
context.subscriptions.push(
|
|
||||||
vscode.commands.registerCommand('openmcp.helloWorld', () => {
|
|
||||||
vscode.window.showInformationMessage('Hello World!');
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
context.subscriptions.push(
|
context.subscriptions.push(
|
||||||
vscode.window.registerWebviewViewProvider('webview-sidebar.view', provider)
|
vscode.window.registerWebviewViewProvider('webview-sidebar.view', provider)
|
||||||
);
|
);
|
||||||
@ -20,13 +13,19 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
class WebviewViewProvider implements vscode.WebviewViewProvider {
|
class WebviewViewProvider implements vscode.WebviewViewProvider {
|
||||||
constructor(private readonly _extensionUri: vscode.Uri) {}
|
constructor(private readonly _extensionUri: vscode.Uri) {}
|
||||||
|
|
||||||
public resolveWebviewView(webviewView: vscode.WebviewView) {
|
public resolveWebviewView(
|
||||||
|
webviewView: vscode.WebviewView,
|
||||||
|
_context: vscode.WebviewViewResolveContext,
|
||||||
|
_token: vscode.CancellationToken,
|
||||||
|
) {
|
||||||
|
console.log('resolveWebviewView called'); // 确保方法被调用
|
||||||
webviewView.webview.options = {
|
webviewView.webview.options = {
|
||||||
enableScripts: true, // 启用 JavaScript
|
enableScripts: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 设置 WebView 的 HTML 内容
|
const html = getWebviewContent();
|
||||||
webviewView.webview.html = getWebviewContent();
|
console.log('WebView HTML:', html); // 检查 HTML 内容
|
||||||
|
webviewView.webview.html = html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user