mirror of
https://github.com/wuelnerdotexe/vim-astro.git
synced 2025-12-07 01:34:26 +08:00
fix(*): multiple fixes are made
This commit is contained in:
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/test
|
||||||
|
|
||||||
|
# vimfiles
|
||||||
|
*.swp
|
||||||
|
*.un~
|
||||||
|
*~
|
||||||
@@ -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).
|
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
|
## [1.1.0] - 2022-08-06
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@@ -21,4 +28,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
|
|
||||||
- Initial release
|
- Initial release
|
||||||
|
|
||||||
<p align="center">¡Con 💖 de <strong>Latinoamérica</strong> para el mundo!</p>
|
<p align="center">¡Con 💖 de <strong>LATAM</strong> para el mundo!</p>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Provides syntax highlighting and indentation (beta) support for `.astro` files.
|
|||||||
- TypeScript and TSX.
|
- TypeScript and TSX.
|
||||||
- CSS, SCSS, SASS, and LESS.
|
- CSS, SCSS, SASS, and LESS.
|
||||||
- Stylus (need external support).
|
- Stylus (need external support).
|
||||||
- Indentation (beta).
|
- Indentation (experimental).
|
||||||
- Code folding.
|
- Code folding.
|
||||||
- No dependencies.
|
- No dependencies.
|
||||||
|
|
||||||
|
|||||||
BIN
assets/astro.png
BIN
assets/astro.png
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 MiB After Width: | Height: | Size: 2.5 MiB |
@@ -1,7 +1,6 @@
|
|||||||
" 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 05
|
||||||
" Based On: Evan Lecklider's vim-svelte
|
" Based On: Evan Lecklider's vim-svelte
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
" Vim indent file.
|
" 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 05
|
||||||
" Based On: Evan Lecklider's vim-svelte
|
" Based On: Evan Lecklider's vim-svelte
|
||||||
@@ -55,7 +54,7 @@ function! GetAstroIndent()
|
|||||||
return l:previous_line_indent + shiftwidth()
|
return l:previous_line_indent + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
execute 'let g:indent = ' . s:html_indent
|
execute 'let l:indent = ' . s:html_indent
|
||||||
|
|
||||||
if searchpair('<style>', '', '</style>', 'bW') &&
|
if searchpair('<style>', '', '</style>', 'bW') &&
|
||||||
\ l:previous_line =~ ';$' && l:current_line !~ '}'
|
\ l:previous_line =~ ';$' && l:current_line !~ '}'
|
||||||
@@ -67,7 +66,7 @@ function! GetAstroIndent()
|
|||||||
\ ) + 1, 0) == hlID('htmlTag') && synID(l:current_line_number, match(
|
\ ) + 1, 0) == hlID('htmlTag') && synID(l:current_line_number, match(
|
||||||
\ l:current_line, '\S'
|
\ l:current_line, '\S'
|
||||||
\ ) + 1, 0) != hlID('htmlEndTag')
|
\ ) + 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 =~ '/>$'
|
let l:previous_closes = l:previous_line =~ '/>$'
|
||||||
|
|
||||||
if l:indents_match &&
|
if l:indents_match &&
|
||||||
@@ -78,7 +77,7 @@ function! GetAstroIndent()
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return g:indent
|
return l:indent
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let &cpoptions = s:cpoptions_save
|
let &cpoptions = s:cpoptions_save
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
" 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 05
|
||||||
" Based On: Evan Lecklider's vim-svelte
|
" Based On: Evan Lecklider's vim-svelte
|
||||||
@@ -28,11 +27,11 @@ 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, and colons.
|
" htmlTagName: expand HTML tag names to include mixed case, 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.
|
||||||
syntax match astroDirectives contained '\<[a-z]\+:[a-z|]\+=' containedin=htmlTag
|
syntax match astroDirectives contained '\<[a-z]\+:[a-z|]*\>' containedin=htmlTag
|
||||||
|
|
||||||
unlet b:current_syntax
|
unlet b:current_syntax
|
||||||
|
|
||||||
@@ -59,13 +58,14 @@ else
|
|||||||
syntax include @astroJavaScript syntax/javascript.vim
|
syntax include @astroJavaScript syntax/javascript.vim
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" javaScript: add TypeScript support to Astro code fence.
|
" astrojavaScript: add TypeScript support to Astro code fence.
|
||||||
syntax region javaScript
|
syntax region astroJavaScript
|
||||||
\ start=+---+
|
\ start=+---+
|
||||||
\ keepend
|
\ keepend
|
||||||
\ end=+---+
|
\ end=+---+
|
||||||
\ contains=htmlTag,@astroJavaScript,@htmlPreproc,htmlCssStyleComment,htmlEndTag
|
\ contains=htmlTag,@astroJavaScript,@htmlPreproc,htmlCssStyleComment,htmlEndTag
|
||||||
\ matchgroup=astroFence
|
\ matchgroup=astroFence
|
||||||
|
\ fold
|
||||||
|
|
||||||
unlet b:current_syntax
|
unlet b:current_syntax
|
||||||
|
|
||||||
@@ -77,8 +77,8 @@ else
|
|||||||
syntax include @astroJavaScriptReact syntax/javascriptreact.vim
|
syntax include @astroJavaScriptReact syntax/javascriptreact.vim
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" javaScriptExpression: add {JSX or TSX} support to Astro `{}` expresions.
|
" astroJavaScriptExpression: add {JSX or TSX} support to Astro expresions.
|
||||||
execute 'syntax region javaScriptExpression start=+{+ keepend end=+}+ ' .
|
execute 'syntax region astroJavaScriptExpression start=+{+ keepend end=+}+ ' .
|
||||||
\ 'contains=@astroJavaScriptReact, @htmlPreproc containedin=' . join([
|
\ 'contains=@astroJavaScriptReact, @htmlPreproc containedin=' . join([
|
||||||
\ 'htmlArg', 'htmlBold', 'htmlBoldItalic', 'htmlBoldItalicUnderline',
|
\ 'htmlArg', 'htmlBold', 'htmlBoldItalic', 'htmlBoldItalicUnderline',
|
||||||
\ 'htmlBoldUnderline', 'htmlBoldUnderlineItalic', 'htmlH1', 'htmlH2',
|
\ 'htmlBoldUnderline', 'htmlBoldUnderlineItalic', 'htmlH1', 'htmlH2',
|
||||||
@@ -107,7 +107,7 @@ syntax include @astroScss syntax/scss.vim
|
|||||||
syntax region scssStyle
|
syntax region scssStyle
|
||||||
\ start=/<style\>\_[^>]*\(lang\)=\("\|''\)[^\2]*scss[^\2]*\2\_[^>]*>/
|
\ start=/<style\>\_[^>]*\(lang\)=\("\|''\)[^\2]*scss[^\2]*\2\_[^>]*>/
|
||||||
\ keepend
|
\ keepend
|
||||||
\ end="</style>"me=s-1
|
\ end=+</style>+me=s-1
|
||||||
\ contains=@astroScss,astroSurroundingTag
|
\ contains=@astroScss,astroSurroundingTag
|
||||||
\ fold
|
\ fold
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ syntax include @astroSass syntax/sass.vim
|
|||||||
syntax region sassStyle
|
syntax region sassStyle
|
||||||
\ start=/<style\>\_[^>]*\(lang\)=\("\|''\)[^\2]*sass[^\2]*\2\_[^>]*>/
|
\ start=/<style\>\_[^>]*\(lang\)=\("\|''\)[^\2]*sass[^\2]*\2\_[^>]*>/
|
||||||
\ keepend
|
\ keepend
|
||||||
\ end="</style>"me=s-1
|
\ end=+</style>+me=s-1
|
||||||
\ contains=@astroSass,astroSurroundingTag
|
\ contains=@astroSass,astroSurroundingTag
|
||||||
\ fold
|
\ fold
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ syntax include @astroLess syntax/less.vim
|
|||||||
syntax region lessStyle
|
syntax region lessStyle
|
||||||
\ start=/<style\>\_[^>]*\(lang\)=\("\|''\)[^\2]*less[^\2]*\2\_[^>]*>/
|
\ start=/<style\>\_[^>]*\(lang\)=\("\|''\)[^\2]*less[^\2]*\2\_[^>]*>/
|
||||||
\ keepend
|
\ keepend
|
||||||
\ end="</style>"me=s-1
|
\ end=+</style>+me=s-1
|
||||||
\ contains=@astroLess,astroSurroundingTag
|
\ contains=@astroLess,astroSurroundingTag
|
||||||
\ fold
|
\ fold
|
||||||
|
|
||||||
@@ -150,24 +150,24 @@ if g:astro_stylus == 'enable'
|
|||||||
syntax region stylusStyle
|
syntax region stylusStyle
|
||||||
\ start=/<style\>\_[^>]*\(lang\)=\("\|''\)[^\2]*stylus[^\2]*\2\_[^>]*>/
|
\ start=/<style\>\_[^>]*\(lang\)=\("\|''\)[^\2]*stylus[^\2]*\2\_[^>]*>/
|
||||||
\ keepend
|
\ keepend
|
||||||
\ end="</style>"me=s-1
|
\ end=+</style>+me=s-1
|
||||||
\ contains=@astroStylus,astroSurroundingTag
|
\ contains=@astroStylus,astroSurroundingTag
|
||||||
\ fold
|
\ fold
|
||||||
|
|
||||||
unlet b:current_syntax
|
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
|
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
|
endtry
|
||||||
endif
|
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.
|
" Define the default highlighting.
|
||||||
" Only used when an item doesn't have highlighting yet.
|
" Only used when an item doesn't have highlighting yet.
|
||||||
highlight default link astroDirectives Special
|
highlight default link astroDirectives Special
|
||||||
@@ -178,6 +178,9 @@ if main_syntax == 'astro'
|
|||||||
unlet main_syntax
|
unlet main_syntax
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Sync from start because of the wacky nesting.
|
||||||
|
syntax sync fromstart
|
||||||
|
|
||||||
let &cpoptions = s:cpoptions_save
|
let &cpoptions = s:cpoptions_save
|
||||||
unlet s:cpoptions_save
|
unlet s:cpoptions_save
|
||||||
" vim: ts=8
|
" vim: ts=8
|
||||||
|
|||||||
Reference in New Issue
Block a user