Skip to content

Conversation

@dingyi222666
Copy link
Contributor

@dingyi222666 dingyi222666 commented Nov 13, 2025

This PR introduces a comprehensive language packs for the TextMate language module, providing built-in support for over 40 popular programming languages and themes.

The language pack generator creates optimized language bundles from TextMate grammars, making it easier to integrate syntax highlighting for various languages without manual configuration.

Users can now easily enable syntax highlighting for languages including JavaScript, TypeScript, Python, Java, Kotlin, C/C++, Go, Rust, and many others through a simple and consistent API.

Close #549

… language grammars

Implement automated TextMate language pack generation system that creates
individual Gradle modules for each language and theme from grammar definitions.

- Add LanguageTextmatePacksGenerator with template-based code generation
  * Extract templates to resources for better maintainability
  * Generate language modules (e.g., language-lua, language-java)
  * Generate theme modules (e.g., theme-ayu-dark, theme-darcula)
  * Optimize performance with inline functions and lazy loading
  * Use unified package name io.github.rosemoe.sora.langs.textmate

- Add 40+ language grammars with TextMate bundles
  * Assembly, Bash, Bat, C/C++, C#, Coq, CSS/SCSS/Less
  * Dart, Go, Groovy, HTML, HTMX, Ini, Java, JavaScript/JSX
  * JSON, Kotlin, LaTeX, Lisp, Log, Lua, Markdown, Nim
  * Pascal, PHP, PowerShell, Properties, Python, Ruby, Rust
  * Smali, SQL, Swift, Text, TOML, TypeScript/TSX, XML, YAML, Zig

- Add 4 color themes
  * ayu-dark, ayu-light, darcula, quietlight

- Integrate with build system
  * Auto-generate language packs during Gradle sync
  * Dynamic module inclusion via settings.gradle.kts

- Update app dependencies to use generated language packs
  * Use LuaLanguage and AyuDarkColorScheme in LSP test activities
  * Simplify theme switching logic
…and themes

Implement a comprehensive language pack generator and registry system:

Language Pack System:
- Add pack generator that processes grammars.json to create standalone modules
- Generate 40+ language packs (Java, Kotlin, Python, Rust, Go, etc.)
- Generate 4 theme packs (Ayu Dark/Light, Darcula, Quiet Light)
- Auto-register generated modules in settings.gradle.kts
- Remove singleton pattern from generated pack classes for simpler API

TextMate Enhancements:
- Add bracket match color support (background, border)
- Auto-detect dark theme from theme JSON "type" field
- Improve theme lookup to support both theme name and model name
- Fix theme loaded state check for better reliability

Documentation:
- Add comprehensive README for language-textmate-packs module
- Include setup instructions with Maven Central dependencies
- Document theme and language pack usage patterns
- Provide complete language support table with module names

The pack system allows applications to easily include specific languages
and themes without bundling all grammars, reducing APK size and improving
modularity.
@dingyi222666 dingyi222666 changed the title feat(language-textmate): add language pack system with 40+ languages and themes [Feat] Add language pack system with 40+ languages and theme Nov 13, 2025
Update module naming from language-<name>/theme-<name> to language-textmate-<name>/theme-textmate-<name> format for better consistency and simpler configuration. This change affects the language pack generator, build configuration, and documentation.

The new naming convention allows settings.gradle.kts to directly use directory names as module names without string manipulation, improving maintainability.

Additionally, fix code formatting issues in language and theme class templates by standardizing indentation and removing unnecessary synchronized blocks.
… plugin

Move TextMate language pack module generation from root project plugin to a dedicated settings plugin. This ensures modules are generated during the settings evaluation phase, allowing proper type-safe accessors in build scripts.

Changes include creating TextmateSettingsPlugin to handle module generation at settings time, updating app build.gradle.kts to use type-safe project accessors, removing eager generator from root project plugin to avoid duplicate generation, and removing CI build checks to ensure consistent module generation.
@dingyi222666 dingyi222666 force-pushed the feat/textmate-language-pack branch from cb3cfc5 to ff95f15 Compare November 13, 2025 18:12
@dingyi222666 dingyi222666 changed the title [Feat] Add language pack system with 40+ languages and theme [Featute] Add language packs with 40+ languages and theme Nov 13, 2025
…ule names in README

Updated README to reflect changes in project registration and theme module names.
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.

Language pack for popular languages

1 participant