
typefox/vscode-messenger
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
VSコード拡張プラットフォーム用のRPCメッセージングライブラリ
概要
VSコード拡張プラットフォーム用のRPCメッセージングライブラリ。 VSコードの拡張子とWebviewsの通信をはるかに簡単にします。 - 通知やリクエストを 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 、 タイプ 一致パラメータと結果タイプを両側に強制 - 同期と非同期リクエスト/通知ハンドラ - リクエストのキャンセル - 自動的にdisposeのビューを登録解除 - 設定可能なロギング すべての通知を保持する 拡張子と webview の両方でインポートされた TypeScript モジュールに Type/RequestType 宣言を入力します。 同じメソッド文字列とパラメータ/値型は両端で一致しなければなりません。 messenger.start() は、メッセージを受信する前に呼び出される必要があります。 忘れることにより、すべての着信メッセージがサイレントに落ちるようになります。 webview が React アプリケーション (例:.
概要(AI 翻訳)
VSコード拡張プラットフォーム用のRPCメッセージングライブラリ。 VSコードの拡張子とWebviewsの通信をはるかに簡単にします。
##特徴
- 通知やリクエストを extension から view*、view グループ、またはbroadcast に送信して、登録済みのすべてのビューに送信します。
- 通知やリクエストを view から別のビュー*、ビューグループ、またはホスト拡張に送信します。
-Typed API —
RequestTypeと [NotificationType] は、マッチングパラメータと結果タイプを両側に強制します。 - 同期および非同期/通知ハンドラ
- キャンセルリクエスト
- ディスポーズの自動登録解除ビュー
- 設定可能なロギング
パッケージ
各側面が必要とするものだけを取付けて下さい:
| パッケージ | インストール | 目的 |
お問い合わせ
| [vscode-messenger | 延長ホスト | [Messenger] クラス、ビュー登録、診断 API |
| [vscode-messenger-webview | Webビュースクリプト | [Messenger] ウェブビューのクラス[[createCancellationToken] |
| [vscode-messenger-common | 共有モジュール | [NotificationType, [RequestType], [HOST_EXTENSION, [BROADCAST] |
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
VS Code Messenger
RPC messaging library for the VS Code extension platform. Makes the communication between your VS Code extension and its webviews much simpler.
Features
- Send notifications or requests from an extension to a view, a view group, or broadcast to all registered views
- Send notifications or requests from a view to another view, a view group, or the host extension
- Typed API —
RequestTypeandNotificationTypeenforce matching parameter and result types on both sides - Sync and async request/notification handlers
- Request cancellation
- Automatically unregisters views on dispose
- Configurable logging
Packages
Install only what each side needs:
| Package | Install in | Purpose |
|---|---|---|
vscode-messenger |
Extension host | Messenger class, view registration, diagnostic API |
vscode-messenger-webview |
Webview script | Messenger class for webview, createCancellationToken |
vscode-messenger-common |
Shared module | NotificationType, RequestType, HOST_EXTENSION, BROADCAST |
Tip: Keep all NotificationType / RequestType declarations in a shared TypeScript module imported by both the extension and the webview. The same method string and parameter/result types must match on both ends.
Usage in an extension (TypeScript)
import * as vscode from 'vscode';
import { Messenger } from 'vscode-messenger';
import { NotificationType, RequestType } from 'vscode-messenger-common';
const messenger = new Messenger();
// Register a webview view (or use registerWebviewPanel for WebviewPanel)
messenger.registerWebviewView(webviewView);
// Define message types — declare once, import on both sides
const colorSelectType: NotificationType = { method: 'colorSelected' };
推奨ツール
別のキーワードを試すか、フィルタを外してください。
インストール
npx skillfish add typefox/vscode-messenger