This commit is contained in:
Adam Stankiewicz
2019-12-12 16:33:01 +01:00
parent 4d8423c962
commit 43085dc02f
7 changed files with 40 additions and 36 deletions

View File

@@ -20,7 +20,7 @@ syntax region jsxTag
\ matchgroup=NONE \ matchgroup=NONE
\ end=+\%(/\_s*>\)\@=+ \ end=+\%(/\_s*>\)\@=+
\ contained \ contained
\ contains=jsxOpenTag,jsxAttrib,jsxEscapeJs,jsxSpreadOperator,jsComment,@javascriptComments,javaScriptLineComment,javaScriptComment,typescriptLineComment,typescriptComment \ contains=jsxOpenTag,jsxAttrib,jsxExpressionBlock,jsxSpreadOperator,jsComment,@javascriptComments,javaScriptLineComment,javaScriptComment,typescriptLineComment,typescriptComment
\ keepend \ keepend
\ extend \ extend
\ skipwhite \ skipwhite
@@ -39,7 +39,7 @@ syntax region jsxElement
\ start=+<\_s*\%(>\|\${\|\z(\<[-:._$A-Za-z0-9]\+\>\)\)+ \ start=+<\_s*\%(>\|\${\|\z(\<[-:._$A-Za-z0-9]\+\>\)\)+
\ end=+/\_s*>+ \ end=+/\_s*>+
\ end=+<\_s*/\_s*\z1\_s*>+ \ end=+<\_s*/\_s*\z1\_s*>+
\ contains=jsxElement,jsxTag,jsxEscapeJs,jsxComment,jsxCloseTag,@Spell \ contains=jsxElement,jsxTag,jsxExpressionBlock,jsxComment,jsxCloseTag,@Spell
\ keepend \ keepend
\ extend \ extend
\ contained \ contained
@@ -66,7 +66,7 @@ exe 'syntax region jsxOpenTag
" <tag key={this.props.key}> " <tag key={this.props.key}>
" ~~~~~~~~~~~~~~~~ " ~~~~~~~~~~~~~~~~
syntax region jsxEscapeJs syntax region jsxExpressionBlock
\ matchgroup=jsxBraces \ matchgroup=jsxBraces
\ start=+{+ \ start=+{+
\ end=+}+ \ end=+}+
@@ -84,7 +84,7 @@ syntax match jsxNamespace +:+ contained
" <tag id="sample"> " <tag id="sample">
" ~ " ~
syntax match jsxEqual +=+ contained skipwhite skipempty nextgroup=jsxString,jsxEscapeJs,jsxRegion syntax match jsxEqual +=+ contained skipwhite skipempty nextgroup=jsxString,jsxExpressionBlock,jsxRegion
" <tag /> " <tag />
" ~~ " ~~
@@ -154,10 +154,10 @@ if s:enable_tagged_jsx
\ end=+`+ \ end=+`+
\ extend \ extend
\ contained \ contained
\ contains=jsxElement,jsxEscapeJs \ contains=jsxElement,jsxExpressionBlock
\ transparent \ transparent
syntax region jsxEscapeJs syntax region jsxExpressionBlock
\ matchgroup=jsxBraces \ matchgroup=jsxBraces
\ start=+\${+ \ start=+\${+
\ end=+}+ \ end=+}+
@@ -171,14 +171,14 @@ if s:enable_tagged_jsx
\ matchgroup=NONE \ matchgroup=NONE
\ end=+}\@1<=+ \ end=+}\@1<=+
\ contained \ contained
\ contains=jsxEscapeJs \ contains=jsxExpressionBlock
\ skipwhite \ skipwhite
\ skipempty \ skipempty
\ nextgroup=jsxAttrib,jsxSpreadOperator \ nextgroup=jsxAttrib,jsxSpreadOperator
syntax keyword jsxAttribKeyword class contained syntax keyword jsxAttribKeyword class contained
syntax match jsxSpreadOperator +\.\.\.+ contained nextgroup=jsxEscapeJs skipwhite syntax match jsxSpreadOperator +\.\.\.+ contained nextgroup=jsxExpressionBlock skipwhite
syntax match jsxCloseTag +<//>+ contained syntax match jsxCloseTag +<//>+ contained

View File

@@ -122,7 +122,7 @@ fu! csv#Init(start, end, ...) "{{{3
" Enable vartabs for tab delimited files " Enable vartabs for tab delimited files
if b:delimiter=="\t" && has("vartabs")&& !exists("b:csv_fixed_width_cols") if b:delimiter=="\t" && has("vartabs")&& !exists("b:csv_fixed_width_cols")
if get(b:, 'col_width', []) ==# [] if get(b:, 'col_width', []) ==# []
call csv#CalculateColumnWidth('') call csv#CalculateColumnWidth(line('$'))
endif endif
let &l:vts=join(b:col_width, ',') let &l:vts=join(b:col_width, ',')
let g:csv_no_conceal=1 let g:csv_no_conceal=1
@@ -574,7 +574,7 @@ fu! csv#MaxColumns(...) "{{{3
return len(b:csv_fixed_width_cols) return len(b:csv_fixed_width_cols)
endif endif
endfu endfu
fu! csv#ColWidth(colnr, ...) "{{{3 fu! csv#ColWidth(colnr, row, silent) "{{{3
" if a:1 is given, specifies the row, for which to calculate the width " if a:1 is given, specifies the row, for which to calculate the width
" "
" Return the width of a column " Return the width of a column
@@ -586,14 +586,13 @@ fu! csv#ColWidth(colnr, ...) "{{{3
if !exists("b:csv_fixed_width_cols") if !exists("b:csv_fixed_width_cols")
if !exists("b:csv_list") if !exists("b:csv_list")
" only check first 10000 lines, to be faster " only check first 10000 lines, to be faster
let last = line('$') let last = a:row
if exists("a:1") && !empty(a:1)
let last = a:1
endif
if !get(b:, 'csv_arrange_use_all_rows', 0) if !get(b:, 'csv_arrange_use_all_rows', 0)
if last > 10000 if last > 10000
let last = 10000 let last = 10000
call csv#Warn('File too large, only checking the first 10000 rows for the width') if !a:silent
call csv#Warn('File too large, only checking the first 10000 rows for the width')
endif
endif endif
endif endif
let b:csv_list=getline(skipfirst+1,last) let b:csv_list=getline(skipfirst+1,last)
@@ -750,7 +749,7 @@ fu! csv#UnArrangeCol(match) "{{{3
" Strip leading white space, also trims empty recordcsv# " Strip leading white space, also trims empty recordcsv#
return substitute(a:match, '\%(^ \+\)\|\%( \+\ze'.b:delimiter. '\?$\)', '', 'g') return substitute(a:match, '\%(^ \+\)\|\%( \+\ze'.b:delimiter. '\?$\)', '', 'g')
endfu endfu
fu! csv#CalculateColumnWidth(row) "{{{3 fu! csv#CalculateColumnWidth(row, silent) "{{{3
" Internal function, not called from external, " Internal function, not called from external,
" does not work with fixed width columns " does not work with fixed width columns
" row for the row for which to calculate the width " row for the row for which to calculate the width
@@ -763,7 +762,7 @@ fu! csv#CalculateColumnWidth(row) "{{{3
endif endif
let s:max_cols=csv#MaxColumns(line('.')) let s:max_cols=csv#MaxColumns(line('.'))
for i in range(1,s:max_cols) for i in range(1,s:max_cols)
call add(b:col_width, csv#ColWidth(i, a:row)) call add(b:col_width, csv#ColWidth(i, a:row, a:silent))
endfor endfor
catch /csv:no_col/ catch /csv:no_col/
call csv#Warn("Error: getting Column numbers, aborting!") call csv#Warn("Error: getting Column numbers, aborting!")
@@ -1053,7 +1052,7 @@ fu! csv#MoveCol(forward, line, ...) "{{{3
let maxcol=csv#MaxColumns(line('.')) let maxcol=csv#MaxColumns(line('.'))
let cpos=getpos('.')[2] let cpos=getpos('.')[2]
if !exists("b:csv_fixed_width_cols") if !exists("b:csv_fixed_width_cols")
let curwidth=CSVWidth() let curwidth=CSVWidth(1)
call search(b:col, 'bc', line('.')) call search(b:col, 'bc', line('.'))
endif endif
let spos=getpos('.')[2] let spos=getpos('.')[2]
@@ -1146,7 +1145,7 @@ fu! csv#MoveCol(forward, line, ...) "{{{3
" leave the column (if the next column is shorter) " leave the column (if the next column is shorter)
if !exists("b:csv_fixed_width_cols") if !exists("b:csv_fixed_width_cols")
let a = getpos('.') let a = getpos('.')
if CSVWidth() == curwidth if CSVWidth(1) == curwidth
let a[2]+= cpos-spos let a[2]+= cpos-spos
endif endif
else else
@@ -1159,7 +1158,7 @@ fu! csv#MoveCol(forward, line, ...) "{{{3
" Move to the correct screen column " Move to the correct screen column
if !exists("b:csv_fixed_width_cols") if !exists("b:csv_fixed_width_cols")
let a = getpos('.') let a = getpos('.')
if CSVWidth() == curwidth if CSVWidth(1) == curwidth
let a[2]+= cpos-spos let a[2]+= cpos-spos
endif endif
else else
@@ -1835,7 +1834,7 @@ fu! csv#ProcessFieldValue(field) "{{{3
if a == b:delimiter if a == b:delimiter
try try
let a=repeat(' ', csv#ColWidth(col)) let a=repeat(' ', csv#ColWidth(col, line('$'), 1))
catch catch
" no-op " no-op
endtry endtry
@@ -2134,7 +2133,7 @@ fu! csv#NewRecord(line1, line2, count) "{{{3
if !exists("b:col_width") if !exists("b:col_width")
" Best guess width " Best guess width
if exists("b:csv_fixed_width_cols") if exists("b:csv_fixed_width_cols")
let record .= printf("%*s", csv#ColWidth(item), let record .= printf("%*s", csv#ColWidth(item, line('$'), 1),
\ b:delimiter) \ b:delimiter)
else else
let record .= printf("%20s", b:delimiter) let record .= printf("%20s", b:delimiter)
@@ -3145,7 +3144,9 @@ fu! CSVCount(col, fmt, first, last, ...) "{{{3
unlet! s:additional['distinct'] unlet! s:additional['distinct']
return (empty(result) ? 0 : result) return (empty(result) ? 0 : result)
endfu endfu
fu! CSVWidth() "{{{3 fu! CSVWidth(...) "{{{3
" do not output any warning
let silent = get(a:000, 0, 1)
" does not work with fixed width columns " does not work with fixed width columns
if exists("b:csv_fixed_width_cols") if exists("b:csv_fixed_width_cols")
let c = getline(1,'$') let c = getline(1,'$')
@@ -3164,7 +3165,7 @@ fu! CSVWidth() "{{{3
" Add width for last column " Add width for last column
call add(width, max-y+1) call add(width, max-y+1)
else else
call csv#CalculateColumnWidth('') call csv#CalculateColumnWidth(line('$'), silent)
let width=map(copy(b:col_width), 'v:val-1') let width=map(copy(b:col_width), 'v:val-1')
endif endif
return width return width

View File

@@ -353,7 +353,7 @@ function! go#config#FmtCommand() abort
endfunction endfunction
function! go#config#FmtOptions() abort function! go#config#FmtOptions() abort
return get(g:, "go_fmt_options", {}) return get(b:, "go_fmt_options", get(g:, "go_fmt_options", {}))
endfunction endfunction
function! go#config#FmtFailSilently() abort function! go#config#FmtFailSilently() abort
@@ -368,9 +368,9 @@ function! go#config#PlayOpenBrowser() abort
return get(g:, "go_play_open_browser", 1) return get(g:, "go_play_open_browser", 1)
endfunction endfunction
function! go#config#GorenameCommand() abort function! go#config#RenameCommand() abort
" delegate to go#config#GorenameBin for backwards compatability. " delegate to go#config#GorenameBin for backwards compatability.
return get(g:, "go_gorename_command", go#config#GorenameBin()) return get(g:, "go_rename_command", go#config#GorenameBin())
endfunction endfunction
function! go#config#GorenameBin() abort function! go#config#GorenameBin() abort

View File

@@ -70,9 +70,9 @@ function s:is_jsx_element(syntax)
return a:syntax =~? 'jsxElement' return a:syntax =~? 'jsxElement'
endfunction endfunction
" Whether the specified syntax group is the jsxEscapeJs " Whether the specified syntax group is the jsxExpressionBlock
function s:is_jsx_escape(syntax) function s:is_jsx_expression(syntax)
return a:syntax =~? 'jsxEscapeJs' return a:syntax =~? 'jsxExpressionBlock'
endfunction endfunction
" Whether the specified syntax group is the jsxBraces " Whether the specified syntax group is the jsxBraces
@@ -191,7 +191,7 @@ endfunction
" - jsxRegion " - jsxRegion
" - jsxTaggedRegion " - jsxTaggedRegion
" - jsxElement " - jsxElement
" - jsxEscapeJs " - jsxExpressionBlock
" - Other " - Other
function s:syntax_context(lnum) function s:syntax_context(lnum)
let start_col = s:start_col(a:lnum) let start_col = s:start_col(a:lnum)
@@ -201,9 +201,9 @@ function s:syntax_context(lnum)
let i = 0 let i = 0
for syntax_name in reversed for syntax_name in reversed
" If the current line is jsxEscapeJs and not starts with jsxBraces " If the current line is jsxExpressionBlock and not starts with jsxBraces
if s:is_jsx_escape(syntax_name) if s:is_jsx_expression(syntax_name)
return 'jsxEscapeJs' return 'jsxExpressionBlock'
endif endif
if s:is_jsx_region(syntax_name) if s:is_jsx_region(syntax_name)
@@ -287,7 +287,7 @@ function! jsx_pretty#indent#get(js_indent)
endif endif
return s:jsx_indent_element(v:lnum) return s:jsx_indent_element(v:lnum)
elseif syntax_context == 'jsxEscapeJs' elseif syntax_context == 'jsxExpressionBlock'
let prev_lnum = s:prev_lnum(v:lnum) let prev_lnum = s:prev_lnum(v:lnum)
let prev_line = s:trim(getline(prev_lnum)) let prev_line = s:trim(getline(prev_lnum))

View File

@@ -66,6 +66,7 @@ let s:syng_strcom = s:syng_stringdoc + [
\ 'PercentStringDelimiter', \ 'PercentStringDelimiter',
\ 'PercentSymbolDelimiter', \ 'PercentSymbolDelimiter',
\ 'Regexp', \ 'Regexp',
\ 'RegexpCharClass',
\ 'RegexpDelimiter', \ 'RegexpDelimiter',
\ 'RegexpEscape', \ 'RegexpEscape',
\ 'StringDelimiter', \ 'StringDelimiter',

View File

@@ -39,6 +39,7 @@ syntax region dhallString start=+''+ end=+''+ contains=@Spell,dhallInterpolation
syntax region dhallString start=+"+ end=+"+ contains=dhallInterpolation,dhallEsc syntax region dhallString start=+"+ end=+"+ contains=dhallInterpolation,dhallEsc
syntax region dhallString start=+"/+ end=+"+ contains=dhallInterpolation,dhallEsc syntax region dhallString start=+"/+ end=+"+ contains=dhallInterpolation,dhallEsc
syntax keyword dhallBool True False syntax keyword dhallBool True False
syntax match dhallHash "sha256:[a-f0-9]+"
highlight link dhallSingleSpecial Special highlight link dhallSingleSpecial Special
highlight link dhallIndex Special highlight link dhallIndex Special
@@ -60,6 +61,7 @@ highlight link dhallType Structure
highlight link dhallParens Special highlight link dhallParens Special
highlight link dhallComment Comment highlight link dhallComment Comment
highlight link dhallMultilineComment Comment highlight link dhallMultilineComment Comment
highlight link dhallHash Keyword
let b:current_syntax = 'dhall' let b:current_syntax = 'dhall'

View File

@@ -43,7 +43,7 @@ syn match zigBuiltinFn "\v\@(ptrToInt|rem|returnAddress|setCold|Type|shuffle)>"
syn match zigBuiltinFn "\v\@(setRuntimeSafety|setEvalBranchQuota|setFloatMode)>" syn match zigBuiltinFn "\v\@(setRuntimeSafety|setEvalBranchQuota|setFloatMode)>"
syn match zigBuiltinFn "\v\@(setGlobalLinkage|setGlobalSection|shlExact|This|hasDecl|hasField)>" syn match zigBuiltinFn "\v\@(setGlobalLinkage|setGlobalSection|shlExact|This|hasDecl|hasField)>"
syn match zigBuiltinFn "\v\@(shlWithOverflow|shrExact|sizeOf|sqrt|byteSwap|subWithOverflow|intCast|floatCast|intToFloat|floatToInt|boolToInt|errSetCast)>" syn match zigBuiltinFn "\v\@(shlWithOverflow|shrExact|sizeOf|sqrt|byteSwap|subWithOverflow|intCast|floatCast|intToFloat|floatToInt|boolToInt|errSetCast)>"
syn match zigBuiltinFn "\v\@(truncate|typeId|typeInfo|typeName|typeOf|atomicRmw|bytesToSlice|sliceToBytes)>" syn match zigBuiltinFn "\v\@(truncate|typeId|typeInfo|typeName|TypeOf|atomicRmw|bytesToSlice|sliceToBytes)>"
syn match zigBuiltinFn "\v\@(intToError|errorToInt|intToEnum|enumToInt|setAlignStack|frame|Frame|frameSize|bitReverse|Vector)>" syn match zigBuiltinFn "\v\@(intToError|errorToInt|intToEnum|enumToInt|setAlignStack|frame|Frame|frameSize|bitReverse|Vector)>"
syn match zigBuiltinFn "\v\@(sin|cos|exp|exp2|ln|log2|log10|fabs|floor|ceil|trunc|round)>" syn match zigBuiltinFn "\v\@(sin|cos|exp|exp2|ln|log2|log10|fabs|floor|ceil|trunc|round)>"