chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -27,13 +27,13 @@ export const ContextMatcher = Symbol('ContextMatcher');
|
||||
|
||||
export interface ContextMatcher {
|
||||
/**
|
||||
* 判断 expression 是否命中上下文
|
||||
* Determines whether the expression hits the context
|
||||
*/
|
||||
match: (expression: string) => boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 全局 context key 上下文管理
|
||||
* Global context key context management
|
||||
*/
|
||||
@injectable()
|
||||
export class ContextKeyService implements ContextMatcher {
|
||||
|
||||
@@ -19,31 +19,31 @@ import { type MaybePromise } from '@flowgram-adapter/common';
|
||||
|
||||
export const LifecycleContribution = Symbol('LifecycleContribution');
|
||||
/**
|
||||
* IDE 全局生命周期注册
|
||||
* IDE Global Lifecycle Registration
|
||||
*/
|
||||
export interface LifecycleContribution {
|
||||
/**
|
||||
* IDE 注册阶段
|
||||
* IDE registration phase
|
||||
*/
|
||||
onInit?(): void;
|
||||
/**
|
||||
* IDE loading 阶段, 一般用于加载全局配置,如 i18n 数据
|
||||
* IDE loading phase, generally used to load global configuration, such as i18n data
|
||||
*/
|
||||
onLoading?(): MaybePromise<void>;
|
||||
/**
|
||||
* IDE 布局初始化阶段,在 onLoading 之后执行
|
||||
* IDE layout initialization phase, executed after onLoading
|
||||
*/
|
||||
onLayoutInit?(): MaybePromise<void>;
|
||||
/**
|
||||
* IDE 开始执行, 可以加载业务逻辑
|
||||
* The IDE starts to execute and the business logic can be loaded
|
||||
*/
|
||||
onStart?(): MaybePromise<void>;
|
||||
/**
|
||||
* 在浏览器 `beforeunload` 之前执行,如果返回true,则会阻止
|
||||
* Execute before the browser'beforeunload ', if it returns true, it will be blocked
|
||||
*/
|
||||
onWillDispose?(): boolean | void;
|
||||
/**
|
||||
* IDE 销毁
|
||||
* IDE destruction
|
||||
*/
|
||||
onDispose?(): void;
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@ export interface OpenHandler {
|
||||
export const OpenerService = Symbol('OpenerService');
|
||||
export interface OpenerService {
|
||||
/**
|
||||
* 跳转定位
|
||||
* Jump Positioning
|
||||
* @param uri
|
||||
* @param options
|
||||
*/
|
||||
open: (uri: URI, options?: OpenerOptions) => Promise<object | undefined>;
|
||||
|
||||
/**
|
||||
* 某个请求触发
|
||||
* A request is triggered
|
||||
*/
|
||||
onURIOpen: Event<{ uri: URI; options?: OpenerOptions }>;
|
||||
}
|
||||
|
||||
@@ -21,17 +21,17 @@ import { LifecycleContribution } from './lifecycle-contribution';
|
||||
|
||||
export interface PluginContext {
|
||||
/**
|
||||
* 获取 IOC 容器
|
||||
* Get IOC container
|
||||
*/
|
||||
container: interfaces.Container;
|
||||
/**
|
||||
* 获取 IOC 容器的 单例模块
|
||||
* Get the singleton module for the IOC container
|
||||
* @param identifier
|
||||
*/
|
||||
get: <T>(identifier: interfaces.ServiceIdentifier<T>) => T;
|
||||
|
||||
/**
|
||||
* 获取 IOC 容器的 多例模块
|
||||
* Get the multi-instance module of the IOC container
|
||||
*/
|
||||
getAll: <T>(identifier: interfaces.ServiceIdentifier<T>) => T[];
|
||||
}
|
||||
@@ -47,27 +47,27 @@ export interface PluginBindConfig {
|
||||
|
||||
interface PluginLifeCycle<CTX extends PluginContext, OPTS> {
|
||||
/**
|
||||
* IDE 注册阶段
|
||||
* IDE registration phase
|
||||
*/
|
||||
onInit?: (ctx: CTX, opts: OPTS) => void;
|
||||
/**
|
||||
* IDE loading 阶段, 一般用于加载全局配置,如 i18n 数据
|
||||
* IDE loading phase, generally used to load global configuration, such as i18n data
|
||||
*/
|
||||
onLoading?: (ctx: CTX, opts: OPTS) => MaybePromise<void>;
|
||||
/**
|
||||
* IDE 布局初始化阶段,在 onLoading 之后执行
|
||||
* IDE layout initialization phase, executed after onLoading
|
||||
*/
|
||||
onLayoutInit?: (ctx: CTX, opts: OPTS) => MaybePromise<void>;
|
||||
/**
|
||||
* IDE 开始执行, 可以加载业务逻辑
|
||||
* The IDE starts to execute and the business logic can be loaded
|
||||
*/
|
||||
onStart?: (ctx: CTX, opts: OPTS) => MaybePromise<void>;
|
||||
/**
|
||||
* 在浏览器 `beforeunload` 之前执行,如果返回true,则会阻止
|
||||
* Execute before the browser'beforeunload ', if it returns true, it will be blocked
|
||||
*/
|
||||
onWillDispose?: (ctx: CTX, opts: OPTS) => boolean | void;
|
||||
/**
|
||||
* IDE 销毁
|
||||
* IDE destruction
|
||||
*/
|
||||
onDispose?: (ctx: CTX, opts: OPTS) => void;
|
||||
}
|
||||
@@ -75,12 +75,12 @@ interface PluginLifeCycle<CTX extends PluginContext, OPTS> {
|
||||
export interface PluginConfig<OPTS, CTX extends PluginContext = PluginContext>
|
||||
extends PluginLifeCycle<CTX, OPTS> {
|
||||
/**
|
||||
* 插件 IOC 注册, 等价于 containerModule
|
||||
* Plugin IOC registration, equivalent to containerModule
|
||||
* @param ctx
|
||||
*/
|
||||
onBind?: (bindConfig: PluginBindConfig, opts: OPTS) => void;
|
||||
/**
|
||||
* IOC 模块,用于更底层的插件扩展
|
||||
* IOC module for lower-level plug-in extensions
|
||||
*/
|
||||
containerModules?: interfaces.ContainerModule[];
|
||||
}
|
||||
@@ -114,7 +114,7 @@ export function loadPlugins(
|
||||
}
|
||||
if (plugin.containerModules && plugin.containerModules.length > 0) {
|
||||
for (const module of plugin.containerModules) {
|
||||
// 去重
|
||||
// deduplicate
|
||||
if (!res.includes(module)) {
|
||||
res.push(module);
|
||||
}
|
||||
@@ -177,7 +177,7 @@ export function definePluginCreator<
|
||||
return {
|
||||
pluginId,
|
||||
initPlugin: () => {
|
||||
// 防止 plugin 被上层业务多次 init
|
||||
// Prevent the plugin from being inited multiple times by the upper business
|
||||
if (isInit) {
|
||||
return;
|
||||
}
|
||||
@@ -224,17 +224,17 @@ export function definePluginCreator<
|
||||
/**
|
||||
* @example
|
||||
* createLifecyclePlugin({
|
||||
* // IOC 注册
|
||||
* //IOC Registrationgistration
|
||||
* onBind(bind) {
|
||||
* bind('xxx').toSelf().inSingletonScope()
|
||||
* },
|
||||
* // IDE 初始化
|
||||
* //IDE initializationtialization
|
||||
* onInit() {
|
||||
* },
|
||||
* // IDE 销毁
|
||||
* //IDE destructionstruction
|
||||
* onDispose() {
|
||||
* },
|
||||
* // IOC 模块
|
||||
* //IOC moduledule
|
||||
* containerModules: [new ContainerModule(() => {})]
|
||||
* })
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@ import { injectable, postConstruct } from 'inversify';
|
||||
export const StorageService = Symbol('StorageService');
|
||||
|
||||
/**
|
||||
* 存储数据到缓存
|
||||
* Store data to cache
|
||||
*/
|
||||
export interface StorageService {
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { URI as Uri } from 'vscode-uri';
|
||||
|
||||
import { prioritizeAllSync, prioritizeAll } from './prioritizeable';
|
||||
@@ -241,23 +241,23 @@ export class URI {
|
||||
match(uri: URI) {
|
||||
const path = `/${uri.authority}${uri.path.toString()}`;
|
||||
const params: any[] = [];
|
||||
const pattern = `/${this.authority}${this.path.toString()}`; // 以 / 开头
|
||||
const pattern = `/${this.authority}${this.path.toString()}`; // Start with/
|
||||
let regexpSource = pattern
|
||||
.replace(/\/*\*?$/, '') // 去掉末尾的 / 和 /*
|
||||
.replace(/[\\.*+^${}|()[\]]/g, '\\$&') // 转译一些特殊字符
|
||||
.replace(/\/*\*?$/, '') // remove the/and/* at the endnd/* at the end
|
||||
.replace(/[\\. *+ ^ ${} | () [\]]/g, '\\ $&') //Translate some special characterse some special characters
|
||||
.replace(/\/:([\w-]+)(\?)?/g, (_, paramName, optional) => {
|
||||
// 收集 url 上的参数 /:param/, /:param?/
|
||||
//Collect the parameters on the url/: param/,/: param?/RL/: param/,/: param?/
|
||||
params.push({
|
||||
paramName,
|
||||
// eslint-disable-next-line eqeqeq
|
||||
optional: optional != null,
|
||||
});
|
||||
// 是否是可选参数
|
||||
// Is it an optional parameter?n optional parameter?
|
||||
return optional ? '/?([^\\/]+)?' : '/([^\\/]+)';
|
||||
});
|
||||
if (pattern.endsWith('*')) {
|
||||
params.push({ paramName: '*' });
|
||||
// 也许路径只有 *
|
||||
//Maybe the path is only *e path is only *
|
||||
regexpSource += pattern === '/*' ? '(.*)$' : '(?:\\/(.+)|\\/*)$';
|
||||
} else {
|
||||
regexpSource += '\\/*$';
|
||||
@@ -273,16 +273,16 @@ export interface URIHandler {
|
||||
|
||||
export namespace URIHandler {
|
||||
/**
|
||||
* 上层注册的优先级最高
|
||||
* Upper level registration has the highest priority
|
||||
*/
|
||||
export const MAX_PRIORITY = 500;
|
||||
/**
|
||||
* 默认兜底
|
||||
* Default bottom line
|
||||
*/
|
||||
export const DEFAULT_PRIORITY = 0;
|
||||
|
||||
/**
|
||||
* 优先级排序
|
||||
* prioritization
|
||||
* @param uri
|
||||
* @param handlers
|
||||
*/
|
||||
@@ -292,7 +292,7 @@ export namespace URIHandler {
|
||||
): Promise<T> {
|
||||
const prioritized = await prioritizeAll<T>(handlers, async handler => {
|
||||
const priority = handler.canHandle(uri);
|
||||
// boolean 情况默认采用 500
|
||||
// In the boolean case, 500 is used by default.
|
||||
if (typeof priority === 'boolean') {
|
||||
return priority ? MAX_PRIORITY : DEFAULT_PRIORITY;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ export namespace URIHandler {
|
||||
export function findSync<T extends URIHandler>(uri: URI, handlers: T[]): T {
|
||||
const prioritized = prioritizeAllSync<T>(handlers, handler => {
|
||||
const priority = handler.canHandle(uri);
|
||||
// boolean 情况默认采用 500
|
||||
// In the boolean case, 500 is used by default.
|
||||
if (typeof priority === 'boolean') {
|
||||
return priority ? MAX_PRIORITY : DEFAULT_PRIORITY;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user