-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Better UX for recommended extensions #26089
Conversation
const action = <Action>this.instantiationService.createInstance( | ||
ConfigureWorkspaceRecommendedExtensionsAction, | ||
ConfigureWorkspaceRecommendedExtensionsAction.ID, | ||
ConfigureWorkspaceRecommendedExtensionsAction.LABEL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Check for the case when there is no workspace.
- Also why do we need to show the extensions file if we can just add the recommendation silently in the background.
ConfigureWorkspaceRecommendedExtensionsAction.LABEL | ||
); | ||
return action.run() | ||
.then(() => this.extensionsWorkbenchService.addToWorkspaceRecommendations(this.extension)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not call the ExtensionTip service directly to add a recommendation?
@thr0w Thanks for the PR and your idea of enhancing workspace recommendations feature is good. I proposed some changes in my review. Please take a look and get back to me. I am also ok, If you would like to split this into two separate PRs as the intellisense one looks complete and can be pushed.
|
@@ -79,6 +79,27 @@ export class ExtensionTipsService implements IExtensionTipsService { | |||
}, err => []); | |||
} | |||
|
|||
addToWorkspaceRecommendations(extensionId: string): TPromise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Check if extensionId is valid or not
- I would rather use workbench model service and json edit utility to update. This will retain the existing formatting options of the file. Refer ConfigurationEditingService that edits configuration files programatically.
} | ||
|
||
const extension = result.firstPage[0]; | ||
const promises = [this.open(extension)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry.. I did not get why do we need to open extension
if (this.local.every(local => local.id !== extension.id)) { | ||
promises.push(this.install(extension)); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I misunderstood.. I see it is installing only one recommended extensions in the list not all.. I do not see complete result is being read to install?
@IWorkspaceContextService private workspaceContextService: IWorkspaceContextService, | ||
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService, | ||
@IExtensionEnablementService private extensionEnablementService: IExtensionEnablementService, | ||
@IInstantiationService private instantiationService: IInstantiationService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove those services which are not used
} | ||
|
||
protected isEnabled(): boolean { | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not be enabled if there are no recommendations or all recommended extensions are already installed and also if there is a workspace or not
@@ -394,6 +395,48 @@ export class ManageExtensionAction extends Action { | |||
} | |||
} | |||
|
|||
export class AddToWorkspaceRecommendationsAction extends Action implements IExtensionAction { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there is an action to add an extension to recommended list, there should also be a counter action to remove it from recommended list
@@ -358,6 +358,7 @@ export class ManageExtensionAction extends Action { | |||
instantiationService.createInstance(EnableGloballyAction, localize('enableAlwaysAction.label', "Enable (Always)")) | |||
], | |||
[ | |||
instantiationService.createInstance(AddToWorkspaceRecommendationsAction, localize('addToWorkspaceRecommendationsAction.label', "Add to Workspace Recommendations")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about having a short label - Recommend (Workspace)
and Unrecommend (Workspace)
. Not sure Workspace
word is necessary since a user can recommend only to Workspace, but having it makes it complete.
label: string, | ||
@IWorkspaceContextService contextService: IWorkspaceContextService, | ||
@IViewletService private viewletService: IViewletService, | ||
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused services
const range = document.getWordRangeAtPosition(position) || new vscode.Range(position, position); | ||
if (location.path[0] === 'recommendations') { | ||
return vscode.extensions.all | ||
.filter(e => e.id.indexOf('vscode') === -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this should ne e.id.startsWith('vscode.')
?
const location = getLocation(document.getText(), document.offsetAt(position)); | ||
const range = document.getWordRangeAtPosition(position) || new vscode.Range(position, position); | ||
if (location.path[0] === 'recommendations') { | ||
return vscode.extensions.all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you suggest if there are no installed extensions?
Hi @sandy081, thank you for your review, your comments and suggestions. I'll study and resolve each one. It's my first time with vscode sources. I learning yet. As you suggested, I created #26564 for Intelli-sense in extensions file. In next week I'll create another PR providing actions to add/remove/install workspace recommendations (maybe I'll need some help with vscode source internals). |
@thr0w Very much appreciated for your effort on this. Will definitely help you.. Please ask if you need any pointers or anything. |
@sandy081 these are my doubts:
|
|
Closing this as its no longer active |
extensions.json
providing installed extensionsAdd to Workspace Recommendations
context actionInstall Workspace Recommended Extensions
context actionfrom issue #13456