Skip to content

Conversation

@moooyo
Copy link
Contributor

@moooyo moooyo commented Nov 26, 2025

Summary of the Pull Request

TBD

demo:

CmdPal-HostSettingAwareness.mp4

PR Checklist

  • Closes: #xxx
  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Yu Leng added 6 commits November 25, 2025 16:12
Introduced the Host Settings Awareness feature, enabling Command Palette extensions to access and respond to global configuration settings. Extensions can now read settings like hotkeys, animation preferences, and monitor behavior, and receive notifications on changes.

Key changes:
- Added `IHostSettings` and `IHostSettingsChanged` interfaces.
- Implemented `HostSettingsManager` for centralized settings access.
- Updated `IExtensionService` and `IExtensionWrapper` to propagate settings changes.
- Enhanced `AppExtensionHost` and `ExtensionService` to notify extensions.
- Added `HostSettingsConverter` for internal-to-external settings conversion.
- Introduced `HostSettingsPage` in samples to demonstrate usage.
- Updated documentation and IDL definitions for the new feature.
- Ensured backwards compatibility with older hosts.

This feature is designed to be extensible for future settings and capabilities.
Removed unnecessary pragma directives in ExtensionWrapper.cs to clean up the code. Simplified HostSettingsManager.cs by removing the `Initialize` method and debug logging from the `Update` method, streamlining the logic and eliminating conditional compilation blocks.
Refactored `CommandProviderWrapper` to centralize and clarify the logic for sending initial host settings by introducing the `SendInitialHostSettings()` method. This method handles both out-of-process (OOP) extensions and built-in commands, ensuring proper timing and consistent behavior. Updated `TopLevelCommandManager` to call this method after provider initialization.

Enhanced documentation in `host-settings-awareness.md` with updated explanations, sequence diagrams, and metadata. Removed the `Initialize` method from `HostSettingsManager` to simplify the API, retaining the `Update` method for settings updates.

Improved logging and error handling to provide detailed feedback during the settings delivery process. Consolidated logic and improved code readability for better maintainability.
Updated `host-settings-awareness.md` to replace outdated ASCII art diagrams with modern `mermaid` diagrams for improved readability and maintainability.

- Replaced the high-level architecture overview with a `mermaid` flowchart to better illustrate component relationships and cross-process communication.
- Replaced the initial settings delivery process diagram with a `mermaid` sequence diagram, detailing the flow for both OOP extensions and built-in commands.
- Replaced the settings change notification diagram with a `mermaid` sequence diagram, showing the propagation of settings changes and UI updates in extensions.

These changes enhance the clarity and visual appeal of the documentation, making it easier for developers to understand the processes.
- Added new properties to `HostSettingsManager.Current`:
  `ShowSystemTrayIcon`, `IgnoreShortcutWhenFullscreen`,
  `DisableAnimations`, and `SummonOn` for better extension
  configuration access.
- Improved `SettingsChanged` event handling with examples for
  dynamic UI updates.
- Updated `RaiseItemsChanged` in `HostSettingsPage` to include
  an optional parameter for better UI refresh control.
- Added detailed logging to `OnSettingsChanged` in
  `HostSettingsPage` for improved debugging.
- Updated README with Host Settings Awareness details, examples,
  and links to full documentation.
- Refined helper SDK class descriptions and ensured consistency
  in documentation formatting.
- Maintained backwards compatibility with older hosts.
@moooyo moooyo requested a review from zadjii-msft November 26, 2025 11:10
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm out for the holidays, but I want to make sure to block this so we can discuss more.

Primarily: what are we trying to solve here?

They way I tried to build the API was that extensions were entirely agnostic to the details of the app that was hosting them. The hosting app might not even be the palette - it could be anything. THat would give us freedom to revise the UX of the host app, without making any changes to the extensions or the API.

This seems to very tightly couple the API to the hosting app. Any changes we make to the host would need to bubble into every extension.

Is there a more targeted fix we can make for just the problem we're trying to solve?

@moooyo
Copy link
Contributor Author

moooyo commented Nov 26, 2025

I'm out for the holidays, but I want to make sure to block this so we can discuss more.

Primarily: what are we trying to solve here?

They way I tried to build the API was that extensions were entirely agnostic to the details of the app that was hosting them. The hosting app might not even be the palette - it could be anything. THat would give us freedom to revise the UX of the host app, without making any changes to the extensions or the API.

This seems to very tightly couple the API to the hosting app. Any changes we make to the host would need to bubble into every extension.

Is there a more targeted fix we can make for just the problem we're trying to solve?

my goal is to solve the pinyin issue. Yeah, we can add pinyin configuration in cmdpal setting, but for built-in extension, we can not detect this config. So, I believe we need a mechanism to share this config.

Even in some future, we want to add a central configuration to control AI feature (Image, online LLM API and etc...), we also need to provide this information to extension.

But now, the main purpose of this feature is to provide the ability to make our built-in extension know if our customer enable/disable Pinyin support. So, we can use different options in StringMatcher to support pinyin.

@jiripolasek jiripolasek added the Product-Command Palette Refers to the Command Palette utility label Nov 26, 2025
@moooyo
Copy link
Contributor Author

moooyo commented Dec 2, 2025

Close this PR due to we both agree it's not worth to introduce the complexity for pinyin feature.

@moooyo moooyo closed this Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-Command Palette Refers to the Command Palette utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants