Skip to content

Theme: парсер VS Code theme JSON/JSONC #39

Description

@ZhuchkaTriplesix

Summary

Парсер VS Code theme manifest (JSON/JSONC): очистка комментариев, trailing commas, декодирование в Map<String, dynamic>.

Проблема

Темы VS Code часто — JSONC (//, /* */, trailing comma). dart:convert jsonDecode падает с FormatException.

Решение

Отдельный модуль без зависимости от Flutter (чистый Dart, тестируемый):

lib/core/theme/parser/
  jsonc_preprocessor.dart
  vscode_theme_manifest.dart

JSONC preprocessor

  1. Удалить // (не внутри строк)
  2. Удалить /* … */
  3. Заменить ,}}, ,]]
  4. jsonDecode

Модели (freezed/json_serializable опционально)

  • VsCodeThemeManifest: name, type (dark/light), colors, tokenColors
  • TokenColorRule: scope (String | List), settings.foreground, fontStyle

Acceptance criteria

  • Парсит реальные темы: Dracula, One Dark, Tokyo Night (фикстуры в test/fixtures/themes/)
  • Unit-тесты на edge cases: комментарий в строке, trailing comma, пустой colors
  • Ошибки парсинга — typed exception с путём/строкой

Зависимости

Оценка

~1–2 дня

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestthemeTheming, colors, VS Code themes

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions