Skip to content

Commit

Permalink
fix: do not fallback on defaut extension if the provided extension do…
Browse files Browse the repository at this point in the history
…esn't exist
  • Loading branch information
Loïc Mangeonjean committed Feb 16, 2024
1 parent 77d8e05 commit 121c6c6
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/localExtensionHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,23 @@ class LocalExtHostExtensionService extends ExtHostExtensionService {
])
const extensionRegistry = { mine: myRegistry, all: this._globalRegistry }

const ext = extensionId != null ? myRegistry.getExtensionDescription(extensionId) : undefined
if (ext != null) {
let apiImpl = this._extApiImpl.get(ext.identifier)
if (apiImpl == null) {
apiImpl = this._apiFactory!(ext, extensionRegistry, configProvider)
this._extApiImpl.set(ext.identifier, apiImpl)
if (extensionId == null) {
if (this._defaultApiImpl == null) {
this._defaultApiImpl = this._apiFactory!(nullExtensionDescription, extensionRegistry, configProvider)
}
return apiImpl
return this._defaultApiImpl
}

// fall back to a default implementation
if (this._defaultApiImpl == null) {
this._defaultApiImpl = this._apiFactory!(nullExtensionDescription, extensionRegistry, configProvider)
const ext = myRegistry.getExtensionDescription(extensionId)
if (ext == null) {
throw new Error(`Extension ${extensionId} does not exist or is disabled`)
}
return this._defaultApiImpl
let apiImpl = this._extApiImpl.get(ext.identifier)
if (apiImpl == null) {
apiImpl = this._apiFactory!(ext, extensionRegistry, configProvider)
this._extApiImpl.set(ext.identifier, apiImpl)
}
return apiImpl
}
}

Expand Down

0 comments on commit 121c6c6

Please sign in to comment.