Repository navigation
feat: Introduce built-in portals extension for scoped searching and command execution. - #53
Conversation
…ommand execution.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a powerful new 'Portals' extension, designed to significantly enhance user productivity by allowing the creation of custom, searchable URL shortcuts. Users can now define 'portals' for frequently used search engines or websites, and then execute scoped searches directly from the main command bar. This feature streamlines workflows by reducing the need to navigate to external sites manually, making common web interactions faster and more integrated within the application. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a well-implemented built-in 'portals' extension for creating scoped search shortcuts. The changes are comprehensive, covering data storage with localStorage, a Svelte-based UI for management, and seamless integration into the main search workflow. The code is generally clean and follows good patterns. My review includes a few suggestions to improve maintainability by removing some redundant logic, enhance the user experience by refining the behavior when dismissing a portal, and replacing a blocking dialog with a more modern approach.
| const portal = e.detail; | ||
| if (editingId) { | ||
| portalStore.update(editingId, portal); | ||
| await removePortalFromIndex(editingId); |
There was a problem hiding this comment.
The call to removePortalFromIndex is redundant when updating a portal. The syncPortalToIndex function effectively performs an 'upsert' operation, as both searchService.indexItem and commandService.registerCommand will overwrite existing entries with the same ID. Removing this line simplifies the code and avoids an unnecessary delete operation from the search index.
| } | ||
|
|
||
| async function handleDelete(portal: Portal) { | ||
| if (!confirm('Are you sure you want to delete this portal?')) return; |
| // Dynamic portal fallback (should be handled by commandService now, but kept as safety net) | ||
| const portal = portalStore.getById(commandId); | ||
| if (portal) { | ||
| const query = args?.query ?? ''; | ||
| const url = portal.url.includes('{query}') | ||
| ? portal.url.replace(/\{query\}/g, encodeURIComponent(query)) | ||
| : portal.url; | ||
| await invoke('plugin:opener|open_url', { url }); | ||
| return { type: 'no-view' }; | ||
| } |
There was a problem hiding this comment.
This 'Dynamic portal fallback' block appears to be unreachable dead code. The commandId passed to executeCommand will be in the format cmd_portals_<uuid>, while portalStore.getById() expects just the UUID. Therefore, portalStore.getById(commandId) will never find a portal. As the comment suggests this logic is now handled by commandService, this block can be safely removed to improve code clarity and maintainability.
| const trigger = activePortal?.name ?? ''; | ||
| activePortal = null; | ||
| portalQuery = ''; | ||
| const newValue = clearAll ? '' : trigger.slice(0, -1); |
There was a problem hiding this comment.
When dismissing portal mode via the Backspace key, setting the new input value to trigger.slice(0, -1) results in a confusing user experience. For example, a portal named 'Search Google' would leave 'Search Googl' in the input. A more intuitive behavior would be to restore the full trigger name, allowing the user to easily edit it. I suggest changing this to just trigger.
const newValue = clearAll ? '' : trigger;
feat: Introduce built-in portals extension for scoped searching and command execution.
fix: use strict type exports for IApplicationService to fix Vite binding errors
fix: use strict type exports for IApplicationService to fix Vite binding errors
…53) Append a stable FNV-1a hash of the full cache key when truncating to prevent cache collisions between distinct applications that share a prefix longer than the filename limit. Keep keys under 200 bytes untouched and preserve UTF-8 char boundary safety.
…) (#1003) * fix(application): safe char boundary truncation for app icon cache (#53) Avoid raw byte slicing into multi-byte UTF-8 character sequences when truncating icon cache keys to 200 bytes in `extract_app_icon` and `extract_uwp_app_icon`. Use `floor_char_boundary` to prevent panics when multi-byte characters straddle the byte limit. * fix(application): disambiguate long icon cache keys with FNV-1a hash (#53) Append a stable FNV-1a hash of the full cache key when truncating to prevent cache collisions between distinct applications that share a prefix longer than the filename limit. Keep keys under 200 bytes untouched and preserve UTF-8 char boundary safety.
No description provided.