Skip to content

Conversation

@kv9898
Copy link

@kv9898 kv9898 commented Nov 5, 2025

Fixes #861

I admit the fix is a bit ugly and I wish better solutions are possible.

Copilot AI and others added 9 commits November 4, 2025 15:36
- Add notification system to send actual theme kind from VS Code to LSP
- Track active color theme kind in LSP ConfigurationManager
- Send theme notifications on startup and when theme changes
- Use actual theme kind instead of parsing theme name

Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
- Add explicit check for 'Dark' in theme name fallback
- Only fire configuration change event if theme actually changed

Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
- Add validation for theme kind parameter in notification handler
- Document HighContrast theme handling (treated as dark)
- Prevent fallback detection from overriding explicit theme notifications
- Add flag to track whether theme was explicitly set

Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
@vezwork
Copy link
Collaborator

vezwork commented Nov 14, 2025

Thanks so much for the PR @kv9898 !

I am not working on theme-related stuff right now, but I will be, hopefully before the end of the year. I will come back to review your PR then. I will try to help come up with a clean solution to the problem.

@kv9898
Copy link
Author

kv9898 commented Nov 14, 2025

Thanks so much for the PR @kv9898 !

I am not working on theme-related stuff right now, but I will be, hopefully before the end of the year. I will come back to review your PR then. I will try to help come up with a clean solution to the problem.

Thanks! I understand that Quarto is highly modularized and communication between parts can be tricky (and debugging quarto is definitely not easy from my experience).

@kv9898
Copy link
Author

kv9898 commented Jan 14, 2026

@vezwork Happy New Year! Any updates?

@vezwork
Copy link
Collaborator

vezwork commented Jan 14, 2026

Tried this out and it does seem to fix the issue.

I looked into the solution and it does seem that:

  1. using vscode.window.activeColorTheme.kind with onDidChangeActiveColorTheme is a good way to get the actual current theme kind
  2. you cannot directly access the theme kind in the LSP, so you have to send a message from the HOST.
  3. We don't currently exactly have a precedent for sending messages from the HOST to the LSP (-- don't have a precedent for sending data, we do send requests in custom.ts, maybe we should use that instead?). See:

    quarto/apps/overview.md

    Lines 67 to 68 in 326b1e0

    - EXTENSION HOST <-req-- LSP
    - I don't think this happens?

    so it seems reasonable to use the notification messaging functionality of the LSP.

As such, this was pretty close to a minimal solution. I cleaned it up a bit. It is also a necessary fix in other ways because our colorTheme config in the LSP did not accurately represent the current theme previously, it only represented the user's colorTheme setting.

@vezwork vezwork requested a review from juliasilge January 14, 2026 22:42
Copy link
Collaborator

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

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

Thank you for working on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Math formulas render in black in VS Code preview when using dark theme

3 participants