diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..46ae4e0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# testing
+/test
+
+# vimfiles
+*.swp
+*.un~
+*~
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1641fb2..ded7dfe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,13 @@ 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).
+## [1.1.1] - 2022-08-07
+
+### Fixed
+
+- Regions that were causing conflicts with JavaScript code blocks and expressions are renamed. Now those blocks are replaced by the exclusive code blocks for Astro.
+- Regular expressions are fixed to correctly detect Astro directives.
+
## [1.1.0] - 2022-08-06
### Added
@@ -21,4 +28,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Initial release
-
¡Con 💖 de Latinoamérica para el mundo!
+¡Con 💖 de LATAM para el mundo!
diff --git a/README.md b/README.md
index 87927b9..e5dc677 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ Provides syntax highlighting and indentation (beta) support for `.astro` files.
- TypeScript and TSX.
- CSS, SCSS, SASS, and LESS.
- Stylus (need external support).
-- Indentation (beta).
+- Indentation (experimental).
- Code folding.
- No dependencies.
diff --git a/assets/astro.png b/assets/astro.png
index a5599ab..8a50a4d 100644
Binary files a/assets/astro.png and b/assets/astro.png differ
diff --git a/ftdetect/astro.vim b/ftdetect/astro.vim
index 262ac37..577c2e5 100644
--- a/ftdetect/astro.vim
+++ b/ftdetect/astro.vim
@@ -1,7 +1,6 @@
" Vim ftdetect file.
" Language: Astro
" Author: Wuelner MartÃnez
-" Maintainer: Wuelner MartÃnez
" URL: https://github.com/wuelnerdotexe/vim-astro
" Last Change: 2022 Aug 05
" Based On: Evan Lecklider's vim-svelte
diff --git a/indent/astro.vim b/indent/astro.vim
index ab3bd7b..5bb0aa2 100644
--- a/indent/astro.vim
+++ b/indent/astro.vim
@@ -1,7 +1,6 @@
-" Vim indent file.
+" Vim indent file (experimental).
" Language: Astro
" Author: Wuelner MartÃnez
-" Maintainer: Wuelner MartÃnez
" URL: https://github.com/wuelnerdotexe/vim-astro
" Last Change: 2022 Aug 05
" Based On: Evan Lecklider's vim-svelte
@@ -55,7 +54,7 @@ function! GetAstroIndent()
return l:previous_line_indent + shiftwidth()
endif
- execute 'let g:indent = ' . s:html_indent
+ execute 'let l:indent = ' . s:html_indent
if searchpair('', 'bW') &&
\ l:previous_line =~ ';$' && l:current_line !~ '}'
@@ -67,7 +66,7 @@ function! GetAstroIndent()
\ ) + 1, 0) == hlID('htmlTag') && synID(l:current_line_number, match(
\ l:current_line, '\S'
\ ) + 1, 0) != hlID('htmlEndTag')
- let l:indents_match = g:indent == l:previous_line_indent
+ let l:indents_match = l:indent == l:previous_line_indent
let l:previous_closes = l:previous_line =~ '/>$'
if l:indents_match &&
@@ -78,7 +77,7 @@ function! GetAstroIndent()
endif
endif
- return g:indent
+ return l:indent
endfunction
let &cpoptions = s:cpoptions_save
diff --git a/syntax/astro.vim b/syntax/astro.vim
index f5c9ae2..88d127d 100644
--- a/syntax/astro.vim
+++ b/syntax/astro.vim
@@ -1,7 +1,6 @@
" Vim syntax file.
" Language: Astro
" Author: Wuelner MartÃnez
-" Maintainer: Wuelner MartÃnez
" URL: https://github.com/wuelnerdotexe/vim-astro
" Last Change: 2022 Aug 05
" Based On: Evan Lecklider's vim-svelte
@@ -28,11 +27,11 @@ set cpoptions&vim
" Embedded HTML syntax.
runtime! syntax/html.vim
-" htmlTagName: expand HTML tag names to include mixed case, periods, and colons.
-syntax match htmlTagName contained '\<[a-zA-Z:\.]*\>'
+" htmlTagName: expand HTML tag names to include mixed case, periods.
+syntax match htmlTagName contained "\<[a-zA-Z\.]*\>"
" astroDirectives: add Astro Directives to HTML arguments.
-syntax match astroDirectives contained '\<[a-z]\+:[a-z|]\+=' containedin=htmlTag
+syntax match astroDirectives contained '\<[a-z]\+:[a-z|]*\>' containedin=htmlTag
unlet b:current_syntax
@@ -49,7 +48,7 @@ if g:astro_typescript == 'enable'
" javaScript: add TypeScript support to HTML script tag.
syntax clear javaScript
- syntax region javaScript
+ syntax region javaScript
\ start=+]*>+me=s-1
@@ -59,13 +58,14 @@ else
syntax include @astroJavaScript syntax/javascript.vim
endif
-" javaScript: add TypeScript support to Astro code fence.
-syntax region javaScript
+" astrojavaScript: add TypeScript support to Astro code fence.
+syntax region astroJavaScript
\ start=+---+
\ keepend
\ end=+---+
\ contains=htmlTag,@astroJavaScript,@htmlPreproc,htmlCssStyleComment,htmlEndTag
\ matchgroup=astroFence
+ \ fold
unlet b:current_syntax
@@ -77,8 +77,8 @@ else
syntax include @astroJavaScriptReact syntax/javascriptreact.vim
endif
-" javaScriptExpression: add {JSX or TSX} support to Astro `{}` expresions.
-execute 'syntax region javaScriptExpression start=+{+ keepend end=+}+ ' .
+" astroJavaScriptExpression: add {JSX or TSX} support to Astro expresions.
+execute 'syntax region astroJavaScriptExpression start=+{+ keepend end=+}+ ' .
\ 'contains=@astroJavaScriptReact, @htmlPreproc containedin=' . join([
\ 'htmlArg', 'htmlBold', 'htmlBoldItalic', 'htmlBoldItalicUnderline',
\ 'htmlBoldUnderline', 'htmlBoldUnderlineItalic', 'htmlH1', 'htmlH2',
@@ -107,7 +107,7 @@ syntax include @astroScss syntax/scss.vim
syntax region scssStyle
\ start=/"me=s-1
+ \ end=++me=s-1
\ contains=@astroScss,astroSurroundingTag
\ fold
@@ -120,7 +120,7 @@ syntax include @astroSass syntax/sass.vim
syntax region sassStyle
\ start=/"me=s-1
+ \ end=++me=s-1
\ contains=@astroSass,astroSurroundingTag
\ fold
@@ -133,7 +133,7 @@ syntax include @astroLess syntax/less.vim
syntax region lessStyle
\ start=/"me=s-1
+ \ end=++me=s-1
\ contains=@astroLess,astroSurroundingTag
\ fold
@@ -150,24 +150,24 @@ if g:astro_stylus == 'enable'
syntax region stylusStyle
\ start=/"me=s-1
+ \ end=++me=s-1
\ contains=@astroStylus,astroSurroundingTag
\ fold
unlet b:current_syntax
-
- " astroSurroundingTag: add surround HTML tag to script and style.
- syntax region astroSurroundingTag
- \ start=+<\(script\|style\)+
- \ end=+>+
- \ contains=htmlTagError,htmlTagN,htmlArg,htmlValue,htmlEvent,htmlString
- \ contained
- \ fold
catch
- echomsg "you need install a external plugin for support stylus in astro files"
+ echomsg "you need install a external plugin for support stylus in .astro files"
endtry
endif
+" astroSurroundingTag: add surround HTML tag to script and style.
+syntax region astroSurroundingTag
+ \ start=+<\(script\|style\)+
+ \ end=+>+
+ \ contains=htmlTagError,htmlTagN,htmlArg,htmlValue,htmlEvent,htmlString
+ \ contained
+ \ fold
+
" Define the default highlighting.
" Only used when an item doesn't have highlighting yet.
highlight default link astroDirectives Special
@@ -178,6 +178,9 @@ if main_syntax == 'astro'
unlet main_syntax
endif
+" Sync from start because of the wacky nesting.
+syntax sync fromstart
+
let &cpoptions = s:cpoptions_save
unlet s:cpoptions_save
" vim: ts=8