diff options
-rw-r--r-- | autoload/elixir/indent.vim | 16 | ||||
-rw-r--r-- | autoload/polyglot.vim | 4 | ||||
-rw-r--r-- | ftdetect/polyglot.vim | 4 | ||||
-rw-r--r-- | polyglot.vim | 4 | ||||
-rw-r--r-- | syntax/basic/type.vim | 16 | ||||
-rw-r--r-- | syntax/common.vim | 1 | ||||
-rw-r--r-- | syntax/elixir.vim | 6 |
7 files changed, 36 insertions, 15 deletions
diff --git a/autoload/elixir/indent.vim b/autoload/elixir/indent.vim index e7c8f0ea..741ec094 100644 --- a/autoload/elixir/indent.vim +++ b/autoload/elixir/indent.vim @@ -276,12 +276,14 @@ function! elixir#indent#handle_inside_block(context) " hack - handle do: better let block_info = searchpairpos(start_pattern, '', end_pattern, 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip() || getline(line('.')) =~ 'do:'", max([0, a:context.lnum - g:elixir_indent_max_lookbehind])) let block_start_lnum = block_info[0] + call s:debug("block_start_lnum=" . block_start_lnum) let block_start_col = block_info[1] if block_start_lnum != 0 || block_start_col != 0 let block_text = getline(block_start_lnum) let block_start_char = block_text[block_start_col - 1] + call s:debug("block_start_char=" . block_start_char) - let never_match = '\(a\)\@=b' + let never_match = '' let config = { \'f': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match}, \'c': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match}, @@ -293,17 +295,25 @@ function! elixir#indent#handle_inside_block(context) \'(': {'aligned_clauses': ')', 'pattern_match_clauses': never_match} \} + " if `with` clause... if block_start_char == 'w' call s:debug("testing s:handle_with") return s:handle_with(block_start_lnum, block_start_col, a:context) else let block_config = config[block_start_char] + " if aligned clause (closing tag/`else` clause/etc...) then indent this + " at the same level as the block open tag (e.g. `if`/`case`/etc...) if s:starts_with(a:context, block_config.aligned_clauses) call s:debug("clause") return indent(block_start_lnum) else - let clause_lnum = searchpair(block_config.pattern_match_clauses, '', '*', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()", block_start_lnum) - let relative_lnum = max([clause_lnum, block_start_lnum]) + if block_config.pattern_match_clauses == never_match + let relative_lnum = block_start_lnum + else + let clause_lnum = searchpair(block_config.pattern_match_clauses, '', '*', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()", block_start_lnum) + call s:debug("clause_lum=" . clause_lnum) + let relative_lnum = max([clause_lnum, block_start_lnum]) + end call s:debug("pattern matching relative to lnum " . relative_lnum) return s:do_handle_pattern_match_block(relative_lnum, a:context) endif diff --git a/autoload/polyglot.vim b/autoload/polyglot.vim index 393c92bf..07d9fe31 100644 --- a/autoload/polyglot.vim +++ b/autoload/polyglot.vim @@ -596,7 +596,7 @@ if !has_key(s:disabled_packages, 'autoindent') if line[0] == "\t" setlocal noexpandtab - let &shiftwidth=&tabstop + let &l:shiftwidth=&tabstop let b:sleuth_culprit .= ':' . i return 1 elseif line[0] == " " @@ -609,7 +609,7 @@ if !has_key(s:disabled_packages, 'autoindent') if minindent < 10 setlocal expandtab - let &shiftwidth=minindent + let &l:shiftwidth=minindent let b:sleuth_culprit .= ':' . i return 1 endif diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 9c517e03..4b01a241 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -2132,7 +2132,7 @@ if !has_key(s:disabled_packages, 'autoindent') if line[0] == "\t" setlocal noexpandtab - let &shiftwidth=&tabstop + let &l:shiftwidth=&tabstop let b:sleuth_culprit .= ':' . i return 1 elseif line[0] == " " @@ -2145,7 +2145,7 @@ if !has_key(s:disabled_packages, 'autoindent') if minindent < 10 setlocal expandtab - let &shiftwidth=minindent + let &l:shiftwidth=minindent let b:sleuth_culprit .= ':' . i return 1 endif diff --git a/polyglot.vim b/polyglot.vim index b6198b80..e86e62ef 100644 --- a/polyglot.vim +++ b/polyglot.vim @@ -268,7 +268,7 @@ if !has_key(s:disabled_packages, 'autoindent') if line[0] == "\t" setlocal noexpandtab - let &shiftwidth=&tabstop + let &l:shiftwidth=&tabstop let b:sleuth_culprit .= ':' . i return 1 elseif line[0] == " " @@ -281,7 +281,7 @@ if !has_key(s:disabled_packages, 'autoindent') if minindent < 10 setlocal expandtab - let &shiftwidth=minindent + let &l:shiftwidth=minindent let b:sleuth_culprit .= ':' . i return 1 endif diff --git a/syntax/basic/type.vim b/syntax/basic/type.vim index 616c3271..02e78237 100644 --- a/syntax/basic/type.vim +++ b/syntax/basic/type.vim @@ -56,6 +56,7 @@ syntax cluster typescriptPrimaryType contains= \ typescriptTupleType, \ typescriptTypeQuery, \ typescriptStringLiteralType, + \ typescriptTemplateLiteralType, \ typescriptReadonlyArrayKeyword, \ typescriptAssertType @@ -64,6 +65,17 @@ syntax region typescriptStringLiteralType contained \ nextgroup=typescriptUnion \ skipwhite skipempty +syntax region typescriptTemplateLiteralType contained + \ start=/`/ skip=/\\\\\|\\`\|\n/ end=/`\|$/ + \ contains=typescriptTemplateSubstitutionType + \ nextgroup=typescriptTypeOperator + \ skipwhite skipempty + +syntax region typescriptTemplateSubstitutionType matchgroup=typescriptTemplateSB + \ start=/\${/ end=/}/ + \ contains=@typescriptType + \ contained + syntax region typescriptParenthesizedType matchgroup=typescriptParens \ start=/(/ end=/)/ \ contains=@typescriptType @@ -103,10 +115,12 @@ syntax region typescriptTupleType matchgroup=typescriptBraces \ contained skipwhite syntax cluster typescriptTypeOperator - \ contains=typescriptUnion,typescriptTypeBracket + \ contains=typescriptUnion,typescriptTypeBracket,typescriptConstraint,typescriptConditionalType syntax match typescriptUnion /|\|&/ contained nextgroup=@typescriptPrimaryType skipwhite skipempty +syntax match typescriptConditionalType /?\|:/ contained nextgroup=@typescriptPrimaryType skipwhite skipempty + syntax cluster typescriptFunctionType contains=typescriptGenericFunc,typescriptFuncType syntax region typescriptGenericFunc matchgroup=typescriptTypeBrackets \ start=/</ end=/>/ diff --git a/syntax/common.vim b/syntax/common.vim index 0fca4de1..b5e5c16c 100644 --- a/syntax/common.vim +++ b/syntax/common.vim @@ -71,6 +71,7 @@ if exists("did_typescript_hilink") HiLink typescriptString String HiLink typescriptSpecial Special HiLink typescriptStringLiteralType String + HiLink typescriptTemplateLiteralType String HiLink typescriptStringMember String HiLink typescriptTemplate String HiLink typescriptEventString String diff --git a/syntax/elixir.vim b/syntax/elixir.vim index ca057b3d..890bb279 100644 --- a/syntax/elixir.vim +++ b/syntax/elixir.vim @@ -20,10 +20,6 @@ syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>' contains=elixirUnusedVariable -syn match elixirFunctionCall '\<[a-z_]\w*[!?]\?\(\s*\.\?\s*(\|\s\+[a-zA-Z0-9@:\'\"\[]\)\@=' -syn match elixirFunctionCall '\(:\w\+\s*\.\s*\|[A-Z]\w*\s*\.\s*\)\@<=[a-z_]\w*[!?]\?' -syn match elixirFunctionCall '\(>\s+\)\<[a-z_]\w*[!?]\?' - syn match elixirKeyword '\(\.\)\@<!\<\(for\|case\|when\|with\|cond\|if\|unless\|try\|receive\|after\|raise\|rescue\|catch\|else\|quote\|unquote\|super\|unquote_splicing\)\>:\@!' syn keyword elixirInclude import require alias use @@ -48,7 +44,7 @@ syn match elixirOperator '\~>\|\~>>\|<\~\|<<\~\|<\~>' syn match elixirAlias '\([a-z]\)\@<![A-Z]\w*\%(\.[A-Z]\w*\)*' -syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\?\|>=\?\|<=\?\)' +syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_*]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\?\|>=\?\|<=\?\)' syn match elixirAtom '\(:\)\@<!:\%(<=>\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)' syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!" |