Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(extension): prompt to install recommend extensions #4436

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
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