
typefox/vscode-messenger
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
VS Code 확장 플랫폼을위한 RPC 메시징 라이브러리
개요
VS Code 확장 플랫폼을위한 RPC 메시징 라이브러리. VS Code extension과 webviews의 통신을 훨씬 간단하게 만듭니다. - , a , 또는 모든 등록 된보기에서 알림 또는 요청 보내기 - ,보기 그룹 또는 호스트 확장에서 알림 또는 요청 보내기 - - RequestType 및 알림 Type 강제 매칭 매개 변수 및 결과 유형 양쪽에 - 동기화 및 동기화 요청/notification handlers - 요청 취소 - 자동으로 dispose에 대한 등록 조회 - 구성 가능한 로깅 자주 묻는 질문 Type / RequestType 선언은 확장과 웹뷰 모두에 의해 가져온 공유 TypeScript 모듈입니다. 동일한 방법 문자열 및 매개 변수/result 유형 모두에 일치 해야 합니다. 메신저.start()는 어떤 메시지가 수신되기 전에 호출되어야 합니다. 모든 들어오는 메시지를 침묵으로 떨어뜨릴 수 있습니다. webview는 React 앱(예: React 앱)입니다.
개요(AI 번역)
VS Code 확장 플랫폼을위한 RPC 메시징 라이브러리. VS Code extension과 webviews의 통신을 훨씬 간단하게 만듭니다.
특징
-extension to view, aview group, 또는 broadcast의 알림 또는 요청을 모두 등록한 조회로 보내십시오. -view to another view, a view group 또는 host extension에서 알림 또는 요청 보내기
- Typed API —
RequestTypeandNotificationType양쪽에 일치하는 매개 변수와 결과 유형 시행 - 동기화 및 동기화 요청/notification 핸들러
- 예약 취소
- dispose의 자동등록 조회
- 구성 가능한 로깅
패키지
각 측면 요구 사항만 설치하십시오:
| 포장 | 설치 | 용도 |
|—|||||
| vscode-messenger | Extension host | Messenger 클래스, 뷰 등록, 진단 API |
| vscode-messenger-webview | 웹뷰 스크립트 | Messenger webview 클래스, [T6] |
| vscode-messenger-common | 공유 모듈 | [T8]], 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