Skip to content

Commit

Permalink
feat(extension): recommend extensions
Browse files Browse the repository at this point in the history
`extensions.recommendations`
  • Loading branch information
fannheyward committed Dec 14, 2022
1 parent bd6bc44 commit f077eea
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/extension/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class Extensions {
await this.manager.activateExtensions()
let names = this.states.filterGlobalExtensions(workspace.env.globalExtensions)
void this.installExtensions(names)
await this.promptRecommendedExtensions()
// check extensions need watch & install
let config = workspace.initialConfiguration.get('coc.preferences') as any
let interval = config.extensionUpdateCheck
Expand All @@ -92,6 +93,17 @@ export class Extensions {
}
}

public async promptRecommendedExtensions(): Promise<void> {
const recommendations = workspace.getConfiguration('extensions', workspace.workspaceFolders[0]).get<string[]>('recommendations', [])
const unInstalled = this.states.filterGlobalExtensions(recommendations)
if (unInstalled.length) {
const toInstalls = await window.showPickerDialog(unInstalled, 'Install recommend extensions?')
if (toInstalls?.length) {
await this.installExtensions(toInstalls)
}
}
}

public get onDidLoadExtension(): Event<Extension<API>> {
return this.manager.onDidLoadExtension
}
Expand Down

0 comments on commit f077eea

Please sign in to comment.