Skip to content

Feature/Multi-language Support #57

@AaronChen11

Description

@AaronChen11

Issue Description(Feature)

The current extension only supports JavaScript and TypeScript; it does not support other coding languages: HTML, CSS, Python (#), Java (//), C (/* */), and more.

Describe the solution you'd like

Extend the extension to detect and support comment syntax across multiple programming languages (e.g., HTML, CSS, Python #, Java //, C /* ... */, and more).

  • Language Detection
  1. Use the fileType provided by VS Code’s languageId to identify the active file’s language.
  2. Based on the detected language, route the file through its appropriate parser.
  • Parser Integration
  1. For JavaScript/TypeScript, continue using Babel + AST for accurate parsing.
  2. For other languages, plug in language-specific parsing strategies (e.g., Tree-sitter, PyAst for Python, etc.).
  3. Each parser should expose a unified interface so the rest of the pipeline (masking, unmasking, translation) doesn’t need to change drastically.
  • Comment Syntax Handling
  1. Define comment patterns for each supported language (e.g., //, #, , /* */) and ensure extracted comments respect that language’s rules.
  2. Ensure the translation prompt is updated dynamically per language so that formatting is preserved (e.g., Python comments always begin with #, HTML with ).
  • Glossaries by Language
  1. Maintain a per-language glossary of reserved keywords, identifiers, and symbols that must never be translated.
  2. Integrate with docSymbolsController to generate language-aware symbol sets (e.g., Python functions, Java classes, HTML tags).
  • Future Flexibility

Make the architecture extensible so new languages can be added by simply contributing: a parser integration, a comment syntax definition, and a glossary file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions