Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/engine/core/src/lib/abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export class Plugin<T extends Api = any, App extends ApiMap = any> implements Pl
if (timedout) return
resolve(result)
} catch (err) {
delete this.currentRequest
reject(err)
}
clearTimeout(ref)
Expand Down
12 changes: 8 additions & 4 deletions packages/engine/core/src/lib/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,17 @@ export class PluginManager extends Plugin implements BasePluginManager {
if (from.name === 'manager') {
return this.toggleActive(name)
}
// Check manager rules
const managerCanDeactivate = await this.canDeactivatePlugin(from, to)
const pluginCanDeactivate = await this.call(to.name, 'canDeactivate', from)
if (managerCanDeactivate && pluginCanDeactivate) {
return this.toggleActive(name)
} else {
if (!managerCanDeactivate) {
throw new Error(`Plugin ${this.requestFrom} has no right to deactivate plugin ${name}`)
}
// Ask plugin, if it wasn't the one which called on the first place
const pluginCanDeactivate = from.name !== to.name ? await this.call(to.name, 'canDeactivate', from) : true
if (!pluginCanDeactivate) {
throw new Error(`Plugin ${this.requestFrom} has no right to deactivate plugin ${name}`)
}
return this.toggleActive(name)
}
return Array.isArray(names) ? catchAllPromises(names.map(deactivate)) : deactivate(names)
}
Expand Down
4 changes: 1 addition & 3 deletions packages/engine/vscode/src/lib/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ export class WebviewPlugin extends PluginConnector {
}

protected send(message: Partial<Message>): void {
if (this.panel) {
this.panel.webview.postMessage(message)
}
this.panel?.webview.postMessage(message)
}

protected connect(url: string): void {
Expand Down