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

Better UX for recommended extensions #26089

Closed
wants to merge 2 commits into from
Closed

Conversation

teintinu
Copy link
Contributor

@teintinu teintinu commented May 5, 2017

  1. Intellisense for extensions.json providing installed extensions
  2. Add to Workspace Recommendations context action
  3. Install Workspace Recommended Extensions context action

from issue #13456

@sandy081 sandy081 added this to the May 2017 milestone May 8, 2017
@sandy081 sandy081 requested review from joaomoreno and sandy081 May 8, 2017 21:12
const action = <Action>this.instantiationService.createInstance(
ConfigureWorkspaceRecommendedExtensionsAction,
ConfigureWorkspaceRecommendedExtensionsAction.ID,
ConfigureWorkspaceRecommendedExtensionsAction.LABEL
Copy link
Member

@sandy081 sandy081 May 12, 2017

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));
Copy link
Member

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?

@sandy081 sandy081 requested review from sandy081 and removed request for joaomoreno May 12, 2017 09:16
@sandy081
Copy link
Member

@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.

  1. Intelli-sense in extensions file
  2. Provide actions to add/remove/install workspace recommendations

@@ -79,6 +79,27 @@ export class ExtensionTipsService implements IExtensionTipsService {
}, err => []);
}

addToWorkspaceRecommendations(extensionId: string): TPromise<void> {
Copy link
Member

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)];
Copy link
Member

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));
}

Copy link
Member

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
Copy link
Member

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;
Copy link
Member

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 {
Copy link
Member

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")),
Copy link
Member

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
Copy link
Member

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)
Copy link
Member

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
Copy link
Member

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?

@teintinu
Copy link
Contributor Author

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).

@sandy081
Copy link
Member

@thr0w Very much appreciated for your effort on this. Will definitely help you.. Please ask if you need any pointers or anything.

@teintinu
Copy link
Contributor Author

teintinu commented May 16, 2017

@sandy081 these are my doubts:

  • How activate Extension Gallery when debuging vscode?
  • Can I use ManageExtensionAction.run to chang (or hide) Recommend / Unrecommend options, in case of extension yet recommending or not?
  • how mock/fake vscode with/without workspace to test Recommend/Unrecommend actions?

@sandy081
Copy link
Member

@thr0w

  • Please put following snippet in product.json file to enable querying extension gallery
"extensionsGallery": {
		"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
		"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
		"itemUrl": "https://marketplace.visualstudio.com/items"
	}
  • ManageExtensionAction shows only enabled actions. So set enable flag in Recommend / Unrecommend action

  • Open VSCode on a file or open a new VS Code window using File -> New Window which opens VS Code without workspace

@sandy081 sandy081 modified the milestones: June 2017, May 2017 May 30, 2017
@sandy081 sandy081 modified the milestones: Backlog, June 2017 Jun 26, 2017
@microsoft microsoft deleted a comment from msftclas Sep 27, 2017
@sandy081 sandy081 added the extensions Issues concerning extensions label Dec 4, 2017
@sandy081
Copy link
Member

Closing this as its no longer active

@sandy081 sandy081 closed this Jun 11, 2018
@teintinu teintinu deleted the 13456 branch June 13, 2018 22:54
@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
extensions Issues concerning extensions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants