-
Notifications
You must be signed in to change notification settings - Fork 12
Add SearchProvider2 and ResultMeta interfaces #89
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
Conversation
swsnr
left a comment
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.
As these interfaces do not correspond to an actual type in GNOME Shell, please move them to a new file under the types sub-module, e.g. packages/gnome-shell/src/types/search-provider.ts, and then re-export that from packages/gnome-shell/src/types/index.ts.
|
I made the changes requested in the comment to PR #89 - moved the However, I encountered a problem: I couldn't import these interfaces in my test project. (nor any other types from the Is there any documentation or recommendations on how to properly import types from the Perhaps I misunderstood the comment, and these interfaces should still be re-exported through |
|
@LumenGNU Looks as if we didn't export the types module yet. Just add it to |
|
@LumenGNU Did you close this deliberately? Just to clarify, I'd have merged these changes, so perhaps you might want to follow up on this PR? |
|
I apologize for the confusion. I didn't intend to close the PR deliberately - it happened automatically when I was reorganizing my repository connections. I was actually doing some "digital housekeeping" and didn't realize this would affect the open pull request. Regarding the interfaces I proposed, they will still be available in https://github.com/LumenGNU/ManSearchProvider/tree/main/src/types if you find them useful. I agree that it's challenging to determine their ideal location in the current state of the project. This might sort itself out naturally as types for Thank you for following up on this. |

Adding TypeScript interfaces for GNOME Shell search providers
Description of Changes
Added two TypeScript interfaces to
extensions/global.d.ts:SearchProvider2- main interface for implementing search providers in GNOME Shell extensionsResultMeta- helper type for structured metadata transfer of search resultsReason for Changes
When developing extensions that implement search providers for GNOME Shell using TypeScript, there are no typed interfaces available, which complicates development and removes the benefits of static typing.
The existing approach often involves implementing from concrete classes (like
AppSearchProvider):This approach has drawbacks due to imperfect typing of existing classes.
The added interfaces allow for a cleaner and type-safe approach:
How it was tested
The interfaces were tested in a real GNOME Shell extension. Usage examples can be provided upon request.
Special notes
SearchProvider2interface represents the implementation contract needed for GNOME Shell search providers in GJS. In GJS this interface doesn't have a formal name (it's just implemented), but for TypeScript typings it needs a name. The name "SearchProvider2" was chosen to match what's observed in the internal GNOME Shell code and D-Bus naming conventionResultMetawas chosen to reflect its role in transferring metadata about search results@girs/gnome-shell/extensions/globalNote: This PR description was translated to English by Claude the Absentminded. Any misrepresentations of the original intent are purely coincidental and should be blamed on artificial neural fluctuations. 😄