-
Notifications
You must be signed in to change notification settings - Fork 7.1k
[cmdpal] Support invoke command in Bookmarks extension #39059
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
base: main
Are you sure you want to change the base?
Conversation
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Command/ShellCommand.cs
Fixed
Show fixed
Hide fixed
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/BookmarkTypeHelper.cs
Fixed
Show fixed
Hide fixed
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/CommandItemFactory.cs
Fixed
Show fixed
Hide fixed
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/IconHelper.cs
Fixed
Show fixed
Hide fixed
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Models/BookmarkType.cs
Fixed
Show fixed
Hide fixed
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
I took a look at the code. See my comments.
I do not have the time to run and try it. And I do not have the permission to unblock your PR later.
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Command/ShellCommand.cs
Outdated
Show resolved
Hide resolved
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Bookmarks.cs
Outdated
Show resolved
Hide resolved
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/IconHelper.cs
Outdated
Show resolved
Hide resolved
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/OpenInShellHelper.cs
Show resolved
Hide resolved
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/OpenInShellHelper.cs
Show resolved
Hide resolved
I don't think I love the type dropdown here. I don't really want people to have to think about what the type of thing is. Plus, if we add built-in support for python 2 and 3, then why not other things? why not bash or node or ...? What if they don't have python installed? Or I think it's cleaner for us to require the actual executable in the bookmark. And then we can heuristically figure out:
I know that's not necessarily as clean as just explicitly bookmarking " (plus, I bet we could try to use the ThumbnailHelper to get the thumbnail of the exe for the bookmark) |
@zadjii-msft |
off-topic: it might be a hot take, but I don't think we should have the "open in Windows Terminal"-like options anymore. The Default Terminal setting is available back even on Windows 10 these days. We should just always respect that (I believe I have similar notes in #38277) |
…icitly make customer decide it.
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/BookmarkTypeHelper.cs
Fixed
Show fixed
Hide fixed
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/BookmarkTypeHelper.cs
Fixed
Show fixed
Hide fixed
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/BookmarkTypeHelper.cs
Fixed
Show fixed
Hide fixed
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/BookmarkTypeHelper.cs
Fixed
Show fixed
Hide fixed
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/BookmarkTypeHelper.cs
Fixed
Show fixed
Hide fixed
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/BookmarkTypeHelper.cs
Fixed
Show fixed
Hide fixed
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/BookmarkTypeHelper.cs
Fixed
Show fixed
Hide fixed
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/BookmarkTypeHelper.cs
Fixed
Show fixed
Hide fixed
This comment has been minimized.
This comment has been minimized.
Emm, you are right. Made the following changes:
|
The only bug is we can not open a "oneDrive" folder as I did in the PR's descrption. But the normal folder is ok. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
I think it is difficult to "assume" what's URL, File/Folder, or Command. Two thoughts:
|
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.
Not suggest to get in for 0.91 except there is special reason
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/BookmarkTypeHelper.cs
Outdated
Show resolved
Hide resolved
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Command/ShellCommand.cs
Show resolved
Hide resolved
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Pages/AddBookmarkForm.cs
Outdated
Show resolved
Hide resolved
Looks like from what Mike just added the issue thread #39261 , bookmark from other common extension like "All Apps", "Search Files (and Folder)", "Run Command", does make sense. |
Yeah, agree. |
If possible, I want to get it in. But if not, it's ok to hold. In fact, the original version also have many assumption. This PR at least I think it just add a new ability to invoke command. So, If we want to consider how to get the correct bookmark type (through a new choices input or other way), we can do in the future. |
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.
Pull Request Overview
This PR introduces support for invoking commands in the Bookmarks extension by refactoring URL invocation logic and adding a new BookmarkType enum to more clearly categorize bookmarks. Key changes include removing the old UrlCommand in favor of ShellCommand, integrated icon handling via IconHelper, and updating bookmark forms to use JsonSerializer and the new enum.
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
UrlCommand.cs | Removed legacy URL command implementation. |
Resources.resx | Added a new error message for command invocation failures. |
BookmarkPlaceholderPage.cs | Updated constructor to use BookmarkType and the new IconHelper. |
BookmarkPlaceholderForm.cs | Refactored invocation logic to call ShellCommand instead of direct URL launching. |
AddBookmarkForm.cs | Updated bookmark type derivation and JSON serialization for adaptive cards. |
BookmarkType.cs, BookmarkData.cs | Introduced and integrated a new BookmarkType enum. |
OpenInShellHelper.cs, IconHelper.cs | Added helper methods to encapsulate URI parsing and icon creation. |
ShellCommand.cs, OpenInTerminalCommand.cs | Implemented robust command invocation for web, file, folder, and command bookmark types. |
BookmarksCommandProvider.cs | Refactored command item creation to use new helper methods. |
Files not reviewed (1)
- src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Properties/Resources.Designer.cs: Language not supported
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/IconHelper.cs
Show resolved
Hide resolved
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Pages/AddBookmarkForm.cs
Outdated
Show resolved
Hide resolved
any suggestion? I think we can move on. |
Summary of the Pull Request
PR Checklist
bat
(or other executable) should still launch it #38700Detailed Description of the Pull Request / Additional comments
Validation Steps Performed