mirror of
https://github.com/wuelnerdotexe/vim-astro.git
synced 2025-12-06 17:24:25 +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).
|
||||
|
||||
## [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
|
||||
|
||||
<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.
|
||||
- CSS, SCSS, SASS, and LESS.
|
||||
- Stylus (need external support).
|
||||
- Indentation (beta).
|
||||
- Indentation (experimental).
|
||||
- Code folding.
|
||||
- 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.
|
||||
" Language: Astro
|
||||
" Author: Wuelner Martínez <wuelner.martinez@outlook.com>
|
||||
" Maintainer: Wuelner Martínez <wuelner.martinez@outlook.com>
|
||||
" URL: https://github.com/wuelnerdotexe/vim-astro
|
||||
" Last Change: 2022 Aug 05
|
||||
" Based On: Evan Lecklider's vim-svelte
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
" Vim indent file.
|
||||
" Vim indent file (experimental).
|
||||
" Language: Astro
|
||||
" Author: Wuelner Martínez <wuelner.martinez@outlook.com>
|
||||
" Maintainer: Wuelner Martínez <wuelner.martinez@outlook.com>
|
||||
" 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('<style>', '', '</style>', '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
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
" Vim syntax file.
|
||||
" Language: Astro
|
||||
" Author: Wuelner Martínez <wuelner.martinez@outlook.com>
|
||||
" Maintainer: Wuelner Martínez <wuelner.martinez@outlook.com>
|
||||
" 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
|
||||
|
||||
@@ -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=/<style\>\_[^>]*\(lang\)=\("\|''\)[^\2]*scss[^\2]*\2\_[^>]*>/
|
||||
\ keepend
|
||||
\ end="</style>"me=s-1
|
||||
\ end=+</style>+me=s-1
|
||||
\ contains=@astroScss,astroSurroundingTag
|
||||
\ fold
|
||||
|
||||
@@ -120,7 +120,7 @@ syntax include @astroSass syntax/sass.vim
|
||||
syntax region sassStyle
|
||||
\ start=/<style\>\_[^>]*\(lang\)=\("\|''\)[^\2]*sass[^\2]*\2\_[^>]*>/
|
||||
\ keepend
|
||||
\ end="</style>"me=s-1
|
||||
\ end=+</style>+me=s-1
|
||||
\ contains=@astroSass,astroSurroundingTag
|
||||
\ fold
|
||||
|
||||
@@ -133,7 +133,7 @@ syntax include @astroLess syntax/less.vim
|
||||
syntax region lessStyle
|
||||
\ start=/<style\>\_[^>]*\(lang\)=\("\|''\)[^\2]*less[^\2]*\2\_[^>]*>/
|
||||
\ keepend
|
||||
\ end="</style>"me=s-1
|
||||
\ end=+</style>+me=s-1
|
||||
\ contains=@astroLess,astroSurroundingTag
|
||||
\ fold
|
||||
|
||||
@@ -150,24 +150,24 @@ if g:astro_stylus == 'enable'
|
||||
syntax region stylusStyle
|
||||
\ start=/<style\>\_[^>]*\(lang\)=\("\|''\)[^\2]*stylus[^\2]*\2\_[^>]*>/
|
||||
\ keepend
|
||||
\ end="</style>"me=s-1
|
||||
\ end=+</style>+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
|
||||
|
||||
Reference in New Issue
Block a user