Skip to content

chore: notify language server of theme changes

John Slaughter requested to merge js/ls-theme-example into main

Description

This MR introduces a new feature that synchronizes the current theme with the language server. This ensures that the language server is aware of the user's currently selected theme and can notify webviews accordingly.

Unfortunately, vscode does not give us an easy way to grab theme information. Instead, theme colors can only be derived from css variables set on webviews. In order to work around this limitation in the vscode api, I am creating a temporary webview that does not take away focus from the user and is extremely short lived and fetching css variables to send to the LS whenever we need to get the current theme info. From my own tests, this is unnoticeable to the end user and does everything we need it to.

NOTE: This MR contains an example theme mapping. In the future we will use a theme schema that can be easily type checked and additional tooling built around.

Related Issues

[LS] Cross-extension Support for Editor Themes (gitlab-org/editor-extensions/gitlab-lsp#211 - closed) • John Slaughter • 17.5 • Needs attention

How has this been tested?

Screenshots (if appropriate)

duo_chat_theming.mp4

What CHANGELOG entry will this MR create?

  • fix: Bug fix fixes - a user-facing issue in production - included in changelog
  • feature: New feature - a user-facing change which adds functionality - included in changelog
  • BREAKING CHANGE: (fix or feature that would cause existing functionality to change) - should bump major version, mentioned in the changelog
  • None - other non-user-facing changes
Edited by John Slaughter

Merge request reports

Loading