From 6071d4f5460b6209ce3573e2773a80edbce70d31 Mon Sep 17 00:00:00 2001 From: Nixinova Date: Mon, 19 Jul 2021 18:12:24 +1200 Subject: [PATCH] Register embedded languages --- changelog.md | 1 + grammars/astro.tmLanguage.yaml | 20 ++++++++++++++++---- package.json | 7 ++++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 8d9a945..3a48fb8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # Changelog ## Next +- Added embedded language registration to allow full support for JavaScript and CSS inside Astro-HTML. - Changed grammar scope name from `source.astro` to `text.html.astro`. - Refactored syntax highlighter. diff --git a/grammars/astro.tmLanguage.yaml b/grammars/astro.tmLanguage.yaml index 1e571a7..76107ae 100644 --- a/grammars/astro.tmLanguage.yaml +++ b/grammars/astro.tmLanguage.yaml @@ -20,7 +20,7 @@ repository: patterns: - name: meta.block.html begin: '(?)\s*$\Z' + end: '.\Z' patterns: - include: '#astro' - include: 'text.html.basic' @@ -28,6 +28,7 @@ repository: astro: patterns: - include: '#inline-javascript' + - include: '#embedded' - include: '#components' repository: @@ -39,13 +40,26 @@ repository: patterns: - include: 'source.js' + embedded: + patterns: + - name: meta.block.embedded.js + begin: '' + patterns: + - include: 'source.js' + - name: meta.block.embedded.css + begin: '' + patterns: + - include: 'source.css' + components: patterns: - name: meta.component.astro begin: '' captures: - 0: { name: punctuation.definition.tag.component.astro } + '0': { name: punctuation.definition.tag.component.astro } patterns: - include: '#component-name' - include: '#attribute-name' @@ -62,7 +76,5 @@ repository: - name: string.quoted.attribute-value.astro begin: '(?<==)"' end: '(?