diff --git a/README.md b/README.md index 930ac3a..934b26f 100644 --- a/README.md +++ b/README.md @@ -1,98 +1,96 @@ -# Textual TCSS Support für PyCharm +# Textual TCSS Support for PyCharm -Dieses Projekt ist ein PyCharm-Plugin für Textual CSS. Es ordnet Dateien mit der Endung `.tcss` einer eigenen Sprache zu und behandelt außerdem String-Werte von `CSS` und `DEFAULT_CSS`-Zuweisungen in Python-Dateien als TCSS. Beide Varianten unterstützen Syntaxfarben, Strukturprüfung, Vervollständigung und Dokumentation. +This project is a PyCharm plugin for Textual CSS. It associates files with the `.tcss` extension with a dedicated language and also treats string values ​​assigned to `CSS` and `DEFAULT_CSS` in Python files as TCSS. Both variants support syntax highlighting, structural validation, code completion, and documentation. -## Funktionen +## Features -- Syntaxfarben für Selektoren, Eigenschaftsnamen, Werte, Variablen, Zahlen, Kommentare und Klammern. -- Prüfung von Regeln und Deklarationen. Fehler wie fehlende `{`, `}`, `:` oder `;` werden im Editor markiert. -- Warnung bei Eigenschaftsnamen, die nicht in der eingebauten Textual-Styles-Referenz stehen. -- Completion für die dokumentierten Textual-Stile und häufige Werte. -- Quick Documentation für Stil-Eigenschaften mit Beschreibungen in der gewählten Meldungssprache. Je nach PyCharm-Einstellung erscheint sie beim Hover oder über **View | Quick Documentation** (`Ctrl+Q`, auf macOS `F1`). -- Farbschema-Einträge unter **Settings | Editor | Color Scheme | Textual CSS**. -- TCSS-Unterstützung in Python-Strings, die `CSS` oder `DEFAULT_CSS` zugewiesen werden. Andere Python-Strings bleiben unverändert. -- Eigene Syntaxfarben für Eigenschaftsnamen, Werte und Maßeinheiten wie `fr` oder `%`. -- TCSS-Variablendeklarationen wie `$border: wide green;`, mit Warnungen bei mehrfach deklarierten Variablen. -- Variablen in `margin`- und `padding`-Werten werden für die Prüfung der erlaubten Gesamtanzahl aufgelöst. -- Eigene Syntaxfarbe für `!important`. -- Einstellbare Sprache für Parser- und Prüfmeldungen: Englisch (Standard) oder Deutsch. Die Einstellung **Textual TCSS** ist in den PyCharm-Einstellungen auffindbar. -- Prüfung auf die in der Textual-8.2.8-Quellcode-Referenz aufgeführten Properties, gültige Werte und erlaubte Wertanzahlen. Eingebaute und im TCSS definierte Variablen werden als Werte akzeptiert. +- Syntax highlighting for selectors, property names, values, variables, numbers, comments, and brackets. +- Validation of rules and declarations. Errors such as missing `{`, `}`, `:`, or `;` are highlighted in the editor. +- Warnings for property names not found in the built-in Textual styles reference. +- Code completion for documented Textual styles and common values. +- Quick documentation for style properties, with descriptions in the selected language. Depending on PyCharm settings, this appears on hover or via **View | Quick Documentation** (`Ctrl+Q`, or `F1` on macOS). +- Color scheme entries under **Settings | Editor | Color Scheme | Textual CSS**. +- TCSS support within Python strings assigned to `CSS` or `DEFAULT_CSS`; other Python strings remain unaffected. +- Dedicated syntax highlighting for property names, values, and units of measurement such as `fr` or `%`. +- Support for TCSS variable declarations (e.g., `$border: wide green;`), including warnings for duplicate variable declarations. +- Variables within `margin` and `padding` values ​​are resolved for validation against allowed limits. +- Dedicated syntax highlighting for `!important`. +- Configurable language for parser and validation messages: English (default) or German. The **Textual TCSS** setting can be found within the PyCharm settings. - Validation against the properties, valid values, and allowed value counts listed in the Textual 8.2.8 source code reference. Built-in variables and those defined in TCSS are accepted as values. -Die Prüfung umfasst die 93 Style-Properties aus `textual_8_2_8_tcss_style_reference_source.md` sowie `margin-top`, `margin-right`, `margin-bottom`, `margin-left` und die entsprechenden vier `padding-*`-Properties, die Textuals Parser ebenfalls unterstützt. Eigenschaftswerte und Wertanzahlen werden anhand der Referenz geprüft. +The validation covers the 93 style properties from `textual_8_2_8_tcss_style_reference_source.md`, as well as `margin-top`, `margin-right`, `margin-bottom`, `margin-left` and the corresponding four `padding-*` properties, which Textual's parser also supports. Property values ​​and value counts are validated against the reference. -## Voraussetzungen +## Prerequisites -- PyCharm 2024.3 oder neuer (Community-Funktionen sind ausreichend). -- Für den Plugin-Build: JDK 21 und Internetzugriff für den ersten Gradle-Build. -- Für die Installation des fertigen Plugins: keine separate Python- oder Textual-Installation. +- PyCharm 2024.3 or newer (Community features are sufficient). +- For building the plugin: JDK 21 and internet access for the initial Gradle build. +- For installing the finished plugin: no separate Python or Textual installation required. -Das Plugin benötigt weder einen Textual-Laufzeitprozess noch das Python-Plugin. Es prüft TCSS-Regeln lokal anhand der Editor-Syntax und der eingebauten Eigenschaftsliste. +The plugin requires neither a running Textual process nor the Python plugin. It validates TCSS rules locally based on the editor syntax and the built-in property list. -## Plugin bauen +## Building the plugin -Im Projektordner ausführen: +Run the following in the project folder: ```bash ./gradlew buildPlugin ``` -Unter Windows: +On Windows: ```powershell .\gradlew.bat buildPlugin ``` -Das installierbare Plugin-ZIP entsteht hier: +The installable plugin ZIP file is created here: ```text build/distributions/textual-tcss-1.2.10.zip ``` -Gradle lädt beim ersten Build die benötigten Gradle- und PyCharm-Komponenten herunter. Der Build kann einige Minuten dauern. Für einen lokalen Entwicklungslauf steht außerdem `./gradlew runIde` beziehungsweise `.gradlew.bat runIde` bereit. +During the first build, Gradle downloads the necessary Gradle and PyCharm components. The build process may take a few minutes. For a local development run, `./gradlew runIde` (or `.gradlew.bat runIde`) is also available. -## Plugin in PyCharm installieren +## Installing the plugin in PyCharm -1. Baue das Plugin wie oben beschrieben oder besorge die Datei `textual-tcss-1.2.10.zip` aus `build/distributions/`. -2. Öffne PyCharm. -3. Öffne **Settings** (Windows/Linux: **File | Settings**, macOS: **PyCharm | Settings**). -4. Wähle **Plugins**. -5. Öffne das Zahnrad-Menü und wähle **Install Plugin from Disk…**. -6. Wähle `textual-tcss-1.2.10.zip`. Die ZIP-Datei vorher nicht entpacken. -7. Bestätige die Installation und starte PyCharm neu, wenn PyCharm dazu auffordert. -8. Öffne eine `.tcss`-Datei oder eine Python-Datei mit einer `CSS`- oder `DEFAULT_CSS`-Zuweisung. PyCharm sollte die entsprechenden TCSS-Inhalte mit Textual-CSS-Unterstützung anzeigen. +1. Build the plugin as described above or obtain the `textual-tcss-1.2.10.zip` file from `build/distributions/`. +2. Open PyCharm. 3. Open **Settings** (Windows/Linux: **File | Settings**, macOS: **PyCharm | Settings**). +4. Select **Plugins**. +5. Open the gear icon menu and select **Install Plugin from Disk…**. +6. Select `textual-tcss-1.2.10.zip`. Do not unzip the file beforehand. +7. Confirm the installation and restart PyCharm if prompted. +8. Open a `.tcss` file or a Python file containing a `CSS` or `DEFAULT_CSS` assignment. PyCharm should display the relevant TCSS content with Textual CSS support. -Alternativ kann eine ZIP-Datei auch auf der Plugin-Seite unter **Plugins | Installed | ⚙ | Install Plugin from Disk…** ausgewählt werden. Die Menübezeichnungen unterscheiden sich je nach PyCharm-Sprache leicht. +Alternatively, the ZIP file can be selected on the plugins page under **Plugins | Installed | ⚙ | Install Plugin from Disk…**. Menu labels may vary slightly depending on the PyCharm language setting. -## Kurzes Beispiel +## Brief Example ```css #dialog .button:hover { - width: 1fr; - height: 3; - color: $text; - border: round cyan; +width: 1fr; +height: 3; +color: $text; +border: round cyan; } ``` -In Python kann TCSS beispielsweise so eingebettet werden: +In Python, TCSS can be embedded as follows: ```python class MyApp: - CSS = """ - Screen { align: center middle; } - """ +CSS = """ +Screen { align: center middle; } +""" - DEFAULT_CSS = """ - Button { color: $text; } - """ +DEFAULT_CSS = """ +Button { color: $text; } +""" ``` -## Entwicklung +## Development -- Hauptquellcode: `src/main/java/de/textualtcss/intellij/` -- Plugin-Registrierung: `src/main/resources/META-INF/plugin.xml` -- Plugin-ID: `de.textualtcss.intellij` +- Main source code: `src/main/java/de/textualtcss/intellij/` +- Plugin registration: `src/main/resources/META-INF/plugin.xml` +- Plugin ID: `de.textualtcss.intellij` - Version: `1.2.10` -- TCSS-Eigenschaftskatalog: Textual `8.2.8` +- TCSS property catalog: Textual `8.2.8` -Die IntelliJ Platform Gradle Plugin-Tasks (`buildPlugin`, `runIde`) verwalten Verpackung und lokale IDE-Sandbox. +The IntelliJ Platform Gradle Plugin tasks (`buildPlugin`, `runIde`) manage packaging and the local IDE sandbox.