Skip to content

Conversation

@kylewalke
Copy link

Add Platform-Aware Capability Filtering with Mode and Platform Toggles

This PR introduces runtime platform detection and platform-aware capability filtering to ensure LSP features are only enabled in supported environments.

Changes

Platform-Aware Capability System

  • Implemented runtime platform detection for web and desktop environments
  • Added platform-aware capability filtering using predefined disabled sets (WEB_DISABLED_CAPABILITIES, DESKTOP_DISABLED_CAPABILITIES)
  • Capabilities like profilingProvider are now automatically filtered out in web environments
  • Replaced wrapper-based filtering (PlatformConstrainedCapability) with declarative disabled capability sets for LSP protocol compliance

Configuration Manager Enhancements

  • Fixed Web Worker environment detection to properly identify web platform
  • Added automatic platform configuration on capabilities manager initialization
  • Deep copy capability configurations to prevent mutation of exported constants

VS Code Extension Configuration

  • Added apex.environment.serverPlatformOverride setting to manually override platform detection
  • Added apex.environment.serverModeOverride setting to override server mode (production/development)
  • Updated documentation with configuration examples and use cases

Architecture Improvements

  • Centralized disabled capabilities in WEB_DISABLED_CAPABILITIES and DESKTOP_DISABLED_CAPABILITIES sets
  • Removed custom capability wrapper types in favor of standard LSP capability objects
  • Platform filtering now occurs during capability construction, ensuring protocol compliance

Impact

  • Web version correctly disables Node.js-specific features like profiling
  • Developers can override platform and mode for local development and debugging
  • Cleaner capability definitions that align with LSP protocol standards
  • Prevents accidental mutation of global capability configuration objects

What issues does this PR fix or reference?

@W-20296680@

@kylewalke kylewalke requested a review from a team as a code owner December 4, 2025 21:41
@salesforce-cla
Copy link

salesforce-cla bot commented Dec 4, 2025

Thanks for the contribution! Unfortunately we can't verify the commit author(s): Kyle Walker <k***@s***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, refresh the status of this Pull Request.

@kylewalke kylewalke changed the base branch from main to tdx26/main December 4, 2025 21:41
@kylewalke kylewalke closed this Dec 4, 2025
peternhale pushed a commit that referenced this pull request Dec 8, 2025
… of #171 with fixed GH user email) (#172)

* feat: add mode and platform toggles

* feat: fixing desktop hovers

* feat: changing to sets instead of attributes

* fix: minor copy issue

* fix: some import paths and lint

* fix: enforcing one code path and env override
@kylewalke kylewalke deleted the kyledev/ModeAndPlatformToggles branch December 8, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants