#71 Colorisation syntaxique des fichiers de code dans le panel Agents
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6cced02 parent: a82ce92 modified
.tickets/issues/0071-colorisation-syntaxique-des-fichiers-de-code-sou.yaml +17 -2 | @@ -6,7 +6,7 @@ author: | ||
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-09T04:42:57.000Z |
| 9 | -updatedAt: 2026-11-09T04:42:57.000Z | |
| 9 | +updatedAt: 2026-11-09T04:49:17.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - kind::feature |
| 12 | 12 | - area::workspace |
| @@ -31,4 +31,19 @@ body: | | ||
| 31 | 31 | gros fichiers : pas de blocage de l'interface (limite de taille au-delà de laquelle on reste en brut). |
| 32 | 32 | - Tests frontend ; docs EN + FR si elles décrivent l'aperçu des fichiers. |
| 33 | 33 | tasks: [] |
| 34 | -comments: [] | |
| 34 | +comments: | |
| 35 | + - id: 1 | |
| 36 | + author: | |
| 37 | + name: k33g | |
| 38 | + email: ph.charriere@gmail.com | |
| 39 | + createdAt: 2026-11-09T04:49:17.000Z | |
| 40 | + body: | | |
| 41 | + Fait, dans l'éditeur CodeMirror (coloré en lecture comme en édition, plutôt qu'un aperçu Shiki à part). | |
| 42 | + - [files.ts](frontend/src/lib/files.ts) : `languageFor` reconnaît ~30 langages par extension | |
| 43 | + et par nom (`Dockerfile`, `Makefile`, `.env`, `go.mod`…), `text` sinon. | |
| 44 | + - [editorLanguages.ts](frontend/src/lib/editorLanguages.ts) : chaque langage est chargé à la demande | |
| 45 | + (`@codemirror/lang-*`, `@codemirror/legacy-modes` pour shell, TOML, Dockerfile, Ruby, Swift…) ; | |
| 46 | + au-delà de 512 Ko le fichier reste en texte brut. | |
| 47 | + - [FileEditor.svelte](frontend/src/lib/agent/FileEditor.svelte) : langage dans un `Compartment`, appliqué une fois chargé. | |
| 48 | + - Le thème suit maintenant `ui.theme` (`isDark` dans [theme.ts](frontend/src/lib/theme.ts)), aussi dans Settings. | |
| 49 | + - Tests vitest (chaque langage se charge) ; guide « fichiers et terminal » EN + FR. | |
| @@ -6,7 +6,7 @@ author: | |||
| 6 | name: k33g | 6 | name: k33g |
| 7 | email: ph.charriere@gmail.com | 7 | email: ph.charriere@gmail.com |
| 8 | createdAt: 2026-11-09T04:42:57.000Z | 8 | createdAt: 2026-11-09T04:42:57.000Z |
| 9 | -updatedAt: 2026-11-09T04:42:57.000Z | 9 | +updatedAt: 2026-11-09T04:49:17.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - kind::feature | 11 | - kind::feature |
| 12 | - area::workspace | 12 | - area::workspace |
| @@ -31,4 +31,19 @@ body: | | |||
| 31 | gros fichiers : pas de blocage de l'interface (limite de taille au-delà de laquelle on reste en brut). | 31 | gros fichiers : pas de blocage de l'interface (limite de taille au-delà de laquelle on reste en brut). |
| 32 | - Tests frontend ; docs EN + FR si elles décrivent l'aperçu des fichiers. | 32 | - Tests frontend ; docs EN + FR si elles décrivent l'aperçu des fichiers. |
| 33 | tasks: [] | 33 | tasks: [] |
| 34 | -comments: [] | 34 | +comments: |
| 35 | + - id: 1 | ||
| 36 | + author: | ||
| 37 | + name: k33g | ||
| 38 | + email: ph.charriere@gmail.com | ||
| 39 | + createdAt: 2026-11-09T04:49:17.000Z | ||
| 40 | + body: | | ||
| 41 | + Fait, dans l'éditeur CodeMirror (coloré en lecture comme en édition, plutôt qu'un aperçu Shiki à part). | ||
| 42 | + - [files.ts](frontend/src/lib/files.ts) : `languageFor` reconnaît ~30 langages par extension | ||
| 43 | + et par nom (`Dockerfile`, `Makefile`, `.env`, `go.mod`…), `text` sinon. | ||
| 44 | + - [editorLanguages.ts](frontend/src/lib/editorLanguages.ts) : chaque langage est chargé à la demande | ||
| 45 | + (`@codemirror/lang-*`, `@codemirror/legacy-modes` pour shell, TOML, Dockerfile, Ruby, Swift…) ; | ||
| 46 | + au-delà de 512 Ko le fichier reste en texte brut. | ||
| 47 | + - [FileEditor.svelte](frontend/src/lib/agent/FileEditor.svelte) : langage dans un `Compartment`, appliqué une fois chargé. | ||
| 48 | + - Le thème suit maintenant `ui.theme` (`isDark` dans [theme.ts](frontend/src/lib/theme.ts)), aussi dans Settings. | ||
| 49 | + - Tests vitest (chaque langage se charge) ; guide « fichiers et terminal » EN + FR. | ||
modified
docs/en/how-to/work-with-an-agents-files.md +1 -0 | @@ -12,6 +12,7 @@ This guide shows how to look at what an agent produced, change its instructions, | ||
| 12 | 12 | |
| 13 | 13 | 1. In **Files**, click a folder to open it, a file to read it. Dot files (`.git`, `.mm`…) and `node_modules` are hidden: tick **Show hidden files** to see them. |
| 14 | 14 | 2. Edit the text. **● modified** appears; **Save** (or ⌘S) writes the file, **Revert** brings back what is on disk. |
| 15 | + Source code is coloured according to its language, told by the extension or the name of the file: Go, JavaScript and TypeScript (with JSX), Python, Rust, Java, C and C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, shell scripts and `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, `.env` and `.ini` files, diffs, PowerShell. Any other file, and a file larger than 512 KB, stays plain text. | |
| 15 | 16 | 3. If the agent changes the file while you edit it, a banner says so: **Take their version** reloads it (your changes are lost), **Keep mine** saves yours over it. |
| 16 | 17 | |
| 17 | 18 | The tree and the open file follow the agent's changes by themselves: a file it creates appears within a second (two in a container). |
| @@ -12,6 +12,7 @@ This guide shows how to look at what an agent produced, change its instructions, | |||
| 12 | 12 | ||
| 13 | 1. In **Files**, click a folder to open it, a file to read it. Dot files (`.git`, `.mm`…) and `node_modules` are hidden: tick **Show hidden files** to see them. | 13 | 1. In **Files**, click a folder to open it, a file to read it. Dot files (`.git`, `.mm`…) and `node_modules` are hidden: tick **Show hidden files** to see them. |
| 14 | 2. Edit the text. **● modified** appears; **Save** (or ⌘S) writes the file, **Revert** brings back what is on disk. | 14 | 2. Edit the text. **● modified** appears; **Save** (or ⌘S) writes the file, **Revert** brings back what is on disk. |
| 15 | + Source code is coloured according to its language, told by the extension or the name of the file: Go, JavaScript and TypeScript (with JSX), Python, Rust, Java, C and C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, shell scripts and `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, `.env` and `.ini` files, diffs, PowerShell. Any other file, and a file larger than 512 KB, stays plain text. | ||
| 15 | 3. If the agent changes the file while you edit it, a banner says so: **Take their version** reloads it (your changes are lost), **Keep mine** saves yours over it. | 16 | 3. If the agent changes the file while you edit it, a banner says so: **Take their version** reloads it (your changes are lost), **Keep mine** saves yours over it. |
| 16 | 17 | ||
| 17 | The tree and the open file follow the agent's changes by themselves: a file it creates appears within a second (two in a container). | 18 | The tree and the open file follow the agent's changes by themselves: a file it creates appears within a second (two in a container). |
modified
docs/fr/how-to/fichiers-et-terminal-d-un-agent.md +1 -0 | @@ -12,6 +12,7 @@ Ce guide montre comment voir ce qu'un agent a produit, modifier ses instructions | ||
| 12 | 12 | |
| 13 | 13 | 1. Dans **Files**, cliquez sur un dossier pour l'ouvrir, sur un fichier pour le lire. Les fichiers commençant par un point (`.git`, `.mm`…) et `node_modules` sont cachés : cochez **Show hidden files** pour les voir. |
| 14 | 14 | 2. Modifiez le texte. **● modified** apparaît ; **Save** (ou ⌘S) écrit le fichier, **Revert** remet ce qui est sur le disque. |
| 15 | + Le code source est colorisé selon son langage, reconnu à l'extension ou au nom du fichier : Go, JavaScript et TypeScript (avec JSX), Python, Rust, Java, C et C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, scripts shell et `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, fichiers `.env` et `.ini`, diffs, PowerShell. Tout autre fichier, et un fichier de plus de 512 Ko, reste en texte brut. | |
| 15 | 16 | 3. Si l'agent modifie le fichier pendant que vous l'éditez, un bandeau le signale : **Take their version** le recharge (vos modifications sont perdues), **Keep mine** enregistre les vôtres par-dessus. |
| 16 | 17 | |
| 17 | 18 | L'arbre et le fichier ouvert suivent seuls les changements de l'agent : un fichier qu'il crée apparaît en une seconde (deux dans un conteneur). |
| @@ -12,6 +12,7 @@ Ce guide montre comment voir ce qu'un agent a produit, modifier ses instructions | |||
| 12 | 12 | ||
| 13 | 1. Dans **Files**, cliquez sur un dossier pour l'ouvrir, sur un fichier pour le lire. Les fichiers commençant par un point (`.git`, `.mm`…) et `node_modules` sont cachés : cochez **Show hidden files** pour les voir. | 13 | 1. Dans **Files**, cliquez sur un dossier pour l'ouvrir, sur un fichier pour le lire. Les fichiers commençant par un point (`.git`, `.mm`…) et `node_modules` sont cachés : cochez **Show hidden files** pour les voir. |
| 14 | 2. Modifiez le texte. **● modified** apparaît ; **Save** (ou ⌘S) écrit le fichier, **Revert** remet ce qui est sur le disque. | 14 | 2. Modifiez le texte. **● modified** apparaît ; **Save** (ou ⌘S) écrit le fichier, **Revert** remet ce qui est sur le disque. |
| 15 | + Le code source est colorisé selon son langage, reconnu à l'extension ou au nom du fichier : Go, JavaScript et TypeScript (avec JSX), Python, Rust, Java, C et C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, scripts shell et `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, fichiers `.env` et `.ini`, diffs, PowerShell. Tout autre fichier, et un fichier de plus de 512 Ko, reste en texte brut. | ||
| 15 | 3. Si l'agent modifie le fichier pendant que vous l'éditez, un bandeau le signale : **Take their version** le recharge (vos modifications sont perdues), **Keep mine** enregistre les vôtres par-dessus. | 16 | 3. Si l'agent modifie le fichier pendant que vous l'éditez, un bandeau le signale : **Take their version** le recharge (vos modifications sont perdues), **Keep mine** enregistre les vôtres par-dessus. |
| 16 | 17 | ||
| 17 | L'arbre et le fichier ouvert suivent seuls les changements de l'agent : un fichier qu'il crée apparaît en une seconde (deux dans un conteneur). | 18 | L'arbre et le fichier ouvert suivent seuls les changements de l'agent : un fichier qu'il crée apparaît en une seconde (deux dans un conteneur). |
modified
frontend/package.json +13 -0 | @@ -14,9 +14,22 @@ | ||
| 14 | 14 | "dependencies": { |
| 15 | 15 | "@asciidoctor/core": "4.1.1", |
| 16 | 16 | "@codemirror/autocomplete": "6.20.3", |
| 17 | + "@codemirror/lang-cpp": "6.0.3", | |
| 18 | + "@codemirror/lang-css": "6.3.1", | |
| 19 | + "@codemirror/lang-go": "6.0.1", | |
| 20 | + "@codemirror/lang-html": "6.4.12", | |
| 21 | + "@codemirror/lang-java": "6.0.2", | |
| 22 | + "@codemirror/lang-javascript": "6.2.5", | |
| 17 | 23 | "@codemirror/lang-json": "6.0.2", |
| 18 | 24 | "@codemirror/lang-markdown": "6.5.2", |
| 25 | + "@codemirror/lang-php": "6.0.2", | |
| 26 | + "@codemirror/lang-python": "6.2.1", | |
| 27 | + "@codemirror/lang-rust": "6.0.2", | |
| 28 | + "@codemirror/lang-sql": "6.10.0", | |
| 29 | + "@codemirror/lang-xml": "6.1.0", | |
| 19 | 30 | "@codemirror/lang-yaml": "6.1.3", |
| 31 | + "@codemirror/language": "6.13.1", | |
| 32 | + "@codemirror/legacy-modes": "6.5.5", | |
| 20 | 33 | "@codemirror/lint": "6.9.7", |
| 21 | 34 | "@codemirror/state": "6.7.6", |
| 22 | 35 | "@codemirror/theme-one-dark": "6.1.3", |
| @@ -14,9 +14,22 @@ | |||
| 14 | "dependencies": { | 14 | "dependencies": { |
| 15 | "@asciidoctor/core": "4.1.1", | 15 | "@asciidoctor/core": "4.1.1", |
| 16 | "@codemirror/autocomplete": "6.20.3", | 16 | "@codemirror/autocomplete": "6.20.3", |
| 17 | + "@codemirror/lang-cpp": "6.0.3", | ||
| 18 | + "@codemirror/lang-css": "6.3.1", | ||
| 19 | + "@codemirror/lang-go": "6.0.1", | ||
| 20 | + "@codemirror/lang-html": "6.4.12", | ||
| 21 | + "@codemirror/lang-java": "6.0.2", | ||
| 22 | + "@codemirror/lang-javascript": "6.2.5", | ||
| 17 | "@codemirror/lang-json": "6.0.2", | 23 | "@codemirror/lang-json": "6.0.2", |
| 18 | "@codemirror/lang-markdown": "6.5.2", | 24 | "@codemirror/lang-markdown": "6.5.2", |
| 25 | + "@codemirror/lang-php": "6.0.2", | ||
| 26 | + "@codemirror/lang-python": "6.2.1", | ||
| 27 | + "@codemirror/lang-rust": "6.0.2", | ||
| 28 | + "@codemirror/lang-sql": "6.10.0", | ||
| 29 | + "@codemirror/lang-xml": "6.1.0", | ||
| 19 | "@codemirror/lang-yaml": "6.1.3", | 30 | "@codemirror/lang-yaml": "6.1.3", |
| 31 | + "@codemirror/language": "6.13.1", | ||
| 32 | + "@codemirror/legacy-modes": "6.5.5", | ||
| 20 | "@codemirror/lint": "6.9.7", | 33 | "@codemirror/lint": "6.9.7", |
| 21 | "@codemirror/state": "6.7.6", | 34 | "@codemirror/state": "6.7.6", |
| 22 | "@codemirror/theme-one-dark": "6.1.3", | 35 | "@codemirror/theme-one-dark": "6.1.3", |
modified
frontend/pnpm-lock.yaml +190 -0 | @@ -172,15 +172,54 @@ importers: | ||
| 172 | 172 | '@codemirror/autocomplete': |
| 173 | 173 | specifier: 6.20.3 |
| 174 | 174 | version: 6.20.3 |
| 175 | + '@codemirror/lang-cpp': | |
| 176 | + specifier: 6.0.3 | |
| 177 | + version: 6.0.3 | |
| 178 | + '@codemirror/lang-css': | |
| 179 | + specifier: 6.3.1 | |
| 180 | + version: 6.3.1 | |
| 181 | + '@codemirror/lang-go': | |
| 182 | + specifier: 6.0.1 | |
| 183 | + version: 6.0.1 | |
| 184 | + '@codemirror/lang-html': | |
| 185 | + specifier: 6.4.12 | |
| 186 | + version: 6.4.12 | |
| 187 | + '@codemirror/lang-java': | |
| 188 | + specifier: 6.0.2 | |
| 189 | + version: 6.0.2 | |
| 190 | + '@codemirror/lang-javascript': | |
| 191 | + specifier: 6.2.5 | |
| 192 | + version: 6.2.5 | |
| 175 | 193 | '@codemirror/lang-json': |
| 176 | 194 | specifier: 6.0.2 |
| 177 | 195 | version: 6.0.2 |
| 178 | 196 | '@codemirror/lang-markdown': |
| 179 | 197 | specifier: 6.5.2 |
| 180 | 198 | version: 6.5.2 |
| 199 | + '@codemirror/lang-php': | |
| 200 | + specifier: 6.0.2 | |
| 201 | + version: 6.0.2 | |
| 202 | + '@codemirror/lang-python': | |
| 203 | + specifier: 6.2.1 | |
| 204 | + version: 6.2.1 | |
| 205 | + '@codemirror/lang-rust': | |
| 206 | + specifier: 6.0.2 | |
| 207 | + version: 6.0.2 | |
| 208 | + '@codemirror/lang-sql': | |
| 209 | + specifier: 6.10.0 | |
| 210 | + version: 6.10.0 | |
| 211 | + '@codemirror/lang-xml': | |
| 212 | + specifier: 6.1.0 | |
| 213 | + version: 6.1.0 | |
| 181 | 214 | '@codemirror/lang-yaml': |
| 182 | 215 | specifier: 6.1.3 |
| 183 | 216 | version: 6.1.3 |
| 217 | + '@codemirror/language': | |
| 218 | + specifier: 6.13.1 | |
| 219 | + version: 6.13.1 | |
| 220 | + '@codemirror/legacy-modes': | |
| 221 | + specifier: 6.5.5 | |
| 222 | + version: 6.5.5 | |
| 184 | 223 | '@codemirror/lint': |
| 185 | 224 | specifier: 6.9.7 |
| 186 | 225 | version: 6.9.7 |
| @@ -278,12 +317,21 @@ packages: | ||
| 278 | 317 | '@codemirror/commands@6.11.1': |
| 279 | 318 | resolution: {integrity: sha512-O/4hG3SC1YwcmQ0d2UVNDs+AsaNWd1iHVxbTeEBuqH+6bExAiPK3iS/BvpY6rZGURALv4ZD3sIgcCmRvw3ehBg==} |
| 280 | 319 | |
| 320 | + '@codemirror/lang-cpp@6.0.3': | |
| 321 | + resolution: {integrity: sha512-URM26M3vunFFn9/sm6rzqrBzDgfWuDixp85uTY49wKudToc2jTHUrKIGGKs+QWND+YLofNNZpxcNGRynFJfvgA==} | |
| 322 | + | |
| 281 | 323 | '@codemirror/lang-css@6.3.1': |
| 282 | 324 | resolution: {integrity: sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==} |
| 283 | 325 | |
| 326 | + '@codemirror/lang-go@6.0.1': | |
| 327 | + resolution: {integrity: sha512-7fNvbyNylvqCphW9HD6WFnRpcDjr+KXX/FgqXy5H5ZS0eC5edDljukm/yNgYkwTsgp2busdod50AOTIy6Jikfg==} | |
| 328 | + | |
| 284 | 329 | '@codemirror/lang-html@6.4.12': |
| 285 | 330 | resolution: {integrity: sha512-pw2ReWKUqSkbvh76RAT4NYxiogRu+PWkR2ukAwO9uOgrm8uipkzjtKKtNpyeAQwHOqxEeSvAXZ6vr3AfyB9y/w==} |
| 286 | 331 | |
| 332 | + '@codemirror/lang-java@6.0.2': | |
| 333 | + resolution: {integrity: sha512-m5Nt1mQ/cznJY7tMfQTJchmrjdjQ71IDs+55d1GAa8DGaB8JXWsVCkVT284C3RTASaY43YknrK2X3hPO/J3MOQ==} | |
| 334 | + | |
| 287 | 335 | '@codemirror/lang-javascript@6.2.5': |
| 288 | 336 | resolution: {integrity: sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A==} |
| 289 | 337 | |
| @@ -293,12 +341,30 @@ packages: | ||
| 293 | 341 | '@codemirror/lang-markdown@6.5.2': |
| 294 | 342 | resolution: {integrity: sha512-AwBOdkWYuA//WcM0xO5PfHPUcmz/O2i5o0Nsg1U69SII/loCJlFI1Romd9xp2HYb1kYJRGZotyqRghuHH5n8Kw==} |
| 295 | 343 | |
| 344 | + '@codemirror/lang-php@6.0.2': | |
| 345 | + resolution: {integrity: sha512-ZKy2v1n8Fc8oEXj0Th0PUMXzQJ0AIR6TaZU+PbDHExFwdu+guzOA4jmCHS1Nz4vbFezwD7LyBdDnddSJeScMCA==} | |
| 346 | + | |
| 347 | + '@codemirror/lang-python@6.2.1': | |
| 348 | + resolution: {integrity: sha512-IRjC8RUBhn9mGR9ywecNhB51yePWCGgvHfY1lWN/Mrp3cKuHr0isDKia+9HnvhiWNnMpbGhWrkhuWOc09exRyw==} | |
| 349 | + | |
| 350 | + '@codemirror/lang-rust@6.0.2': | |
| 351 | + resolution: {integrity: sha512-EZaGjCUegtiU7kSMvOfEZpaCReowEf3yNidYu7+vfuGTm9ow4mthAparY5hisJqOHmJowVH3Upu+eJlUji6qqA==} | |
| 352 | + | |
| 353 | + '@codemirror/lang-sql@6.10.0': | |
| 354 | + resolution: {integrity: sha512-6ayPkEd/yRw0XKBx5uAiToSgGECo/GY2NoJIHXIIQh1EVwLuKoU8BP/qK0qH5NLXAbtJRLuT73hx7P9X34iO4w==} | |
| 355 | + | |
| 356 | + '@codemirror/lang-xml@6.1.0': | |
| 357 | + resolution: {integrity: sha512-3z0blhicHLfwi2UgkZYRPioSgVTo9PV5GP5ducFH6FaHy0IAJRg+ixj5gTR1gnT/glAIC8xv4w2VL1LoZfs+Jg==} | |
| 358 | + | |
| 296 | 359 | '@codemirror/lang-yaml@6.1.3': |
| 297 | 360 | resolution: {integrity: sha512-AZ8DJBuXGVHybpBQhmZtgew5//4hv3tdkXnr3vDmOUMJRuB6vn/uuwtmTOTlqEaQFg3hQSVeA90NmvIQyUV6FQ==} |
| 298 | 361 | |
| 299 | 362 | '@codemirror/language@6.13.1': |
| 300 | 363 | resolution: {integrity: sha512-zfvU2r3TyylQLMj/te+5CnQ0rSqZi8B1oTCBbQkagcLW4Xc6imab6qN+pEJhsuNOLaJqiRyBXp9UhWA1DhVvDw==} |
| 301 | 364 | |
| 365 | + '@codemirror/legacy-modes@6.5.5': | |
| 366 | + resolution: {integrity: sha512-9ltT214oMb3Y1w5eAZMSigzrjzZnMI2Wa3Feq73rU/i4C56MkwrpfswfQYOr28C5pXr6dWwspNTMyeHXlzWMxg==} | |
| 367 | + | |
| 302 | 368 | '@codemirror/lint@6.9.7': |
| 303 | 369 | resolution: {integrity: sha512-28/+iWLYxKxsvGYhSYL7zaCZqLz5+FFFDq9tVsvGv9kv8RY4fFAchJ5WX9M3YrrRlTIsECjsXPqeNgnSmNP2dg==} |
| 304 | 370 | |
| @@ -381,15 +447,24 @@ packages: | ||
| 381 | 447 | '@lezer/common@1.5.4': |
| 382 | 448 | resolution: {integrity: sha512-xt3Q4z64xM+xhg4M7NXqw1N//1O74bUFo5kz6fwMeC4qwxSuRdwkYSmjcqCEEKYkNw5e67f2hcNqBoNERAEU0w==} |
| 383 | 449 | |
| 450 | + '@lezer/cpp@1.1.6': | |
| 451 | + resolution: {integrity: sha512-vh9gWWJOXFVY8HBHK3Twzq8MgwG2iN4GSyzBP9sCGTe37P15x2R14VaBQk0VA0ezTRN1KHYBBsHhvpGZ2Xy/pA==} | |
| 452 | + | |
| 384 | 453 | '@lezer/css@1.3.9': |
| 385 | 454 | resolution: {integrity: sha512-ZmzgvTOBdJWGIsY/ItAfN7UW8DV802oZG+jeG6E508SwEzz5YhuAajptpWPICvIyqYAD2+VjMdOS40GgGkyEOQ==} |
| 386 | 455 | |
| 456 | + '@lezer/go@1.0.1': | |
| 457 | + resolution: {integrity: sha512-xToRsYxwsgJNHTgNdStpcvmbVuKxTapV0dM0wey1geMMRc9aggoVyKgzYp41D2/vVOx+Ii4hmE206kvxIXBVXQ==} | |
| 458 | + | |
| 387 | 459 | '@lezer/highlight@1.2.5': |
| 388 | 460 | resolution: {integrity: sha512-O1GMVKgtf5YspFaRzpmqkVgMtIk2HG9uMAbH6wdAIdNh3TVzCsch/+cRi+6l2//UGDKe6NB9BW3cvuR5ezMQ0w==} |
| 389 | 461 | |
| 390 | 462 | '@lezer/html@1.3.13': |
| 391 | 463 | resolution: {integrity: sha512-oI7n6NJml729m7pjm9lvLvmXbdoMoi2f+1pwSDJkl9d68zGr7a9Btz8NdHTGQZtW2DA25ybeuv/SyDb9D5tseg==} |
| 392 | 464 | |
| 465 | + '@lezer/java@1.1.5': | |
| 466 | + resolution: {integrity: sha512-JppTd1iKHpeNlLYw/Zl8JX7zSY5HqAzK4zZ05lpn8l8Sk7Fo5KAKiDiMiezKoT5lfeC2xZf8HeKp1tSctj4G6Q==} | |
| 467 | + | |
| 393 | 468 | '@lezer/javascript@1.5.6': |
| 394 | 469 | resolution: {integrity: sha512-sEvOqpl4vJQca0NugSQK02vQPbc5KrvoojnYGoqqFgFO0MtcYhwGiHKVEB+LuXYJnfyXo4QPA8ztbrEa4Fw5NA==} |
| 395 | 470 | |
| @@ -402,6 +477,18 @@ packages: | ||
| 402 | 477 | '@lezer/markdown@1.8.1': |
| 403 | 478 | resolution: {integrity: sha512-M5YmEcKWO4mJ45Y1hECwqyu8cLv25EiXOK554PVOvDOWOP0olwelHHQUWr9sjF+d1bENVhy0nfJ8E57XZUTiXg==} |
| 404 | 479 | |
| 480 | + '@lezer/php@1.0.6': | |
| 481 | + resolution: {integrity: sha512-QJ2xNXPmsm/Z3IpThq8fnJrEIVpxhsIoj6GZBW0JYEd/l9zxpJZW216X4fzqQY4vgpdGIumypvI4uQjd4tnYtw==} | |
| 482 | + | |
| 483 | + '@lezer/python@1.1.19': | |
| 484 | + resolution: {integrity: sha512-MhQIURHRytsNzP/YXnqpYKW6la6voAH3kyplTOOiCdjyFY6cWWGFVmYVdHIPrElqSDf4iCDktQCockB9FxuhzQ==} | |
| 485 | + | |
| 486 | + '@lezer/rust@1.0.3': | |
| 487 | + resolution: {integrity: sha512-XxErOjZzQ7yJt1agUT4fu9qQvESZ3acgoxpPaPTPOiUx+duCjaVAtZGFIgphkHxlN05djdVAIOy/wItShMEjqQ==} | |
| 488 | + | |
| 489 | + '@lezer/xml@1.0.6': | |
| 490 | + resolution: {integrity: sha512-CdDwirL0OEaStFue/66ZmFSeppuL6Dwjlk8qk153mSQwiSH/Dlri4GNymrNWnUmPl2Um7QfV1FO9KFUyX3Twww==} | |
| 491 | + | |
| 405 | 492 | '@lezer/yaml@1.0.4': |
| 406 | 493 | resolution: {integrity: sha512-2lrrHqxalACEbxIbsjhqGpSW8kWpUKuY6RHgnSAFZa6qK62wvnPxA8hGOwOoDbwHcOFs5M4o27mjGu+P7TvBmw==} |
| 407 | 494 | |
| @@ -1255,6 +1342,11 @@ snapshots: | ||
| 1255 | 1342 | '@codemirror/view': 6.43.14 |
| 1256 | 1343 | '@lezer/common': 1.5.4 |
| 1257 | 1344 | |
| 1345 | + '@codemirror/lang-cpp@6.0.3': | |
| 1346 | + dependencies: | |
| 1347 | + '@codemirror/language': 6.13.1 | |
| 1348 | + '@lezer/cpp': 1.1.6 | |
| 1349 | + | |
| 1258 | 1350 | '@codemirror/lang-css@6.3.1': |
| 1259 | 1351 | dependencies: |
| 1260 | 1352 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1263,6 +1355,14 @@ snapshots: | ||
| 1263 | 1355 | '@lezer/common': 1.5.4 |
| 1264 | 1356 | '@lezer/css': 1.3.9 |
| 1265 | 1357 | |
| 1358 | + '@codemirror/lang-go@6.0.1': | |
| 1359 | + dependencies: | |
| 1360 | + '@codemirror/autocomplete': 6.20.3 | |
| 1361 | + '@codemirror/language': 6.13.1 | |
| 1362 | + '@codemirror/state': 6.7.6 | |
| 1363 | + '@lezer/common': 1.5.4 | |
| 1364 | + '@lezer/go': 1.0.1 | |
| 1365 | + | |
| 1266 | 1366 | '@codemirror/lang-html@6.4.12': |
| 1267 | 1367 | dependencies: |
| 1268 | 1368 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1275,6 +1375,11 @@ snapshots: | ||
| 1275 | 1375 | '@lezer/css': 1.3.9 |
| 1276 | 1376 | '@lezer/html': 1.3.13 |
| 1277 | 1377 | |
| 1378 | + '@codemirror/lang-java@6.0.2': | |
| 1379 | + dependencies: | |
| 1380 | + '@codemirror/language': 6.13.1 | |
| 1381 | + '@lezer/java': 1.1.5 | |
| 1382 | + | |
| 1278 | 1383 | '@codemirror/lang-javascript@6.2.5': |
| 1279 | 1384 | dependencies: |
| 1280 | 1385 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1300,6 +1405,45 @@ snapshots: | ||
| 1300 | 1405 | '@lezer/common': 1.5.4 |
| 1301 | 1406 | '@lezer/markdown': 1.8.1 |
| 1302 | 1407 | |
| 1408 | + '@codemirror/lang-php@6.0.2': | |
| 1409 | + dependencies: | |
| 1410 | + '@codemirror/lang-html': 6.4.12 | |
| 1411 | + '@codemirror/language': 6.13.1 | |
| 1412 | + '@codemirror/state': 6.7.6 | |
| 1413 | + '@lezer/common': 1.5.4 | |
| 1414 | + '@lezer/php': 1.0.6 | |
| 1415 | + | |
| 1416 | + '@codemirror/lang-python@6.2.1': | |
| 1417 | + dependencies: | |
| 1418 | + '@codemirror/autocomplete': 6.20.3 | |
| 1419 | + '@codemirror/language': 6.13.1 | |
| 1420 | + '@codemirror/state': 6.7.6 | |
| 1421 | + '@lezer/common': 1.5.4 | |
| 1422 | + '@lezer/python': 1.1.19 | |
| 1423 | + | |
| 1424 | + '@codemirror/lang-rust@6.0.2': | |
| 1425 | + dependencies: | |
| 1426 | + '@codemirror/language': 6.13.1 | |
| 1427 | + '@lezer/rust': 1.0.3 | |
| 1428 | + | |
| 1429 | + '@codemirror/lang-sql@6.10.0': | |
| 1430 | + dependencies: | |
| 1431 | + '@codemirror/autocomplete': 6.20.3 | |
| 1432 | + '@codemirror/language': 6.13.1 | |
| 1433 | + '@codemirror/state': 6.7.6 | |
| 1434 | + '@lezer/common': 1.5.4 | |
| 1435 | + '@lezer/highlight': 1.2.5 | |
| 1436 | + '@lezer/lr': 1.4.11 | |
| 1437 | + | |
| 1438 | + '@codemirror/lang-xml@6.1.0': | |
| 1439 | + dependencies: | |
| 1440 | + '@codemirror/autocomplete': 6.20.3 | |
| 1441 | + '@codemirror/language': 6.13.1 | |
| 1442 | + '@codemirror/state': 6.7.6 | |
| 1443 | + '@codemirror/view': 6.43.14 | |
| 1444 | + '@lezer/common': 1.5.4 | |
| 1445 | + '@lezer/xml': 1.0.6 | |
| 1446 | + | |
| 1303 | 1447 | '@codemirror/lang-yaml@6.1.3': |
| 1304 | 1448 | dependencies: |
| 1305 | 1449 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1320,6 +1464,10 @@ snapshots: | ||
| 1320 | 1464 | '@lezer/lr': 1.4.11 |
| 1321 | 1465 | style-mod: 4.1.4 |
| 1322 | 1466 | |
| 1467 | + '@codemirror/legacy-modes@6.5.5': | |
| 1468 | + dependencies: | |
| 1469 | + '@codemirror/streamparser': 6.0.0 | |
| 1470 | + | |
| 1323 | 1471 | '@codemirror/lint@6.9.7': |
| 1324 | 1472 | dependencies: |
| 1325 | 1473 | '@codemirror/state': 6.7.6 |
| @@ -1399,12 +1547,24 @@ snapshots: | ||
| 1399 | 1547 | |
| 1400 | 1548 | '@lezer/common@1.5.4': {} |
| 1401 | 1549 | |
| 1550 | + '@lezer/cpp@1.1.6': | |
| 1551 | + dependencies: | |
| 1552 | + '@lezer/common': 1.5.4 | |
| 1553 | + '@lezer/highlight': 1.2.5 | |
| 1554 | + '@lezer/lr': 1.4.11 | |
| 1555 | + | |
| 1402 | 1556 | '@lezer/css@1.3.9': |
| 1403 | 1557 | dependencies: |
| 1404 | 1558 | '@lezer/common': 1.5.4 |
| 1405 | 1559 | '@lezer/highlight': 1.2.5 |
| 1406 | 1560 | '@lezer/lr': 1.4.11 |
| 1407 | 1561 | |
| 1562 | + '@lezer/go@1.0.1': | |
| 1563 | + dependencies: | |
| 1564 | + '@lezer/common': 1.5.4 | |
| 1565 | + '@lezer/highlight': 1.2.5 | |
| 1566 | + '@lezer/lr': 1.4.11 | |
| 1567 | + | |
| 1408 | 1568 | '@lezer/highlight@1.2.5': |
| 1409 | 1569 | dependencies: |
| 1410 | 1570 | '@lezer/common': 1.5.4 |
| @@ -1415,6 +1575,12 @@ snapshots: | ||
| 1415 | 1575 | '@lezer/highlight': 1.2.5 |
| 1416 | 1576 | '@lezer/lr': 1.4.11 |
| 1417 | 1577 | |
| 1578 | + '@lezer/java@1.1.5': | |
| 1579 | + dependencies: | |
| 1580 | + '@lezer/common': 1.5.4 | |
| 1581 | + '@lezer/highlight': 1.2.5 | |
| 1582 | + '@lezer/lr': 1.4.11 | |
| 1583 | + | |
| 1418 | 1584 | '@lezer/javascript@1.5.6': |
| 1419 | 1585 | dependencies: |
| 1420 | 1586 | '@lezer/common': 1.5.4 |
| @@ -1436,6 +1602,30 @@ snapshots: | ||
| 1436 | 1602 | '@lezer/common': 1.5.4 |
| 1437 | 1603 | '@lezer/highlight': 1.2.5 |
| 1438 | 1604 | |
| 1605 | + '@lezer/php@1.0.6': | |
| 1606 | + dependencies: | |
| 1607 | + '@lezer/common': 1.5.4 | |
| 1608 | + '@lezer/highlight': 1.2.5 | |
| 1609 | + '@lezer/lr': 1.4.11 | |
| 1610 | + | |
| 1611 | + '@lezer/python@1.1.19': | |
| 1612 | + dependencies: | |
| 1613 | + '@lezer/common': 1.5.4 | |
| 1614 | + '@lezer/highlight': 1.2.5 | |
| 1615 | + '@lezer/lr': 1.4.11 | |
| 1616 | + | |
| 1617 | + '@lezer/rust@1.0.3': | |
| 1618 | + dependencies: | |
| 1619 | + '@lezer/common': 1.5.4 | |
| 1620 | + '@lezer/highlight': 1.2.5 | |
| 1621 | + '@lezer/lr': 1.4.11 | |
| 1622 | + | |
| 1623 | + '@lezer/xml@1.0.6': | |
| 1624 | + dependencies: | |
| 1625 | + '@lezer/common': 1.5.4 | |
| 1626 | + '@lezer/highlight': 1.2.5 | |
| 1627 | + '@lezer/lr': 1.4.11 | |
| 1628 | + | |
| 1439 | 1629 | '@lezer/yaml@1.0.4': |
| 1440 | 1630 | dependencies: |
| 1441 | 1631 | '@lezer/common': 1.5.4 |
| @@ -172,15 +172,54 @@ importers: | |||
| 172 | '@codemirror/autocomplete': | 172 | '@codemirror/autocomplete': |
| 173 | specifier: 6.20.3 | 173 | specifier: 6.20.3 |
| 174 | version: 6.20.3 | 174 | version: 6.20.3 |
| 175 | + '@codemirror/lang-cpp': | ||
| 176 | + specifier: 6.0.3 | ||
| 177 | + version: 6.0.3 | ||
| 178 | + '@codemirror/lang-css': | ||
| 179 | + specifier: 6.3.1 | ||
| 180 | + version: 6.3.1 | ||
| 181 | + '@codemirror/lang-go': | ||
| 182 | + specifier: 6.0.1 | ||
| 183 | + version: 6.0.1 | ||
| 184 | + '@codemirror/lang-html': | ||
| 185 | + specifier: 6.4.12 | ||
| 186 | + version: 6.4.12 | ||
| 187 | + '@codemirror/lang-java': | ||
| 188 | + specifier: 6.0.2 | ||
| 189 | + version: 6.0.2 | ||
| 190 | + '@codemirror/lang-javascript': | ||
| 191 | + specifier: 6.2.5 | ||
| 192 | + version: 6.2.5 | ||
| 175 | '@codemirror/lang-json': | 193 | '@codemirror/lang-json': |
| 176 | specifier: 6.0.2 | 194 | specifier: 6.0.2 |
| 177 | version: 6.0.2 | 195 | version: 6.0.2 |
| 178 | '@codemirror/lang-markdown': | 196 | '@codemirror/lang-markdown': |
| 179 | specifier: 6.5.2 | 197 | specifier: 6.5.2 |
| 180 | version: 6.5.2 | 198 | version: 6.5.2 |
| 199 | + '@codemirror/lang-php': | ||
| 200 | + specifier: 6.0.2 | ||
| 201 | + version: 6.0.2 | ||
| 202 | + '@codemirror/lang-python': | ||
| 203 | + specifier: 6.2.1 | ||
| 204 | + version: 6.2.1 | ||
| 205 | + '@codemirror/lang-rust': | ||
| 206 | + specifier: 6.0.2 | ||
| 207 | + version: 6.0.2 | ||
| 208 | + '@codemirror/lang-sql': | ||
| 209 | + specifier: 6.10.0 | ||
| 210 | + version: 6.10.0 | ||
| 211 | + '@codemirror/lang-xml': | ||
| 212 | + specifier: 6.1.0 | ||
| 213 | + version: 6.1.0 | ||
| 181 | '@codemirror/lang-yaml': | 214 | '@codemirror/lang-yaml': |
| 182 | specifier: 6.1.3 | 215 | specifier: 6.1.3 |
| 183 | version: 6.1.3 | 216 | version: 6.1.3 |
| 217 | + '@codemirror/language': | ||
| 218 | + specifier: 6.13.1 | ||
| 219 | + version: 6.13.1 | ||
| 220 | + '@codemirror/legacy-modes': | ||
| 221 | + specifier: 6.5.5 | ||
| 222 | + version: 6.5.5 | ||
| 184 | '@codemirror/lint': | 223 | '@codemirror/lint': |
| 185 | specifier: 6.9.7 | 224 | specifier: 6.9.7 |
| 186 | version: 6.9.7 | 225 | version: 6.9.7 |
| @@ -278,12 +317,21 @@ packages: | |||
| 278 | '@codemirror/commands@6.11.1': | 317 | '@codemirror/commands@6.11.1': |
| 279 | resolution: {integrity: sha512-O/4hG3SC1YwcmQ0d2UVNDs+AsaNWd1iHVxbTeEBuqH+6bExAiPK3iS/BvpY6rZGURALv4ZD3sIgcCmRvw3ehBg==} | 318 | resolution: {integrity: sha512-O/4hG3SC1YwcmQ0d2UVNDs+AsaNWd1iHVxbTeEBuqH+6bExAiPK3iS/BvpY6rZGURALv4ZD3sIgcCmRvw3ehBg==} |
| 280 | 319 | ||
| 320 | + '@codemirror/lang-cpp@6.0.3': | ||
| 321 | + resolution: {integrity: sha512-URM26M3vunFFn9/sm6rzqrBzDgfWuDixp85uTY49wKudToc2jTHUrKIGGKs+QWND+YLofNNZpxcNGRynFJfvgA==} | ||
| 322 | + | ||
| 281 | '@codemirror/lang-css@6.3.1': | 323 | '@codemirror/lang-css@6.3.1': |
| 282 | resolution: {integrity: sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==} | 324 | resolution: {integrity: sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==} |
| 283 | 325 | ||
| 326 | + '@codemirror/lang-go@6.0.1': | ||
| 327 | + resolution: {integrity: sha512-7fNvbyNylvqCphW9HD6WFnRpcDjr+KXX/FgqXy5H5ZS0eC5edDljukm/yNgYkwTsgp2busdod50AOTIy6Jikfg==} | ||
| 328 | + | ||
| 284 | '@codemirror/lang-html@6.4.12': | 329 | '@codemirror/lang-html@6.4.12': |
| 285 | resolution: {integrity: sha512-pw2ReWKUqSkbvh76RAT4NYxiogRu+PWkR2ukAwO9uOgrm8uipkzjtKKtNpyeAQwHOqxEeSvAXZ6vr3AfyB9y/w==} | 330 | resolution: {integrity: sha512-pw2ReWKUqSkbvh76RAT4NYxiogRu+PWkR2ukAwO9uOgrm8uipkzjtKKtNpyeAQwHOqxEeSvAXZ6vr3AfyB9y/w==} |
| 286 | 331 | ||
| 332 | + '@codemirror/lang-java@6.0.2': | ||
| 333 | + resolution: {integrity: sha512-m5Nt1mQ/cznJY7tMfQTJchmrjdjQ71IDs+55d1GAa8DGaB8JXWsVCkVT284C3RTASaY43YknrK2X3hPO/J3MOQ==} | ||
| 334 | + | ||
| 287 | '@codemirror/lang-javascript@6.2.5': | 335 | '@codemirror/lang-javascript@6.2.5': |
| 288 | resolution: {integrity: sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A==} | 336 | resolution: {integrity: sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A==} |
| 289 | 337 | ||
| @@ -293,12 +341,30 @@ packages: | |||
| 293 | '@codemirror/lang-markdown@6.5.2': | 341 | '@codemirror/lang-markdown@6.5.2': |
| 294 | resolution: {integrity: sha512-AwBOdkWYuA//WcM0xO5PfHPUcmz/O2i5o0Nsg1U69SII/loCJlFI1Romd9xp2HYb1kYJRGZotyqRghuHH5n8Kw==} | 342 | resolution: {integrity: sha512-AwBOdkWYuA//WcM0xO5PfHPUcmz/O2i5o0Nsg1U69SII/loCJlFI1Romd9xp2HYb1kYJRGZotyqRghuHH5n8Kw==} |
| 295 | 343 | ||
| 344 | + '@codemirror/lang-php@6.0.2': | ||
| 345 | + resolution: {integrity: sha512-ZKy2v1n8Fc8oEXj0Th0PUMXzQJ0AIR6TaZU+PbDHExFwdu+guzOA4jmCHS1Nz4vbFezwD7LyBdDnddSJeScMCA==} | ||
| 346 | + | ||
| 347 | + '@codemirror/lang-python@6.2.1': | ||
| 348 | + resolution: {integrity: sha512-IRjC8RUBhn9mGR9ywecNhB51yePWCGgvHfY1lWN/Mrp3cKuHr0isDKia+9HnvhiWNnMpbGhWrkhuWOc09exRyw==} | ||
| 349 | + | ||
| 350 | + '@codemirror/lang-rust@6.0.2': | ||
| 351 | + resolution: {integrity: sha512-EZaGjCUegtiU7kSMvOfEZpaCReowEf3yNidYu7+vfuGTm9ow4mthAparY5hisJqOHmJowVH3Upu+eJlUji6qqA==} | ||
| 352 | + | ||
| 353 | + '@codemirror/lang-sql@6.10.0': | ||
| 354 | + resolution: {integrity: sha512-6ayPkEd/yRw0XKBx5uAiToSgGECo/GY2NoJIHXIIQh1EVwLuKoU8BP/qK0qH5NLXAbtJRLuT73hx7P9X34iO4w==} | ||
| 355 | + | ||
| 356 | + '@codemirror/lang-xml@6.1.0': | ||
| 357 | + resolution: {integrity: sha512-3z0blhicHLfwi2UgkZYRPioSgVTo9PV5GP5ducFH6FaHy0IAJRg+ixj5gTR1gnT/glAIC8xv4w2VL1LoZfs+Jg==} | ||
| 358 | + | ||
| 296 | '@codemirror/lang-yaml@6.1.3': | 359 | '@codemirror/lang-yaml@6.1.3': |
| 297 | resolution: {integrity: sha512-AZ8DJBuXGVHybpBQhmZtgew5//4hv3tdkXnr3vDmOUMJRuB6vn/uuwtmTOTlqEaQFg3hQSVeA90NmvIQyUV6FQ==} | 360 | resolution: {integrity: sha512-AZ8DJBuXGVHybpBQhmZtgew5//4hv3tdkXnr3vDmOUMJRuB6vn/uuwtmTOTlqEaQFg3hQSVeA90NmvIQyUV6FQ==} |
| 298 | 361 | ||
| 299 | '@codemirror/language@6.13.1': | 362 | '@codemirror/language@6.13.1': |
| 300 | resolution: {integrity: sha512-zfvU2r3TyylQLMj/te+5CnQ0rSqZi8B1oTCBbQkagcLW4Xc6imab6qN+pEJhsuNOLaJqiRyBXp9UhWA1DhVvDw==} | 363 | resolution: {integrity: sha512-zfvU2r3TyylQLMj/te+5CnQ0rSqZi8B1oTCBbQkagcLW4Xc6imab6qN+pEJhsuNOLaJqiRyBXp9UhWA1DhVvDw==} |
| 301 | 364 | ||
| 365 | + '@codemirror/legacy-modes@6.5.5': | ||
| 366 | + resolution: {integrity: sha512-9ltT214oMb3Y1w5eAZMSigzrjzZnMI2Wa3Feq73rU/i4C56MkwrpfswfQYOr28C5pXr6dWwspNTMyeHXlzWMxg==} | ||
| 367 | + | ||
| 302 | '@codemirror/lint@6.9.7': | 368 | '@codemirror/lint@6.9.7': |
| 303 | resolution: {integrity: sha512-28/+iWLYxKxsvGYhSYL7zaCZqLz5+FFFDq9tVsvGv9kv8RY4fFAchJ5WX9M3YrrRlTIsECjsXPqeNgnSmNP2dg==} | 369 | resolution: {integrity: sha512-28/+iWLYxKxsvGYhSYL7zaCZqLz5+FFFDq9tVsvGv9kv8RY4fFAchJ5WX9M3YrrRlTIsECjsXPqeNgnSmNP2dg==} |
| 304 | 370 | ||
| @@ -381,15 +447,24 @@ packages: | |||
| 381 | '@lezer/common@1.5.4': | 447 | '@lezer/common@1.5.4': |
| 382 | resolution: {integrity: sha512-xt3Q4z64xM+xhg4M7NXqw1N//1O74bUFo5kz6fwMeC4qwxSuRdwkYSmjcqCEEKYkNw5e67f2hcNqBoNERAEU0w==} | 448 | resolution: {integrity: sha512-xt3Q4z64xM+xhg4M7NXqw1N//1O74bUFo5kz6fwMeC4qwxSuRdwkYSmjcqCEEKYkNw5e67f2hcNqBoNERAEU0w==} |
| 383 | 449 | ||
| 450 | + '@lezer/cpp@1.1.6': | ||
| 451 | + resolution: {integrity: sha512-vh9gWWJOXFVY8HBHK3Twzq8MgwG2iN4GSyzBP9sCGTe37P15x2R14VaBQk0VA0ezTRN1KHYBBsHhvpGZ2Xy/pA==} | ||
| 452 | + | ||
| 384 | '@lezer/css@1.3.9': | 453 | '@lezer/css@1.3.9': |
| 385 | resolution: {integrity: sha512-ZmzgvTOBdJWGIsY/ItAfN7UW8DV802oZG+jeG6E508SwEzz5YhuAajptpWPICvIyqYAD2+VjMdOS40GgGkyEOQ==} | 454 | resolution: {integrity: sha512-ZmzgvTOBdJWGIsY/ItAfN7UW8DV802oZG+jeG6E508SwEzz5YhuAajptpWPICvIyqYAD2+VjMdOS40GgGkyEOQ==} |
| 386 | 455 | ||
| 456 | + '@lezer/go@1.0.1': | ||
| 457 | + resolution: {integrity: sha512-xToRsYxwsgJNHTgNdStpcvmbVuKxTapV0dM0wey1geMMRc9aggoVyKgzYp41D2/vVOx+Ii4hmE206kvxIXBVXQ==} | ||
| 458 | + | ||
| 387 | '@lezer/highlight@1.2.5': | 459 | '@lezer/highlight@1.2.5': |
| 388 | resolution: {integrity: sha512-O1GMVKgtf5YspFaRzpmqkVgMtIk2HG9uMAbH6wdAIdNh3TVzCsch/+cRi+6l2//UGDKe6NB9BW3cvuR5ezMQ0w==} | 460 | resolution: {integrity: sha512-O1GMVKgtf5YspFaRzpmqkVgMtIk2HG9uMAbH6wdAIdNh3TVzCsch/+cRi+6l2//UGDKe6NB9BW3cvuR5ezMQ0w==} |
| 389 | 461 | ||
| 390 | '@lezer/html@1.3.13': | 462 | '@lezer/html@1.3.13': |
| 391 | resolution: {integrity: sha512-oI7n6NJml729m7pjm9lvLvmXbdoMoi2f+1pwSDJkl9d68zGr7a9Btz8NdHTGQZtW2DA25ybeuv/SyDb9D5tseg==} | 463 | resolution: {integrity: sha512-oI7n6NJml729m7pjm9lvLvmXbdoMoi2f+1pwSDJkl9d68zGr7a9Btz8NdHTGQZtW2DA25ybeuv/SyDb9D5tseg==} |
| 392 | 464 | ||
| 465 | + '@lezer/java@1.1.5': | ||
| 466 | + resolution: {integrity: sha512-JppTd1iKHpeNlLYw/Zl8JX7zSY5HqAzK4zZ05lpn8l8Sk7Fo5KAKiDiMiezKoT5lfeC2xZf8HeKp1tSctj4G6Q==} | ||
| 467 | + | ||
| 393 | '@lezer/javascript@1.5.6': | 468 | '@lezer/javascript@1.5.6': |
| 394 | resolution: {integrity: sha512-sEvOqpl4vJQca0NugSQK02vQPbc5KrvoojnYGoqqFgFO0MtcYhwGiHKVEB+LuXYJnfyXo4QPA8ztbrEa4Fw5NA==} | 469 | resolution: {integrity: sha512-sEvOqpl4vJQca0NugSQK02vQPbc5KrvoojnYGoqqFgFO0MtcYhwGiHKVEB+LuXYJnfyXo4QPA8ztbrEa4Fw5NA==} |
| 395 | 470 | ||
| @@ -402,6 +477,18 @@ packages: | |||
| 402 | '@lezer/markdown@1.8.1': | 477 | '@lezer/markdown@1.8.1': |
| 403 | resolution: {integrity: sha512-M5YmEcKWO4mJ45Y1hECwqyu8cLv25EiXOK554PVOvDOWOP0olwelHHQUWr9sjF+d1bENVhy0nfJ8E57XZUTiXg==} | 478 | resolution: {integrity: sha512-M5YmEcKWO4mJ45Y1hECwqyu8cLv25EiXOK554PVOvDOWOP0olwelHHQUWr9sjF+d1bENVhy0nfJ8E57XZUTiXg==} |
| 404 | 479 | ||
| 480 | + '@lezer/php@1.0.6': | ||
| 481 | + resolution: {integrity: sha512-QJ2xNXPmsm/Z3IpThq8fnJrEIVpxhsIoj6GZBW0JYEd/l9zxpJZW216X4fzqQY4vgpdGIumypvI4uQjd4tnYtw==} | ||
| 482 | + | ||
| 483 | + '@lezer/python@1.1.19': | ||
| 484 | + resolution: {integrity: sha512-MhQIURHRytsNzP/YXnqpYKW6la6voAH3kyplTOOiCdjyFY6cWWGFVmYVdHIPrElqSDf4iCDktQCockB9FxuhzQ==} | ||
| 485 | + | ||
| 486 | + '@lezer/rust@1.0.3': | ||
| 487 | + resolution: {integrity: sha512-XxErOjZzQ7yJt1agUT4fu9qQvESZ3acgoxpPaPTPOiUx+duCjaVAtZGFIgphkHxlN05djdVAIOy/wItShMEjqQ==} | ||
| 488 | + | ||
| 489 | + '@lezer/xml@1.0.6': | ||
| 490 | + resolution: {integrity: sha512-CdDwirL0OEaStFue/66ZmFSeppuL6Dwjlk8qk153mSQwiSH/Dlri4GNymrNWnUmPl2Um7QfV1FO9KFUyX3Twww==} | ||
| 491 | + | ||
| 405 | '@lezer/yaml@1.0.4': | 492 | '@lezer/yaml@1.0.4': |
| 406 | resolution: {integrity: sha512-2lrrHqxalACEbxIbsjhqGpSW8kWpUKuY6RHgnSAFZa6qK62wvnPxA8hGOwOoDbwHcOFs5M4o27mjGu+P7TvBmw==} | 493 | resolution: {integrity: sha512-2lrrHqxalACEbxIbsjhqGpSW8kWpUKuY6RHgnSAFZa6qK62wvnPxA8hGOwOoDbwHcOFs5M4o27mjGu+P7TvBmw==} |
| 407 | 494 | ||
| @@ -1255,6 +1342,11 @@ snapshots: | |||
| 1255 | '@codemirror/view': 6.43.14 | 1342 | '@codemirror/view': 6.43.14 |
| 1256 | '@lezer/common': 1.5.4 | 1343 | '@lezer/common': 1.5.4 |
| 1257 | 1344 | ||
| 1345 | + '@codemirror/lang-cpp@6.0.3': | ||
| 1346 | + dependencies: | ||
| 1347 | + '@codemirror/language': 6.13.1 | ||
| 1348 | + '@lezer/cpp': 1.1.6 | ||
| 1349 | + | ||
| 1258 | '@codemirror/lang-css@6.3.1': | 1350 | '@codemirror/lang-css@6.3.1': |
| 1259 | dependencies: | 1351 | dependencies: |
| 1260 | '@codemirror/autocomplete': 6.20.3 | 1352 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1263,6 +1355,14 @@ snapshots: | |||
| 1263 | '@lezer/common': 1.5.4 | 1355 | '@lezer/common': 1.5.4 |
| 1264 | '@lezer/css': 1.3.9 | 1356 | '@lezer/css': 1.3.9 |
| 1265 | 1357 | ||
| 1358 | + '@codemirror/lang-go@6.0.1': | ||
| 1359 | + dependencies: | ||
| 1360 | + '@codemirror/autocomplete': 6.20.3 | ||
| 1361 | + '@codemirror/language': 6.13.1 | ||
| 1362 | + '@codemirror/state': 6.7.6 | ||
| 1363 | + '@lezer/common': 1.5.4 | ||
| 1364 | + '@lezer/go': 1.0.1 | ||
| 1365 | + | ||
| 1266 | '@codemirror/lang-html@6.4.12': | 1366 | '@codemirror/lang-html@6.4.12': |
| 1267 | dependencies: | 1367 | dependencies: |
| 1268 | '@codemirror/autocomplete': 6.20.3 | 1368 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1275,6 +1375,11 @@ snapshots: | |||
| 1275 | '@lezer/css': 1.3.9 | 1375 | '@lezer/css': 1.3.9 |
| 1276 | '@lezer/html': 1.3.13 | 1376 | '@lezer/html': 1.3.13 |
| 1277 | 1377 | ||
| 1378 | + '@codemirror/lang-java@6.0.2': | ||
| 1379 | + dependencies: | ||
| 1380 | + '@codemirror/language': 6.13.1 | ||
| 1381 | + '@lezer/java': 1.1.5 | ||
| 1382 | + | ||
| 1278 | '@codemirror/lang-javascript@6.2.5': | 1383 | '@codemirror/lang-javascript@6.2.5': |
| 1279 | dependencies: | 1384 | dependencies: |
| 1280 | '@codemirror/autocomplete': 6.20.3 | 1385 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1300,6 +1405,45 @@ snapshots: | |||
| 1300 | '@lezer/common': 1.5.4 | 1405 | '@lezer/common': 1.5.4 |
| 1301 | '@lezer/markdown': 1.8.1 | 1406 | '@lezer/markdown': 1.8.1 |
| 1302 | 1407 | ||
| 1408 | + '@codemirror/lang-php@6.0.2': | ||
| 1409 | + dependencies: | ||
| 1410 | + '@codemirror/lang-html': 6.4.12 | ||
| 1411 | + '@codemirror/language': 6.13.1 | ||
| 1412 | + '@codemirror/state': 6.7.6 | ||
| 1413 | + '@lezer/common': 1.5.4 | ||
| 1414 | + '@lezer/php': 1.0.6 | ||
| 1415 | + | ||
| 1416 | + '@codemirror/lang-python@6.2.1': | ||
| 1417 | + dependencies: | ||
| 1418 | + '@codemirror/autocomplete': 6.20.3 | ||
| 1419 | + '@codemirror/language': 6.13.1 | ||
| 1420 | + '@codemirror/state': 6.7.6 | ||
| 1421 | + '@lezer/common': 1.5.4 | ||
| 1422 | + '@lezer/python': 1.1.19 | ||
| 1423 | + | ||
| 1424 | + '@codemirror/lang-rust@6.0.2': | ||
| 1425 | + dependencies: | ||
| 1426 | + '@codemirror/language': 6.13.1 | ||
| 1427 | + '@lezer/rust': 1.0.3 | ||
| 1428 | + | ||
| 1429 | + '@codemirror/lang-sql@6.10.0': | ||
| 1430 | + dependencies: | ||
| 1431 | + '@codemirror/autocomplete': 6.20.3 | ||
| 1432 | + '@codemirror/language': 6.13.1 | ||
| 1433 | + '@codemirror/state': 6.7.6 | ||
| 1434 | + '@lezer/common': 1.5.4 | ||
| 1435 | + '@lezer/highlight': 1.2.5 | ||
| 1436 | + '@lezer/lr': 1.4.11 | ||
| 1437 | + | ||
| 1438 | + '@codemirror/lang-xml@6.1.0': | ||
| 1439 | + dependencies: | ||
| 1440 | + '@codemirror/autocomplete': 6.20.3 | ||
| 1441 | + '@codemirror/language': 6.13.1 | ||
| 1442 | + '@codemirror/state': 6.7.6 | ||
| 1443 | + '@codemirror/view': 6.43.14 | ||
| 1444 | + '@lezer/common': 1.5.4 | ||
| 1445 | + '@lezer/xml': 1.0.6 | ||
| 1446 | + | ||
| 1303 | '@codemirror/lang-yaml@6.1.3': | 1447 | '@codemirror/lang-yaml@6.1.3': |
| 1304 | dependencies: | 1448 | dependencies: |
| 1305 | '@codemirror/autocomplete': 6.20.3 | 1449 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1320,6 +1464,10 @@ snapshots: | |||
| 1320 | '@lezer/lr': 1.4.11 | 1464 | '@lezer/lr': 1.4.11 |
| 1321 | style-mod: 4.1.4 | 1465 | style-mod: 4.1.4 |
| 1322 | 1466 | ||
| 1467 | + '@codemirror/legacy-modes@6.5.5': | ||
| 1468 | + dependencies: | ||
| 1469 | + '@codemirror/streamparser': 6.0.0 | ||
| 1470 | + | ||
| 1323 | '@codemirror/lint@6.9.7': | 1471 | '@codemirror/lint@6.9.7': |
| 1324 | dependencies: | 1472 | dependencies: |
| 1325 | '@codemirror/state': 6.7.6 | 1473 | '@codemirror/state': 6.7.6 |
| @@ -1399,12 +1547,24 @@ snapshots: | |||
| 1399 | 1547 | ||
| 1400 | '@lezer/common@1.5.4': {} | 1548 | '@lezer/common@1.5.4': {} |
| 1401 | 1549 | ||
| 1550 | + '@lezer/cpp@1.1.6': | ||
| 1551 | + dependencies: | ||
| 1552 | + '@lezer/common': 1.5.4 | ||
| 1553 | + '@lezer/highlight': 1.2.5 | ||
| 1554 | + '@lezer/lr': 1.4.11 | ||
| 1555 | + | ||
| 1402 | '@lezer/css@1.3.9': | 1556 | '@lezer/css@1.3.9': |
| 1403 | dependencies: | 1557 | dependencies: |
| 1404 | '@lezer/common': 1.5.4 | 1558 | '@lezer/common': 1.5.4 |
| 1405 | '@lezer/highlight': 1.2.5 | 1559 | '@lezer/highlight': 1.2.5 |
| 1406 | '@lezer/lr': 1.4.11 | 1560 | '@lezer/lr': 1.4.11 |
| 1407 | 1561 | ||
| 1562 | + '@lezer/go@1.0.1': | ||
| 1563 | + dependencies: | ||
| 1564 | + '@lezer/common': 1.5.4 | ||
| 1565 | + '@lezer/highlight': 1.2.5 | ||
| 1566 | + '@lezer/lr': 1.4.11 | ||
| 1567 | + | ||
| 1408 | '@lezer/highlight@1.2.5': | 1568 | '@lezer/highlight@1.2.5': |
| 1409 | dependencies: | 1569 | dependencies: |
| 1410 | '@lezer/common': 1.5.4 | 1570 | '@lezer/common': 1.5.4 |
| @@ -1415,6 +1575,12 @@ snapshots: | |||
| 1415 | '@lezer/highlight': 1.2.5 | 1575 | '@lezer/highlight': 1.2.5 |
| 1416 | '@lezer/lr': 1.4.11 | 1576 | '@lezer/lr': 1.4.11 |
| 1417 | 1577 | ||
| 1578 | + '@lezer/java@1.1.5': | ||
| 1579 | + dependencies: | ||
| 1580 | + '@lezer/common': 1.5.4 | ||
| 1581 | + '@lezer/highlight': 1.2.5 | ||
| 1582 | + '@lezer/lr': 1.4.11 | ||
| 1583 | + | ||
| 1418 | '@lezer/javascript@1.5.6': | 1584 | '@lezer/javascript@1.5.6': |
| 1419 | dependencies: | 1585 | dependencies: |
| 1420 | '@lezer/common': 1.5.4 | 1586 | '@lezer/common': 1.5.4 |
| @@ -1436,6 +1602,30 @@ snapshots: | |||
| 1436 | '@lezer/common': 1.5.4 | 1602 | '@lezer/common': 1.5.4 |
| 1437 | '@lezer/highlight': 1.2.5 | 1603 | '@lezer/highlight': 1.2.5 |
| 1438 | 1604 | ||
| 1605 | + '@lezer/php@1.0.6': | ||
| 1606 | + dependencies: | ||
| 1607 | + '@lezer/common': 1.5.4 | ||
| 1608 | + '@lezer/highlight': 1.2.5 | ||
| 1609 | + '@lezer/lr': 1.4.11 | ||
| 1610 | + | ||
| 1611 | + '@lezer/python@1.1.19': | ||
| 1612 | + dependencies: | ||
| 1613 | + '@lezer/common': 1.5.4 | ||
| 1614 | + '@lezer/highlight': 1.2.5 | ||
| 1615 | + '@lezer/lr': 1.4.11 | ||
| 1616 | + | ||
| 1617 | + '@lezer/rust@1.0.3': | ||
| 1618 | + dependencies: | ||
| 1619 | + '@lezer/common': 1.5.4 | ||
| 1620 | + '@lezer/highlight': 1.2.5 | ||
| 1621 | + '@lezer/lr': 1.4.11 | ||
| 1622 | + | ||
| 1623 | + '@lezer/xml@1.0.6': | ||
| 1624 | + dependencies: | ||
| 1625 | + '@lezer/common': 1.5.4 | ||
| 1626 | + '@lezer/highlight': 1.2.5 | ||
| 1627 | + '@lezer/lr': 1.4.11 | ||
| 1628 | + | ||
| 1439 | '@lezer/yaml@1.0.4': | 1629 | '@lezer/yaml@1.0.4': |
| 1440 | dependencies: | 1630 | dependencies: |
| 1441 | '@lezer/common': 1.5.4 | 1631 | '@lezer/common': 1.5.4 |
modified
frontend/src/lib/agent/FileEditor.svelte +20 -11 | @@ -1,16 +1,16 @@ | ||
| 1 | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | 2 | <script lang="ts"> |
| 3 | 3 | // The editor of a workspace file (issue #30): the same CodeMirror as the |
| 4 | - // Settings panel, with the language of the file and ⌘S to save. | |
| 4 | + // Settings panel, with ⌘S to save, coloured according to the language of | |
| 5 | + // the file (issue #71), loaded once the text is shown. | |
| 5 | 6 | import { onMount } from 'svelte' |
| 6 | 7 | import { EditorView, basicSetup } from 'codemirror' |
| 7 | 8 | import { keymap } from '@codemirror/view' |
| 8 | - import { EditorState } from '@codemirror/state' | |
| 9 | - import { yaml } from '@codemirror/lang-yaml' | |
| 10 | - import { markdown } from '@codemirror/lang-markdown' | |
| 11 | - import { json } from '@codemirror/lang-json' | |
| 9 | + import { Compartment, EditorState } from '@codemirror/state' | |
| 12 | 10 | import { oneDark } from '@codemirror/theme-one-dark' |
| 13 | - import type { languageFor } from '../files' | |
| 11 | + import type { EditorLanguage } from '../files' | |
| 12 | + import { languageSupport, maxHighlightedSize } from '../editorLanguages' | |
| 13 | + import { isDark } from '../theme' | |
| 14 | 14 | |
| 15 | 15 | let { |
| 16 | 16 | content, |
| @@ -20,7 +20,7 @@ | ||
| 20 | 20 | readOnly = false, |
| 21 | 21 | }: { |
| 22 | 22 | content: string |
| 23 | - language: ReturnType<typeof languageFor> | |
| 23 | + language: EditorLanguage | |
| 24 | 24 | /** A protected file (issue #54): shown, never changed. */ |
| 25 | 25 | readOnly?: boolean |
| 26 | 26 | onChange: (text: string) => void |
| @@ -29,8 +29,8 @@ | ||
| 29 | 29 | |
| 30 | 30 | let host: HTMLElement |
| 31 | 31 | let view: EditorView | undefined |
| 32 | - const dark = window.matchMedia('(prefers-color-scheme: dark)').matches | |
| 33 | - const languages = { yaml: [yaml()], markdown: [markdown()], json: [json()], text: [] } | |
| 32 | + const dark = isDark(document.documentElement, window.matchMedia('(prefers-color-scheme: dark)').matches) | |
| 33 | + const highlighting = new Compartment() | |
| 34 | 34 | |
| 35 | 35 | onMount(() => { |
| 36 | 36 | view = new EditorView({ |
| @@ -38,7 +38,7 @@ | ||
| 38 | 38 | parent: host, |
| 39 | 39 | extensions: [ |
| 40 | 40 | basicSetup, |
| 41 | - ...languages[language], | |
| 41 | + highlighting.of([]), | |
| 42 | 42 | EditorView.lineWrapping, |
| 43 | 43 | EditorState.readOnly.of(readOnly), |
| 44 | 44 | EditorView.editable.of(!readOnly), |
| @@ -49,7 +49,16 @@ | ||
| 49 | 49 | ...(dark ? [oneDark] : []), |
| 50 | 50 | ], |
| 51 | 51 | }) |
| 52 | - return () => view?.destroy() | |
| 52 | + // A large file stays plain text; an unknown language too. | |
| 53 | + if (content.length <= maxHighlightedSize) { | |
| 54 | + languageSupport(language) | |
| 55 | + .then((support) => view?.dispatch({ effects: highlighting.reconfigure(support) })) | |
| 56 | + .catch(() => {}) // plain text is fine | |
| 57 | + } | |
| 58 | + return () => { | |
| 59 | + view?.destroy() | |
| 60 | + view = undefined | |
| 61 | + } | |
| 53 | 62 | }) |
| 54 | 63 | |
| 55 | 64 | /** Replaces the whole text, e.g. with the agent's version of the file. */ |
| @@ -1,16 +1,16 @@ | |||
| 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | <script lang="ts"> | 2 | <script lang="ts"> |
| 3 | // The editor of a workspace file (issue #30): the same CodeMirror as the | 3 | // The editor of a workspace file (issue #30): the same CodeMirror as the |
| 4 | - // Settings panel, with the language of the file and ⌘S to save. | 4 | + // Settings panel, with ⌘S to save, coloured according to the language of |
| 5 | + // the file (issue #71), loaded once the text is shown. | ||
| 5 | import { onMount } from 'svelte' | 6 | import { onMount } from 'svelte' |
| 6 | import { EditorView, basicSetup } from 'codemirror' | 7 | import { EditorView, basicSetup } from 'codemirror' |
| 7 | import { keymap } from '@codemirror/view' | 8 | import { keymap } from '@codemirror/view' |
| 8 | - import { EditorState } from '@codemirror/state' | 9 | + import { Compartment, EditorState } from '@codemirror/state' |
| 9 | - import { yaml } from '@codemirror/lang-yaml' | ||
| 10 | - import { markdown } from '@codemirror/lang-markdown' | ||
| 11 | - import { json } from '@codemirror/lang-json' | ||
| 12 | import { oneDark } from '@codemirror/theme-one-dark' | 10 | import { oneDark } from '@codemirror/theme-one-dark' |
| 13 | - import type { languageFor } from '../files' | 11 | + import type { EditorLanguage } from '../files' |
| 12 | + import { languageSupport, maxHighlightedSize } from '../editorLanguages' | ||
| 13 | + import { isDark } from '../theme' | ||
| 14 | 14 | ||
| 15 | let { | 15 | let { |
| 16 | content, | 16 | content, |
| @@ -20,7 +20,7 @@ | |||
| 20 | readOnly = false, | 20 | readOnly = false, |
| 21 | }: { | 21 | }: { |
| 22 | content: string | 22 | content: string |
| 23 | - language: ReturnType<typeof languageFor> | 23 | + language: EditorLanguage |
| 24 | /** A protected file (issue #54): shown, never changed. */ | 24 | /** A protected file (issue #54): shown, never changed. */ |
| 25 | readOnly?: boolean | 25 | readOnly?: boolean |
| 26 | onChange: (text: string) => void | 26 | onChange: (text: string) => void |
| @@ -29,8 +29,8 @@ | |||
| 29 | 29 | ||
| 30 | let host: HTMLElement | 30 | let host: HTMLElement |
| 31 | let view: EditorView | undefined | 31 | let view: EditorView | undefined |
| 32 | - const dark = window.matchMedia('(prefers-color-scheme: dark)').matches | 32 | + const dark = isDark(document.documentElement, window.matchMedia('(prefers-color-scheme: dark)').matches) |
| 33 | - const languages = { yaml: [yaml()], markdown: [markdown()], json: [json()], text: [] } | 33 | + const highlighting = new Compartment() |
| 34 | 34 | ||
| 35 | onMount(() => { | 35 | onMount(() => { |
| 36 | view = new EditorView({ | 36 | view = new EditorView({ |
| @@ -38,7 +38,7 @@ | |||
| 38 | parent: host, | 38 | parent: host, |
| 39 | extensions: [ | 39 | extensions: [ |
| 40 | basicSetup, | 40 | basicSetup, |
| 41 | - ...languages[language], | 41 | + highlighting.of([]), |
| 42 | EditorView.lineWrapping, | 42 | EditorView.lineWrapping, |
| 43 | EditorState.readOnly.of(readOnly), | 43 | EditorState.readOnly.of(readOnly), |
| 44 | EditorView.editable.of(!readOnly), | 44 | EditorView.editable.of(!readOnly), |
| @@ -49,7 +49,16 @@ | |||
| 49 | ...(dark ? [oneDark] : []), | 49 | ...(dark ? [oneDark] : []), |
| 50 | ], | 50 | ], |
| 51 | }) | 51 | }) |
| 52 | - return () => view?.destroy() | 52 | + // A large file stays plain text; an unknown language too. |
| 53 | + if (content.length <= maxHighlightedSize) { | ||
| 54 | + languageSupport(language) | ||
| 55 | + .then((support) => view?.dispatch({ effects: highlighting.reconfigure(support) })) | ||
| 56 | + .catch(() => {}) // plain text is fine | ||
| 57 | + } | ||
| 58 | + return () => { | ||
| 59 | + view?.destroy() | ||
| 60 | + view = undefined | ||
| 61 | + } | ||
| 53 | }) | 62 | }) |
| 54 | 63 | ||
| 55 | /** Replaces the whole text, e.g. with the agent's version of the file. */ | 64 | /** Replaces the whole text, e.g. with the agent's version of the file. */ |
added
frontend/src/lib/editorLanguages.test.ts +27 -0 | new file mode 100644 | ||
| @@ -0,0 +1,27 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +import { describe, expect, it } from 'vitest' | |
| 4 | +import { EditorState } from '@codemirror/state' | |
| 5 | +import { languageSupport } from './editorLanguages' | |
| 6 | +import type { EditorLanguage } from './files' | |
| 7 | + | |
| 8 | +const languages: EditorLanguage[] = [ | |
| 9 | + 'yaml', 'markdown', 'json', 'javascript', 'typescript', 'jsx', 'tsx', 'python', 'go', 'rust', 'css', | |
| 10 | + 'html', 'xml', 'java', 'cpp', 'php', 'sql', 'shell', 'toml', 'dockerfile', 'ruby', 'swift', 'kotlin', | |
| 11 | + 'csharp', 'lua', 'properties', 'diff', 'powershell', | |
| 12 | +] | |
| 13 | + | |
| 14 | +describe('languageSupport (issue #71)', () => { | |
| 15 | + it('loads every language the editor colours', async () => { | |
| 16 | + for (const language of languages) { | |
| 17 | + const support = await languageSupport(language) | |
| 18 | + // A real language gives the editor a language facet. | |
| 19 | + const state = EditorState.create({ doc: 'x', extensions: [support] }) | |
| 20 | + expect(state.facet(EditorState.languageData).length, language).toBeGreaterThan(0) | |
| 21 | + } | |
| 22 | + }) | |
| 23 | + | |
| 24 | + it('gives nothing for plain text', async () => { | |
| 25 | + expect(await languageSupport('text')).toEqual([]) | |
| 26 | + }) | |
| 27 | +}) | |
| new file mode 100644 | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +import { describe, expect, it } from 'vitest' | ||
| 4 | +import { EditorState } from '@codemirror/state' | ||
| 5 | +import { languageSupport } from './editorLanguages' | ||
| 6 | +import type { EditorLanguage } from './files' | ||
| 7 | + | ||
| 8 | +const languages: EditorLanguage[] = [ | ||
| 9 | + 'yaml', 'markdown', 'json', 'javascript', 'typescript', 'jsx', 'tsx', 'python', 'go', 'rust', 'css', | ||
| 10 | + 'html', 'xml', 'java', 'cpp', 'php', 'sql', 'shell', 'toml', 'dockerfile', 'ruby', 'swift', 'kotlin', | ||
| 11 | + 'csharp', 'lua', 'properties', 'diff', 'powershell', | ||
| 12 | +] | ||
| 13 | + | ||
| 14 | +describe('languageSupport (issue #71)', () => { | ||
| 15 | + it('loads every language the editor colours', async () => { | ||
| 16 | + for (const language of languages) { | ||
| 17 | + const support = await languageSupport(language) | ||
| 18 | + // A real language gives the editor a language facet. | ||
| 19 | + const state = EditorState.create({ doc: 'x', extensions: [support] }) | ||
| 20 | + expect(state.facet(EditorState.languageData).length, language).toBeGreaterThan(0) | ||
| 21 | + } | ||
| 22 | + }) | ||
| 23 | + | ||
| 24 | + it('gives nothing for plain text', async () => { | ||
| 25 | + expect(await languageSupport('text')).toEqual([]) | ||
| 26 | + }) | ||
| 27 | +}) | ||
added
frontend/src/lib/editorLanguages.ts +62 -0 | new file mode 100644 | ||
| @@ -0,0 +1,62 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +// The CodeMirror support of each editor language (issue #71), loaded the | |
| 4 | +// first time a file of that language is opened: the start of the | |
| 5 | +// application never pays for languages nobody opens. | |
| 6 | + | |
| 7 | +import type { Extension } from '@codemirror/state' | |
| 8 | +import type { StreamParser } from '@codemirror/language' | |
| 9 | +import type { EditorLanguage } from './files' | |
| 10 | + | |
| 11 | +// A language of @codemirror/legacy-modes, wrapped for CodeMirror 6. | |
| 12 | +async function legacy(parser: Promise<StreamParser<unknown>>): Promise<Extension> { | |
| 13 | + const [{ StreamLanguage }, mode] = await Promise.all([import('@codemirror/language'), parser]) | |
| 14 | + return StreamLanguage.define(mode) | |
| 15 | +} | |
| 16 | + | |
| 17 | +const loaders: Record<Exclude<EditorLanguage, 'text'>, () => Promise<Extension>> = { | |
| 18 | + yaml: async () => (await import('@codemirror/lang-yaml')).yaml(), | |
| 19 | + markdown: async () => (await import('@codemirror/lang-markdown')).markdown(), | |
| 20 | + json: async () => (await import('@codemirror/lang-json')).json(), | |
| 21 | + javascript: async () => (await import('@codemirror/lang-javascript')).javascript(), | |
| 22 | + typescript: async () => (await import('@codemirror/lang-javascript')).javascript({ typescript: true }), | |
| 23 | + jsx: async () => (await import('@codemirror/lang-javascript')).javascript({ jsx: true }), | |
| 24 | + tsx: async () => (await import('@codemirror/lang-javascript')).javascript({ jsx: true, typescript: true }), | |
| 25 | + python: async () => (await import('@codemirror/lang-python')).python(), | |
| 26 | + go: async () => (await import('@codemirror/lang-go')).go(), | |
| 27 | + rust: async () => (await import('@codemirror/lang-rust')).rust(), | |
| 28 | + css: async () => (await import('@codemirror/lang-css')).css(), | |
| 29 | + html: async () => (await import('@codemirror/lang-html')).html(), | |
| 30 | + xml: async () => (await import('@codemirror/lang-xml')).xml(), | |
| 31 | + java: async () => (await import('@codemirror/lang-java')).java(), | |
| 32 | + cpp: async () => (await import('@codemirror/lang-cpp')).cpp(), | |
| 33 | + php: async () => (await import('@codemirror/lang-php')).php(), | |
| 34 | + sql: async () => (await import('@codemirror/lang-sql')).sql(), | |
| 35 | + shell: () => legacy(import('@codemirror/legacy-modes/mode/shell').then((m) => m.shell)), | |
| 36 | + toml: () => legacy(import('@codemirror/legacy-modes/mode/toml').then((m) => m.toml)), | |
| 37 | + dockerfile: () => legacy(import('@codemirror/legacy-modes/mode/dockerfile').then((m) => m.dockerFile)), | |
| 38 | + ruby: () => legacy(import('@codemirror/legacy-modes/mode/ruby').then((m) => m.ruby)), | |
| 39 | + swift: () => legacy(import('@codemirror/legacy-modes/mode/swift').then((m) => m.swift)), | |
| 40 | + kotlin: () => legacy(import('@codemirror/legacy-modes/mode/clike').then((m) => m.kotlin)), | |
| 41 | + csharp: () => legacy(import('@codemirror/legacy-modes/mode/clike').then((m) => m.csharp)), | |
| 42 | + lua: () => legacy(import('@codemirror/legacy-modes/mode/lua').then((m) => m.lua)), | |
| 43 | + properties: () => legacy(import('@codemirror/legacy-modes/mode/properties').then((m) => m.properties)), | |
| 44 | + diff: () => legacy(import('@codemirror/legacy-modes/mode/diff').then((m) => m.diff)), | |
| 45 | + powershell: () => legacy(import('@codemirror/legacy-modes/mode/powershell').then((m) => m.powerShell)), | |
| 46 | +} | |
| 47 | + | |
| 48 | +/** | |
| 49 | + * Above this size, a file is shown as plain text: colouring it would slow | |
| 50 | + * the editor down. | |
| 51 | + */ | |
| 52 | +export const maxHighlightedSize = 512 * 1024 | |
| 53 | + | |
| 54 | +/** | |
| 55 | + * The editor extension of a language, [] for plain text. | |
| 56 | + * | |
| 57 | + * @example | |
| 58 | + * compartment.reconfigure(await languageSupport('go')) | |
| 59 | + */ | |
| 60 | +export async function languageSupport(language: EditorLanguage): Promise<Extension> { | |
| 61 | + return language === 'text' ? [] : loaders[language]() | |
| 62 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +// The CodeMirror support of each editor language (issue #71), loaded the | ||
| 4 | +// first time a file of that language is opened: the start of the | ||
| 5 | +// application never pays for languages nobody opens. | ||
| 6 | + | ||
| 7 | +import type { Extension } from '@codemirror/state' | ||
| 8 | +import type { StreamParser } from '@codemirror/language' | ||
| 9 | +import type { EditorLanguage } from './files' | ||
| 10 | + | ||
| 11 | +// A language of @codemirror/legacy-modes, wrapped for CodeMirror 6. | ||
| 12 | +async function legacy(parser: Promise<StreamParser<unknown>>): Promise<Extension> { | ||
| 13 | + const [{ StreamLanguage }, mode] = await Promise.all([import('@codemirror/language'), parser]) | ||
| 14 | + return StreamLanguage.define(mode) | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +const loaders: Record<Exclude<EditorLanguage, 'text'>, () => Promise<Extension>> = { | ||
| 18 | + yaml: async () => (await import('@codemirror/lang-yaml')).yaml(), | ||
| 19 | + markdown: async () => (await import('@codemirror/lang-markdown')).markdown(), | ||
| 20 | + json: async () => (await import('@codemirror/lang-json')).json(), | ||
| 21 | + javascript: async () => (await import('@codemirror/lang-javascript')).javascript(), | ||
| 22 | + typescript: async () => (await import('@codemirror/lang-javascript')).javascript({ typescript: true }), | ||
| 23 | + jsx: async () => (await import('@codemirror/lang-javascript')).javascript({ jsx: true }), | ||
| 24 | + tsx: async () => (await import('@codemirror/lang-javascript')).javascript({ jsx: true, typescript: true }), | ||
| 25 | + python: async () => (await import('@codemirror/lang-python')).python(), | ||
| 26 | + go: async () => (await import('@codemirror/lang-go')).go(), | ||
| 27 | + rust: async () => (await import('@codemirror/lang-rust')).rust(), | ||
| 28 | + css: async () => (await import('@codemirror/lang-css')).css(), | ||
| 29 | + html: async () => (await import('@codemirror/lang-html')).html(), | ||
| 30 | + xml: async () => (await import('@codemirror/lang-xml')).xml(), | ||
| 31 | + java: async () => (await import('@codemirror/lang-java')).java(), | ||
| 32 | + cpp: async () => (await import('@codemirror/lang-cpp')).cpp(), | ||
| 33 | + php: async () => (await import('@codemirror/lang-php')).php(), | ||
| 34 | + sql: async () => (await import('@codemirror/lang-sql')).sql(), | ||
| 35 | + shell: () => legacy(import('@codemirror/legacy-modes/mode/shell').then((m) => m.shell)), | ||
| 36 | + toml: () => legacy(import('@codemirror/legacy-modes/mode/toml').then((m) => m.toml)), | ||
| 37 | + dockerfile: () => legacy(import('@codemirror/legacy-modes/mode/dockerfile').then((m) => m.dockerFile)), | ||
| 38 | + ruby: () => legacy(import('@codemirror/legacy-modes/mode/ruby').then((m) => m.ruby)), | ||
| 39 | + swift: () => legacy(import('@codemirror/legacy-modes/mode/swift').then((m) => m.swift)), | ||
| 40 | + kotlin: () => legacy(import('@codemirror/legacy-modes/mode/clike').then((m) => m.kotlin)), | ||
| 41 | + csharp: () => legacy(import('@codemirror/legacy-modes/mode/clike').then((m) => m.csharp)), | ||
| 42 | + lua: () => legacy(import('@codemirror/legacy-modes/mode/lua').then((m) => m.lua)), | ||
| 43 | + properties: () => legacy(import('@codemirror/legacy-modes/mode/properties').then((m) => m.properties)), | ||
| 44 | + diff: () => legacy(import('@codemirror/legacy-modes/mode/diff').then((m) => m.diff)), | ||
| 45 | + powershell: () => legacy(import('@codemirror/legacy-modes/mode/powershell').then((m) => m.powerShell)), | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +/** | ||
| 49 | + * Above this size, a file is shown as plain text: colouring it would slow | ||
| 50 | + * the editor down. | ||
| 51 | + */ | ||
| 52 | +export const maxHighlightedSize = 512 * 1024 | ||
| 53 | + | ||
| 54 | +/** | ||
| 55 | + * The editor extension of a language, [] for plain text. | ||
| 56 | + * | ||
| 57 | + * @example | ||
| 58 | + * compartment.reconfigure(await languageSupport('go')) | ||
| 59 | + */ | ||
| 60 | +export async function languageSupport(language: EditorLanguage): Promise<Extension> { | ||
| 61 | + return language === 'text' ? [] : loaders[language]() | ||
| 62 | +} | ||
modified
frontend/src/lib/files.test.ts +19 -1 | @@ -21,7 +21,25 @@ describe('workspace files', () => { | ||
| 21 | 21 | expect(languageFor('agent.YML')).toBe('yaml') |
| 22 | 22 | expect(languageFor('SKILL.md')).toBe('markdown') |
| 23 | 23 | expect(languageFor('data.json')).toBe('json') |
| 24 | - expect(languageFor('.env')).toBe('text') | |
| 24 | + expect(languageFor('notes.txt')).toBe('text') | |
| 25 | + expect(languageFor('LICENSE')).toBe('text') | |
| 26 | + }) | |
| 27 | + | |
| 28 | + it('recognises source code by extension or by name (issue #71)', () => { | |
| 29 | + expect(languageFor('internal/app/app.go')).toBe('go') | |
| 30 | + expect(languageFor('src/main.ts')).toBe('typescript') | |
| 31 | + expect(languageFor('App.tsx')).toBe('tsx') | |
| 32 | + expect(languageFor('tool.py')).toBe('python') | |
| 33 | + expect(languageFor('lib.rs')).toBe('rust') | |
| 34 | + expect(languageFor('run.sh')).toBe('shell') | |
| 35 | + expect(languageFor('Cargo.toml')).toBe('toml') | |
| 36 | + expect(languageFor('View.svelte')).toBe('html') | |
| 37 | + expect(languageFor('Dockerfile')).toBe('dockerfile') | |
| 38 | + expect(languageFor('build/Dockerfile.dev')).toBe('dockerfile') | |
| 39 | + expect(languageFor('Makefile')).toBe('shell') | |
| 40 | + expect(languageFor('.env')).toBe('properties') | |
| 41 | + expect(languageFor('.env.local')).toBe('properties') | |
| 42 | + expect(languageFor('go.mod')).toBe('go') | |
| 25 | 43 | }) |
| 26 | 44 | |
| 27 | 45 | it('checks new file names', () => { |
| @@ -21,7 +21,25 @@ describe('workspace files', () => { | |||
| 21 | expect(languageFor('agent.YML')).toBe('yaml') | 21 | expect(languageFor('agent.YML')).toBe('yaml') |
| 22 | expect(languageFor('SKILL.md')).toBe('markdown') | 22 | expect(languageFor('SKILL.md')).toBe('markdown') |
| 23 | expect(languageFor('data.json')).toBe('json') | 23 | expect(languageFor('data.json')).toBe('json') |
| 24 | - expect(languageFor('.env')).toBe('text') | 24 | + expect(languageFor('notes.txt')).toBe('text') |
| 25 | + expect(languageFor('LICENSE')).toBe('text') | ||
| 26 | + }) | ||
| 27 | + | ||
| 28 | + it('recognises source code by extension or by name (issue #71)', () => { | ||
| 29 | + expect(languageFor('internal/app/app.go')).toBe('go') | ||
| 30 | + expect(languageFor('src/main.ts')).toBe('typescript') | ||
| 31 | + expect(languageFor('App.tsx')).toBe('tsx') | ||
| 32 | + expect(languageFor('tool.py')).toBe('python') | ||
| 33 | + expect(languageFor('lib.rs')).toBe('rust') | ||
| 34 | + expect(languageFor('run.sh')).toBe('shell') | ||
| 35 | + expect(languageFor('Cargo.toml')).toBe('toml') | ||
| 36 | + expect(languageFor('View.svelte')).toBe('html') | ||
| 37 | + expect(languageFor('Dockerfile')).toBe('dockerfile') | ||
| 38 | + expect(languageFor('build/Dockerfile.dev')).toBe('dockerfile') | ||
| 39 | + expect(languageFor('Makefile')).toBe('shell') | ||
| 40 | + expect(languageFor('.env')).toBe('properties') | ||
| 41 | + expect(languageFor('.env.local')).toBe('properties') | ||
| 42 | + expect(languageFor('go.mod')).toBe('go') | ||
| 25 | }) | 43 | }) |
| 26 | 44 | ||
| 27 | it('checks new file names', () => { | 45 | it('checks new file names', () => { |
modified
frontend/src/lib/files.ts +45 -8 | @@ -20,7 +20,8 @@ export function isHidden(name: string): boolean { | ||
| 20 | 20 | const icons: Record<string, string> = { |
| 21 | 21 | md: '📝', txt: '📝', |
| 22 | 22 | yaml: '⚙️', yml: '⚙️', toml: '⚙️', json: '⚙️', |
| 23 | - go: '📜', py: '📜', js: '📜', ts: '📜', sh: '📜', rs: '📜', | |
| 23 | + go: '📜', py: '📜', js: '📜', ts: '📜', sh: '📜', rs: '📜', tsx: '📜', jsx: '📜', java: '📜', | |
| 24 | + c: '📜', cpp: '📜', h: '📜', rb: '📜', php: '📜', swift: '📜', kt: '📜', cs: '📜', lua: '📜', sql: '📜', | |
| 24 | 25 | png: '🖼️', jpg: '🖼️', jpeg: '🖼️', gif: '🖼️', svg: '🖼️', |
| 25 | 26 | } |
| 26 | 27 | |
| @@ -30,13 +31,49 @@ export function iconFor(name: string, dir: boolean, open = false): string { | ||
| 30 | 31 | return icons[extensionOf(name)] ?? '📄' |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | -/** The editor language of a file, from its extension. */ | |
| 34 | -export function languageFor(name: string): 'yaml' | 'markdown' | 'json' | 'text' { | |
| 35 | - const extension = extensionOf(name) | |
| 36 | - if (extension === 'yaml' || extension === 'yml') return 'yaml' | |
| 37 | - if (extension === 'md' || extension === 'markdown') return 'markdown' | |
| 38 | - if (extension === 'json') return 'json' | |
| 39 | - return 'text' | |
| 34 | +/** The languages the editor colours (issue #71); "text" is plain text. */ | |
| 35 | +export type EditorLanguage = | |
| 36 | + | 'yaml' | 'markdown' | 'json' | 'javascript' | 'typescript' | 'jsx' | 'tsx' | 'python' | 'go' | |
| 37 | + | 'rust' | 'css' | 'html' | 'xml' | 'java' | 'cpp' | 'php' | 'sql' | 'shell' | 'toml' | |
| 38 | + | 'dockerfile' | 'ruby' | 'swift' | 'kotlin' | 'csharp' | 'lua' | 'properties' | 'diff' | |
| 39 | + | 'powershell' | 'text' | |
| 40 | + | |
| 41 | +const languagesByExtension: Record<string, EditorLanguage> = { | |
| 42 | + yaml: 'yaml', yml: 'yaml', md: 'markdown', markdown: 'markdown', json: 'json', jsonc: 'json', | |
| 43 | + js: 'javascript', mjs: 'javascript', cjs: 'javascript', ts: 'typescript', mts: 'typescript', cts: 'typescript', | |
| 44 | + jsx: 'jsx', tsx: 'tsx', py: 'python', pyw: 'python', go: 'go', rs: 'rust', | |
| 45 | + css: 'css', scss: 'css', less: 'css', html: 'html', htm: 'html', svelte: 'html', vue: 'html', | |
| 46 | + xml: 'xml', svg: 'xml', plist: 'xml', drawio: 'xml', | |
| 47 | + java: 'java', c: 'cpp', h: 'cpp', cc: 'cpp', cpp: 'cpp', cxx: 'cpp', hpp: 'cpp', hh: 'cpp', | |
| 48 | + php: 'php', sql: 'sql', sh: 'shell', bash: 'shell', zsh: 'shell', ksh: 'shell', fish: 'shell', | |
| 49 | + toml: 'toml', rb: 'ruby', swift: 'swift', kt: 'kotlin', kts: 'kotlin', cs: 'csharp', lua: 'lua', | |
| 50 | + properties: 'properties', ini: 'properties', cfg: 'properties', conf: 'properties', env: 'properties', | |
| 51 | + diff: 'diff', patch: 'diff', ps1: 'powershell', psm1: 'powershell', | |
| 52 | +} | |
| 53 | + | |
| 54 | +// Files known by their name, with no telling extension. | |
| 55 | +const languagesByName: Record<string, EditorLanguage> = { | |
| 56 | + dockerfile: 'dockerfile', containerfile: 'dockerfile', makefile: 'shell', gnumakefile: 'shell', | |
| 57 | + '.bashrc': 'shell', '.zshrc': 'shell', '.profile': 'shell', '.bash_profile': 'shell', | |
| 58 | + '.env': 'properties', '.gitignore': 'properties', '.dockerignore': 'properties', '.editorconfig': 'properties', | |
| 59 | + gemfile: 'ruby', rakefile: 'ruby', 'go.mod': 'go', 'cargo.lock': 'toml', | |
| 60 | +} | |
| 61 | + | |
| 62 | +/** | |
| 63 | + * The editor language of a file, from its name or its extension; "text" | |
| 64 | + * when it is unknown. | |
| 65 | + * | |
| 66 | + * @example | |
| 67 | + * languageFor('main.go') // 'go' | |
| 68 | + * languageFor('Dockerfile') // 'dockerfile' | |
| 69 | + * languageFor('notes.txt') // 'text' | |
| 70 | + */ | |
| 71 | +export function languageFor(path: string): EditorLanguage { | |
| 72 | + const name = (path.split('/').pop() ?? '').toLowerCase() | |
| 73 | + if (languagesByName[name]) return languagesByName[name] | |
| 74 | + if (name.startsWith('dockerfile.') || name.endsWith('.dockerfile')) return 'dockerfile' | |
| 75 | + if (name.startsWith('.env.')) return 'properties' | |
| 76 | + return languagesByExtension[extensionOf(name)] ?? 'text' | |
| 40 | 77 | } |
| 41 | 78 | |
| 42 | 79 | function extensionOf(name: string): string { |
| @@ -20,7 +20,8 @@ export function isHidden(name: string): boolean { | |||
| 20 | const icons: Record<string, string> = { | 20 | const icons: Record<string, string> = { |
| 21 | md: '📝', txt: '📝', | 21 | md: '📝', txt: '📝', |
| 22 | yaml: '⚙️', yml: '⚙️', toml: '⚙️', json: '⚙️', | 22 | yaml: '⚙️', yml: '⚙️', toml: '⚙️', json: '⚙️', |
| 23 | - go: '📜', py: '📜', js: '📜', ts: '📜', sh: '📜', rs: '📜', | 23 | + go: '📜', py: '📜', js: '📜', ts: '📜', sh: '📜', rs: '📜', tsx: '📜', jsx: '📜', java: '📜', |
| 24 | + c: '📜', cpp: '📜', h: '📜', rb: '📜', php: '📜', swift: '📜', kt: '📜', cs: '📜', lua: '📜', sql: '📜', | ||
| 24 | png: '🖼️', jpg: '🖼️', jpeg: '🖼️', gif: '🖼️', svg: '🖼️', | 25 | png: '🖼️', jpg: '🖼️', jpeg: '🖼️', gif: '🖼️', svg: '🖼️', |
| 25 | } | 26 | } |
| 26 | 27 | ||
| @@ -30,13 +31,49 @@ export function iconFor(name: string, dir: boolean, open = false): string { | |||
| 30 | return icons[extensionOf(name)] ?? '📄' | 31 | return icons[extensionOf(name)] ?? '📄' |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | -/** The editor language of a file, from its extension. */ | 34 | +/** The languages the editor colours (issue #71); "text" is plain text. */ |
| 34 | -export function languageFor(name: string): 'yaml' | 'markdown' | 'json' | 'text' { | 35 | +export type EditorLanguage = |
| 35 | - const extension = extensionOf(name) | 36 | + | 'yaml' | 'markdown' | 'json' | 'javascript' | 'typescript' | 'jsx' | 'tsx' | 'python' | 'go' |
| 36 | - if (extension === 'yaml' || extension === 'yml') return 'yaml' | 37 | + | 'rust' | 'css' | 'html' | 'xml' | 'java' | 'cpp' | 'php' | 'sql' | 'shell' | 'toml' |
| 37 | - if (extension === 'md' || extension === 'markdown') return 'markdown' | 38 | + | 'dockerfile' | 'ruby' | 'swift' | 'kotlin' | 'csharp' | 'lua' | 'properties' | 'diff' |
| 38 | - if (extension === 'json') return 'json' | 39 | + | 'powershell' | 'text' |
| 39 | - return 'text' | 40 | + |
| 41 | +const languagesByExtension: Record<string, EditorLanguage> = { | ||
| 42 | + yaml: 'yaml', yml: 'yaml', md: 'markdown', markdown: 'markdown', json: 'json', jsonc: 'json', | ||
| 43 | + js: 'javascript', mjs: 'javascript', cjs: 'javascript', ts: 'typescript', mts: 'typescript', cts: 'typescript', | ||
| 44 | + jsx: 'jsx', tsx: 'tsx', py: 'python', pyw: 'python', go: 'go', rs: 'rust', | ||
| 45 | + css: 'css', scss: 'css', less: 'css', html: 'html', htm: 'html', svelte: 'html', vue: 'html', | ||
| 46 | + xml: 'xml', svg: 'xml', plist: 'xml', drawio: 'xml', | ||
| 47 | + java: 'java', c: 'cpp', h: 'cpp', cc: 'cpp', cpp: 'cpp', cxx: 'cpp', hpp: 'cpp', hh: 'cpp', | ||
| 48 | + php: 'php', sql: 'sql', sh: 'shell', bash: 'shell', zsh: 'shell', ksh: 'shell', fish: 'shell', | ||
| 49 | + toml: 'toml', rb: 'ruby', swift: 'swift', kt: 'kotlin', kts: 'kotlin', cs: 'csharp', lua: 'lua', | ||
| 50 | + properties: 'properties', ini: 'properties', cfg: 'properties', conf: 'properties', env: 'properties', | ||
| 51 | + diff: 'diff', patch: 'diff', ps1: 'powershell', psm1: 'powershell', | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +// Files known by their name, with no telling extension. | ||
| 55 | +const languagesByName: Record<string, EditorLanguage> = { | ||
| 56 | + dockerfile: 'dockerfile', containerfile: 'dockerfile', makefile: 'shell', gnumakefile: 'shell', | ||
| 57 | + '.bashrc': 'shell', '.zshrc': 'shell', '.profile': 'shell', '.bash_profile': 'shell', | ||
| 58 | + '.env': 'properties', '.gitignore': 'properties', '.dockerignore': 'properties', '.editorconfig': 'properties', | ||
| 59 | + gemfile: 'ruby', rakefile: 'ruby', 'go.mod': 'go', 'cargo.lock': 'toml', | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +/** | ||
| 63 | + * The editor language of a file, from its name or its extension; "text" | ||
| 64 | + * when it is unknown. | ||
| 65 | + * | ||
| 66 | + * @example | ||
| 67 | + * languageFor('main.go') // 'go' | ||
| 68 | + * languageFor('Dockerfile') // 'dockerfile' | ||
| 69 | + * languageFor('notes.txt') // 'text' | ||
| 70 | + */ | ||
| 71 | +export function languageFor(path: string): EditorLanguage { | ||
| 72 | + const name = (path.split('/').pop() ?? '').toLowerCase() | ||
| 73 | + if (languagesByName[name]) return languagesByName[name] | ||
| 74 | + if (name.startsWith('dockerfile.') || name.endsWith('.dockerfile')) return 'dockerfile' | ||
| 75 | + if (name.startsWith('.env.')) return 'properties' | ||
| 76 | + return languagesByExtension[extensionOf(name)] ?? 'text' | ||
| 40 | } | 77 | } |
| 41 | 78 | ||
| 42 | function extensionOf(name: string): string { | 79 | function extensionOf(name: string): string { |
modified
frontend/src/lib/panels/SettingsPanel.svelte +2 -1 | @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | 2 | <script lang="ts"> |
| 3 | + import { isDark } from '../theme' | |
| 3 | 4 | import ActionError from '../chat/ActionError.svelte' |
| 4 | 5 | import { hasMessage, t } from '../i18n/index.svelte' |
| 5 | 6 | import { onMount } from 'svelte' |
| @@ -24,7 +25,7 @@ | ||
| 24 | 25 | let schema = $state<ReturnType<typeof createSchemaIndex> | null>(null) |
| 25 | 26 | let editor: ConfigEditor | undefined = $state() |
| 26 | 27 | const dirty = $derived(edited !== saved) |
| 27 | - const dark = window.matchMedia('(prefers-color-scheme: dark)').matches | |
| 28 | + const dark = isDark(document.documentElement, window.matchMedia('(prefers-color-scheme: dark)').matches) | |
| 28 | 29 | |
| 29 | 30 | async function load() { |
| 30 | 31 | const content = await ConfigService.Content() |
| @@ -1,5 +1,6 @@ | |||
| 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | <script lang="ts"> | 2 | <script lang="ts"> |
| 3 | + import { isDark } from '../theme' | ||
| 3 | import ActionError from '../chat/ActionError.svelte' | 4 | import ActionError from '../chat/ActionError.svelte' |
| 4 | import { hasMessage, t } from '../i18n/index.svelte' | 5 | import { hasMessage, t } from '../i18n/index.svelte' |
| 5 | import { onMount } from 'svelte' | 6 | import { onMount } from 'svelte' |
| @@ -24,7 +25,7 @@ | |||
| 24 | let schema = $state<ReturnType<typeof createSchemaIndex> | null>(null) | 25 | let schema = $state<ReturnType<typeof createSchemaIndex> | null>(null) |
| 25 | let editor: ConfigEditor | undefined = $state() | 26 | let editor: ConfigEditor | undefined = $state() |
| 26 | const dirty = $derived(edited !== saved) | 27 | const dirty = $derived(edited !== saved) |
| 27 | - const dark = window.matchMedia('(prefers-color-scheme: dark)').matches | 28 | + const dark = isDark(document.documentElement, window.matchMedia('(prefers-color-scheme: dark)').matches) |
| 28 | 29 | ||
| 29 | async function load() { | 30 | async function load() { |
| 30 | const content = await ConfigService.Content() | 31 | const content = await ConfigService.Content() |
modified
frontend/src/lib/theme.test.ts +13 -1 | @@ -1,7 +1,7 @@ | ||
| 1 | 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE |
| 2 | 2 | |
| 3 | 3 | import { describe, expect, it } from 'vitest' |
| 4 | -import { applyTheme, isMac, markPlatform } from './theme' | |
| 4 | +import { applyTheme, isDark, isMac, markPlatform } from './theme' | |
| 5 | 5 | |
| 6 | 6 | function element() { |
| 7 | 7 | const classes = new Set<string>() |
| @@ -56,3 +56,15 @@ describe('isMac', () => { | ||
| 56 | 56 | expect(isMac(false, webkitGtk)).toBe(false) |
| 57 | 57 | }) |
| 58 | 58 | }) |
| 59 | + | |
| 60 | +describe('isDark', () => { | |
| 61 | + it('follows ui.theme, then the system', () => { | |
| 62 | + const root = element() | |
| 63 | + expect(isDark(root, true)).toBe(true) | |
| 64 | + expect(isDark(root, false)).toBe(false) | |
| 65 | + applyTheme(root, 'light') | |
| 66 | + expect(isDark(root, true)).toBe(false) | |
| 67 | + applyTheme(root, 'dark') | |
| 68 | + expect(isDark(root, false)).toBe(true) | |
| 69 | + }) | |
| 70 | +}) | |
| @@ -1,7 +1,7 @@ | |||
| 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE |
| 2 | 2 | ||
| 3 | import { describe, expect, it } from 'vitest' | 3 | import { describe, expect, it } from 'vitest' |
| 4 | -import { applyTheme, isMac, markPlatform } from './theme' | 4 | +import { applyTheme, isDark, isMac, markPlatform } from './theme' |
| 5 | 5 | ||
| 6 | function element() { | 6 | function element() { |
| 7 | const classes = new Set<string>() | 7 | const classes = new Set<string>() |
| @@ -56,3 +56,15 @@ describe('isMac', () => { | |||
| 56 | expect(isMac(false, webkitGtk)).toBe(false) | 56 | expect(isMac(false, webkitGtk)).toBe(false) |
| 57 | }) | 57 | }) |
| 58 | }) | 58 | }) |
| 59 | + | ||
| 60 | +describe('isDark', () => { | ||
| 61 | + it('follows ui.theme, then the system', () => { | ||
| 62 | + const root = element() | ||
| 63 | + expect(isDark(root, true)).toBe(true) | ||
| 64 | + expect(isDark(root, false)).toBe(false) | ||
| 65 | + applyTheme(root, 'light') | ||
| 66 | + expect(isDark(root, true)).toBe(false) | ||
| 67 | + applyTheme(root, 'dark') | ||
| 68 | + expect(isDark(root, false)).toBe(true) | ||
| 69 | + }) | ||
| 70 | +}) | ||
modified
frontend/src/lib/theme.ts +13 -0 | @@ -20,6 +20,19 @@ export function applyTheme(root: HTMLElement, theme: string) { | ||
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | +/** | |
| 24 | + * Whether the interface is dark: ui.theme forces it, otherwise the | |
| 25 | + * operating system decides. | |
| 26 | + * | |
| 27 | + * @example | |
| 28 | + * isDark(document.documentElement, window.matchMedia('(prefers-color-scheme: dark)').matches) | |
| 29 | + */ | |
| 30 | +export function isDark(root: HTMLElement, systemIsDark: boolean): boolean { | |
| 31 | + if (root.dataset.theme === 'dark') return true | |
| 32 | + if (root.dataset.theme === 'light') return false | |
| 33 | + return systemIsDark | |
| 34 | +} | |
| 35 | + | |
| 23 | 36 | /** |
| 24 | 37 | * Tells whether the interface runs on macOS. The Wails runtime fills its |
| 25 | 38 | * environment asynchronously, so System.IsMac() can still be false when the |
| @@ -20,6 +20,19 @@ export function applyTheme(root: HTMLElement, theme: string) { | |||
| 20 | } | 20 | } |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | +/** | ||
| 24 | + * Whether the interface is dark: ui.theme forces it, otherwise the | ||
| 25 | + * operating system decides. | ||
| 26 | + * | ||
| 27 | + * @example | ||
| 28 | + * isDark(document.documentElement, window.matchMedia('(prefers-color-scheme: dark)').matches) | ||
| 29 | + */ | ||
| 30 | +export function isDark(root: HTMLElement, systemIsDark: boolean): boolean { | ||
| 31 | + if (root.dataset.theme === 'dark') return true | ||
| 32 | + if (root.dataset.theme === 'light') return false | ||
| 33 | + return systemIsDark | ||
| 34 | +} | ||
| 35 | + | ||
| 23 | /** | 36 | /** |
| 24 | * Tells whether the interface runs on macOS. The Wails runtime fills its | 37 | * Tells whether the interface runs on macOS. The Wails runtime fills its |
| 25 | * environment asynchronously, so System.IsMac() can still be false when the | 38 | * environment asynchronously, so System.IsMac() can still be false when the |