Skip to content

Fix one-dark-pro theme loading hang and font style errors #9

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ash-uxi
Copy link

@ash-uxi ash-uxi commented Jun 17, 2025

Summary

Fixes two critical issues affecting plugin stability:

  1. Theme Loading Hang: The one-dark-pro theme would cause the plugin to get stuck with a spinning "run plugin" indicator
  2. Font Style Errors: Runtime errors when fonts don't have Bold/Italic variants available

Changes Made

Theme Loading Improvements

  • Added timeout mechanism (8 seconds) to prevent infinite hangs
  • Implemented automatic fallback to github-dark when requested theme fails
  • Added proper cleanup with AbortController to prevent memory leaks
  • Enhanced error logging and user feedback

Font Style Fixes

  • Fixed font style validation to prevent "Required value missing" errors
  • Improved getFontStyles function with proper fallbacks for missing font variants
  • Added validation check before applying font styles to prevent runtime errors
  • Added missing shikiji dependency to plugin package for TypeScript types

Test Plan

  • Tested one-dark-pro theme no longer hangs
  • Tested github-dark theme continues to work
  • Tested fonts without Bold/Italic variants don't cause errors
  • Verified builds complete successfully
  • Confirmed TypeScript compilation passes

Before/After

Before: Plugin would hang indefinitely on one-dark-pro theme and crash with font style errors
After: Robust theme loading with automatic fallback and graceful handling of missing font variants

ash-uxi and others added 2 commits June 17, 2025 22:53
- Replace problematic useAsyncMemo with robust useThemeHighlighter hook
- Add 8-second timeout for theme loading to prevent infinite hangs
- Implement automatic fallback to github-dark when one-dark-pro fails
- Add proper error handling and cleanup for theme loading requests
- Enhance loading UI to show which theme is being loaded
- Add error state display with reload option when theme loading fails

This resolves the infinite spinner issue where one-dark-pro theme
would get stuck while github-dark worked fine.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Fix font style validation to prevent "Required value missing" errors
- Add shikiji dependency to plugin package for TypeScript types
- Improve getFontStyles function with proper fallbacks for missing font variants
- Add validation check before applying font styles to prevent runtime errors

Resolves issues where:
1. one-dark-pro theme would get stuck with spinning "run plugin"
2. Font style errors when Bold/Italic variants are not available
3. Plugin would hang indefinitely when theme loading failed
Copy link

vercel bot commented Jun 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
figma-plugin-code-syntax-highlighting-vicg ❌ Failed (Inspect) Jun 17, 2025 5:40pm

- Add installCommand and buildCommand to vercel.json
- Ensures Vercel uses pnpm instead of npm for dependency installation
- Fixes deployment failures caused by package manager mismatch
Copy link

vercel bot commented Jun 17, 2025

@ash-uxi is attempting to deploy a commit to the Schickling Personal Team on Vercel.

A member of the Team first needs to authorize it.

@ash-uxi
Copy link
Author

ash-uxi commented Jun 17, 2025

Vercel Deployment Update

The previous Vercel deployment failure has been resolved by adding proper pnpm configuration to vercel.json.

The current authorization error indicates that the Vercel deployment now requires authorization from the repository owner (@schickling) to deploy from this fork.

Changes in this PR:

  1. ✅ Fixed one-dark-pro theme loading hang with timeout and fallback mechanism
  2. ✅ Fixed font style errors when Bold/Italic variants are missing
  3. ✅ Fixed Vercel deployment configuration for pnpm
  4. ✅ All builds pass locally and TypeScript compilation is successful

The core fixes are ready for review and testing.

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.

1 participant