npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@redhat-developer/vscode-extension-proposals

v0.0.23

Published

Manages extension recommendations for VS Code

Downloads

794

Readme

npm

Extension Recommender

This library helps manage Visual Studio Code extension recommendations, and allows extensions to inform users of other extensions that they work well with.

How to use this library

Add the @redhat-developer/vscode-extension-proposals dependency

In order to install @redhat-developer/vscode-extension-proposals in your VS Code extension, open a terminal and execute:

npm i @redhat-developer/vscode-extension-proposals

API / Use Cases

API Entry Points

The primary entry point is called the IRecommendationService, which can discovered by by calling RecommendationCore.getService(etc). Once a client has a recommendation service, they can use this service to create individual recommendations via a convenience utility function, and then register these recommendations in the data store. Registered recommendations can be set to be displayed on startup, or not displayed on startup.

A client can also request a given recommendation be displayed immediately, assuming the recommendation has already been registered in the model. This is useful if a user interacts with some context menu action and, as a result of this action, some type of interaction with another extension is expected to show up at that time. When the client discovers that the expected extension is not present, it is reasonable for a client to display the recommendation directly at that time. Because the nature of the recommendation may change from a general message (We recommend you install xyz debugger) to a specific message (The xyz action you have clicked is expecting an abc debugger to be installed), the API allows for the client to override the description for this display.

The API contains optional integrations with the Red Hat Telemetry Service, though providing this parameter is not required for clients.

The API

RecommendationCore

The primary entrypoint for clients is RecommendationCore. This class has one static function.

export class RecommendationCore {
    public static getService(context: ExtensionContext, telemetryService?: TelemetryService): IRecommendationService;
}

IRecommendationService

export interface IRecommendationService {
    /**
     * Register a recommendation in the model
     */
    register(recommendations: Recommendation[]): Promise<void>;

    /**
     * Show an already-registered recommendation immediately
     */
    show(fromExtension: string, toExtension: string, overrideDescription?: string): Promise<void>;

    /**
     * Convenience function to help create a recommendation
     * @param extensionId 
     * @param extensionDisplayName 
     * @param description 
     * @param shouldShowOnStartup 
     */
    create( extensionId: string, 
        extensionDisplayName: string,
        description: string, 
        shouldShowOnStartup: boolean): Recommendation; 
}

Example extension using this library

Below is an example extension making use of this library and registering a recommendation on two different extensions.

export async function activate(context: vscode.ExtensionContext): Promise<void> {
    myContext = context;
    const recommendService: IRecommendationService = 
        RecommendationCore.getService(context);
    const r1 = recommendService.create("abcde", "Abcde Tools", "Installing Abcde is critical", true);
    const r2 = recommendService.create("redhat.java", "Language Support for Java by Red Hat", "This extension is recommended in order to perform the function in some cases.", true);
    recommendService.register([r1, r2]);
}