pulsar-edit / package-backend

Pulsar Server Backend for Packages
https://api.pulsar-edit.dev
MIT License
11 stars 11 forks source link

Package Feature Detection #181

Closed confused-Techie closed 11 months ago

confused-Techie commented 1 year ago

Requirements

Description of the Change

The goal of this PR is to bring feature detection to the backend. That will initially start off with the ./scripts/tools/feature-detection.js script that will preform feature detection on all currently published packages, then the code changes will implement the same behavior into the backend to be preformed once a package is published or a new version is published.


Feature Detection refers to checking a few different 'features' of a package on the repository. This includes the following:

This is mainly aimed at collecting the last part here, as once we know what file extensions are supported by any one grammar, we can then implement an endpoint or a filter that allows Pulsar to automatically search for a grammar for any file extension it finds it doesn't have support for.

The other parts of data being collected is purely a way to allow more badges to be applied to packages

Daeraxa commented 1 year ago

Is it worth expanding this to autocomplete providers?

confused-Techie commented 1 year ago

Is it worth expanding this to autocomplete providers?

Appreciate you checking up on this one, and I don't think we need to. Since any autocomplete information should be able to be on the package's package.json, so we don't have to collect it on this step. Since I'm pretty sure any package providing autocompletions has to do it through the service hub right? Which in that case we can actually already search for services, like if I wanted to find every package that provides autocompletions https://web.pulsar-edit.dev/packages?service=autocomplete.provider&serviceType=provided

confused-Techie commented 1 year ago

Finally getting back to this somewhat, for my own future reference have created the additional tables needed with:

ALTER TABLE versions ADD supported_languages VARCHAR(256) ARRAY
ALTER TABLE versions ADD has_snippets BOOLEAN NOT NULL DEFAULT FALSE
ALTER TABLE versions ADD has_grammar BOOLEAN NOT NULL DEFAULT FALSE
confused-Techie commented 11 months ago

I know it has taken way too long, but I'd like to add, I've finished running feature detection for every currently existing package. This PR is now ready to be merged after a final review, and we can get this feature out.

savetheclocktower commented 11 months ago

Awesome. I'd love to see UI for this eventually — some sidebar or info box with a list of services provided/consumed, plus names and scope names of provided grammars, etc.