提交 40497053 编写于 作者: R Rob Lourens

Add command to search for extension by ID

上级 0724266e
......@@ -1692,6 +1692,17 @@ CommandsRegistry.registerCommand('workbench.extensions.action.showExtensionsForL
});
});
CommandsRegistry.registerCommand('workbench.extensions.action.showExtensionsWithId', function (accessor: ServicesAccessor, extensionId: string) {
const viewletService = accessor.get(IViewletService);
return viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet as IExtensionsViewlet)
.then(viewlet => {
viewlet.search(`@id:${extensionId}`);
viewlet.focus();
});
});
export const extensionButtonProminentBackground = registerColor('extensionButton.prominentBackground', {
dark: '#327e36',
light: '#327e36',
......
......@@ -34,6 +34,7 @@ import { MarkdownString } from 'vs/base/common/htmlContent';
import { overrideIdentifierFromKey, IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { ITextModel, IModelDeltaDecoration, TrackedRangeStickiness } from 'vs/editor/common/model';
import { ICommandService } from 'vs/platform/commands/common/commands';
export interface IPreferencesRenderer<T> extends IDisposable {
readonly preferencesModel: IPreferencesEditorModel<T>;
......@@ -844,7 +845,8 @@ export class HighlightMatchesRenderer extends Disposable {
export class ExtensionCodelensRenderer extends Disposable {
private decorationIds: string[] = [];
constructor(private editor: ICodeEditor) {
constructor(private editor: ICodeEditor,
@ICommandService private commandService: ICommandService) {
super();
}
......@@ -860,6 +862,14 @@ export class ExtensionCodelensRenderer extends Disposable {
this.decorationIds = changeAccessor.deltaDecorations(this.decorationIds, settings.map(setting => this.createDecoration(setting)));
});
}
this._register(this.editor.onMouseDown((e: IEditorMouseEvent) => {
if (e.target.type !== MouseTargetType.GUTTER_GLYPH_MARGIN) {
return;
}
this.commandService.executeCommand('workbench.extensions.action.showExtensionsWithId', 'ms-python.python');
}));
}
private createDecoration(setting: ISetting): IModelDeltaDecoration {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册