fix(syntax): the astro fence is detected correctly

This commit is contained in:
Wuelner Martínez
2022-08-22 16:20:38 -06:00
parent 09de18d920
commit ef5126c84a
6 changed files with 32 additions and 17 deletions

View File

@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.1.2] - 2022-08-22
### Fixed
- The astro fence delimiter is detected and colored correctly.
## [1.1.1] - 2022-08-07 ## [1.1.1] - 2022-08-07
### Fixed ### Fixed

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

View File

@@ -1,12 +1,16 @@
" Vim ftdetect file. " Vim ftdetect file.
" Language: Astro " Language: Astro
" Author: Wuelner Martínez <wuelner.martinez@outlook.com> " Author: Wuelner Martínez <wuelner.martinez@outlook.com>
" Maintainer: Wuelner Martínez <wuelner.martinez@outlook.com>
" URL: https://github.com/wuelnerdotexe/vim-astro " URL: https://github.com/wuelnerdotexe/vim-astro
" Last Change: 2022 Aug 05 " Last Change: 2022 Aug 22
" Based On: Evan Lecklider's vim-svelte
" Changes: See https://github.com/evanleck/vim-svelte
" Credits: See vim-svelte on github
" Whether to set the Astro filetype on *.astro files. " Whether to set the Astro filetype on *.astro files.
autocmd BufNewFile,BufRead *.astro setfiletype astro function! s:DetectFiletypeAstro()
if (&filetype ==# '') || (&filetype !=# 'astro')
setfiletype astro
endif
endfunction
autocmd BufNewFile,BufRead *.astro call <SID>DetectFiletypeAstro()
" vim: ts=8

View File

@@ -1,8 +1,9 @@
" Vim indent file (experimental). " Vim indent file (experimental).
" Language: Astro " Language: Astro
" Author: Wuelner Martínez <wuelner.martinez@outlook.com> " Author: Wuelner Martínez <wuelner.martinez@outlook.com>
" Maintainer: Wuelner Martínez <wuelner.martinez@outlook.com>
" URL: https://github.com/wuelnerdotexe/vim-astro " URL: https://github.com/wuelnerdotexe/vim-astro
" Last Change: 2022 Aug 05 " Last Change: 2022 Aug 07
" Based On: Evan Lecklider's vim-svelte " Based On: Evan Lecklider's vim-svelte
" Changes: See https://github.com/evanleck/vim-svelte " Changes: See https://github.com/evanleck/vim-svelte
" Credits: See vim-svelte on github " Credits: See vim-svelte on github

View File

@@ -1,8 +1,9 @@
" Vim syntax file. " Vim syntax file.
" Language: Astro " Language: Astro
" Author: Wuelner Martínez <wuelner.martinez@outlook.com> " Author: Wuelner Martínez <wuelner.martinez@outlook.com>
" Maintainer: Wuelner Martínez <wuelner.martinez@outlook.com>
" URL: https://github.com/wuelnerdotexe/vim-astro " URL: https://github.com/wuelnerdotexe/vim-astro
" Last Change: 2022 Aug 05 " Last Change: 2022 Aug 22
" Based On: Evan Lecklider's vim-svelte " Based On: Evan Lecklider's vim-svelte
" Changes: See https://github.com/evanleck/vim-svelte " Changes: See https://github.com/evanleck/vim-svelte
" Credits: See vim-svelte on github " Credits: See vim-svelte on github
@@ -27,7 +28,7 @@ set cpoptions&vim
" Embedded HTML syntax. " Embedded HTML syntax.
runtime! syntax/html.vim runtime! syntax/html.vim
" htmlTagName: expand HTML tag names to include mixed case, periods. " htmlTagName: expand HTML tag names to include mixed case and periods.
syntax match htmlTagName contained "\<[a-zA-Z\.]*\>" syntax match htmlTagName contained "\<[a-zA-Z\.]*\>"
" astroDirectives: add Astro Directives to HTML arguments. " astroDirectives: add Astro Directives to HTML arguments.
@@ -58,13 +59,15 @@ else
syntax include @astroJavaScript syntax/javascript.vim syntax include @astroJavaScript syntax/javascript.vim
endif endif
" astroFence: detect the Astro fence.
syntax match astroFence contained +^---$+
" astrojavaScript: add TypeScript support to Astro code fence. " astrojavaScript: add TypeScript support to Astro code fence.
syntax region astroJavaScript syntax region astroJavaScript
\ start=+---+ \ start=+^---$+
\ keepend \ keepend
\ end=+---+ \ end=+^---$+
\ contains=htmlTag,@astroJavaScript,@htmlPreproc,htmlCssStyleComment,htmlEndTag \ contains=htmlTag,@astroJavaScript,@htmlPreproc,htmlCssStyleComment,htmlEndTag,astroFence
\ matchgroup=astroFence
\ fold \ fold
unlet b:current_syntax unlet b:current_syntax
@@ -144,6 +147,7 @@ unlet b:current_syntax
" this plugin to support it: https://github.com/wavded/vim-stylus " this plugin to support it: https://github.com/wavded/vim-stylus
if g:astro_stylus == 'enable' if g:astro_stylus == 'enable'
try try
" Embedded Stylus syntax.
syntax include @astroStylus syntax/stylus.vim syntax include @astroStylus syntax/stylus.vim
" stylusStyle: add Stylus style tags support in Astro. " stylusStyle: add Stylus style tags support in Astro.