diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 19:06:15 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 19:06:15 +0000 |
commit | 8a66eac86090fec9b57bec1af185fc146e4ef63c (patch) | |
tree | 443889a4177a0003057d2dcb7005ceb97d8cb9cc | |
parent | Adding debian version 2:9.1.0374-1. (diff) | |
download | vim-8a66eac86090fec9b57bec1af185fc146e4ef63c.tar.xz vim-8a66eac86090fec9b57bec1af185fc146e4ef63c.zip |
Merging upstream version 2:9.1.0377.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r-- | .github/CODEOWNERS | 5 | ||||
-rw-r--r-- | Filelist | 4 | ||||
-rw-r--r-- | runtime/compiler/jq.vim | 25 | ||||
-rw-r--r-- | runtime/doc/cmdline.txt | 8 | ||||
-rw-r--r-- | runtime/doc/pattern.txt | 2 | ||||
-rw-r--r-- | runtime/doc/syntax.txt | 9 | ||||
-rw-r--r-- | runtime/doc/tags | 4 | ||||
-rw-r--r-- | runtime/doc/usr_05.txt | 14 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 2 | ||||
-rw-r--r-- | runtime/doc/version9.txt | 3 | ||||
-rw-r--r-- | runtime/ftplugin/jq.vim | 18 | ||||
-rw-r--r-- | runtime/pack/dist/opt/comment/autoload/comment.vim | 58 | ||||
-rw-r--r-- | runtime/pack/dist/opt/comment/doc/comment.txt | 59 | ||||
-rw-r--r-- | runtime/pack/dist/opt/comment/plugin/comment.vim | 9 | ||||
-rw-r--r-- | runtime/syntax/jq.vim | 130 | ||||
-rw-r--r-- | runtime/syntax/json.vim | 2 | ||||
-rw-r--r-- | runtime/syntax/shared/debversions.vim | 4 | ||||
-rw-r--r-- | src/ex_cmds.h | 8 | ||||
-rw-r--r-- | src/testdir/test_autocmd.vim | 3 | ||||
-rw-r--r-- | src/testdir/test_textformat.vim | 24 | ||||
-rw-r--r-- | src/testdir/test_vim9_class.vim | 52 | ||||
-rw-r--r-- | src/testdir/test_vim9_enum.vim | 11 | ||||
-rw-r--r-- | src/testdir/test_vim9_typealias.vim | 8 | ||||
-rw-r--r-- | src/textformat.c | 3 | ||||
-rw-r--r-- | src/version.c | 6 | ||||
-rw-r--r-- | src/vim9class.c | 7 |
26 files changed, 465 insertions, 13 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 63d6735..ac41ed5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -70,6 +70,7 @@ runtime/compiler/jest.vim @dkearns runtime/compiler/jjs.vim @dkearns runtime/compiler/jshint.vim @dkearns runtime/compiler/jsonlint.vim @dkearns +runtime/compiler/jq.vim @vito-c runtime/compiler/lazbuild.vim @dkearns runtime/compiler/perl.vim @petdance @heptite runtime/compiler/perlcritic.vim @petdance @dkearns @@ -164,6 +165,7 @@ runtime/ftplugin/json.vim @dbarnett runtime/ftplugin/json5.vim @dkearns runtime/ftplugin/jsonc.vim @izhakjakov runtime/ftplugin/julia.vim @carlobaldassi +runtime/ftplugin/jq.vim @vito-c runtime/ftplugin/kconfig.vim @chrisbra runtime/ftplugin/kotlin.vim @udalov runtime/ftplugin/less.vim @genoma @@ -316,6 +318,7 @@ runtime/lang/menu_ru_ru.cp1251.vim @RestorerZ runtime/lang/menu_ru_ru.koi8-r.vim @RestorerZ runtime/lang/menu_ru_ru.utf-8.vim @RestorerZ runtime/pack/dist/opt/cfilter/plugin/cfilter.vim @yegappan +runtime/pack/dist/opt/comment/ @habamax runtime/pack/dist/opt/matchit/ @chrisbra runtime/plugin/manpager.vim @Konfekt runtime/syntax/shared/hgcommitDiff.vim @vegerot @@ -403,8 +406,10 @@ runtime/syntax/j.vim @glts runtime/syntax/jargon.vim @h3xx runtime/syntax/java.vim @zzzyxwvut runtime/syntax/javascript.vim @fleiner +runtime/syntax/json.vim @vito-c runtime/syntax/jsonc.vim @izhakjakov runtime/syntax/julia.vim @carlobaldassi +runtime/syntax/jq.vim @vito-c runtime/syntax/kconfig.vim @chrisbra runtime/syntax/kotlin.vim @udalov runtime/syntax/krl.vim @KnoP-01 @@ -755,6 +755,10 @@ RT_ALL = \ runtime/tutor/tutor.vim \ runtime/vimrc_example.vim \ runtime/pack/dist/opt/cfilter/plugin/cfilter.vim \ + runtime/pack/dist/opt/comment/plugin/comment.vim \ + runtime/pack/dist/opt/comment/doc/comment.txt \ + runtime/pack/dist/opt/comment/doc/tags \ + runtime/pack/dist/opt/comment/autoload/comment.vim \ runtime/pack/dist/opt/dvorak/plugin/dvorak.vim \ runtime/pack/dist/opt/dvorak/dvorak/enable.vim \ runtime/pack/dist/opt/dvorak/dvorak/disable.vim \ diff --git a/runtime/compiler/jq.vim b/runtime/compiler/jq.vim new file mode 100644 index 0000000..a656223 --- /dev/null +++ b/runtime/compiler/jq.vim @@ -0,0 +1,25 @@ +" Vim compiler file +" Compiler: jq +" Maintainer: Vito <vito.blog@gmail.com> +" Last Change: 2024 Apr 17 +" Upstream: https://github.com/vito-c/jq.vim + +if exists('b:current_compiler') + finish +endif +let b:current_compiler = 'jq' + +let s:save_cpoptions = &cpoptions +set cpoptions&vim + +if has('unix') + CompilerSet makeprg=jq\ -f\ %:S\ /dev/null +else + CompilerSet makeprg=jq\ -f\ %:S\ nul +endif +CompilerSet errorformat=%E%m\ at\ \\<%o\\>\\,\ line\ %l:, + \%Z, + \%-G%.%# + +let &cpoptions = s:save_cpoptions +unlet s:save_cpoptions diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 13c4d72..6a7515a 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 9.1. Last change: 2023 Dec 09 +*cmdline.txt* For Vim version 9.1. Last change: 2024 Apr 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -650,6 +650,12 @@ followed by another Vim command: :[range]! a user defined command without the "-bar" argument |:command| + and the following |Vim9-script| keywords: + :abstract + :class + :enum + :interface + Note that this is confusing (inherited from Vi): With ":g" the '|' is included in the command, with ":s" it is not. diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index c23462c..f16e7d2 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1404,7 +1404,7 @@ Finally, these constructs are unique to Perl: rules. Both methods can be used to conceal text. Thus the matching functions like |matchadd()| won't consider - syntax rules and functions like |synconcealend()| and the + syntax rules and functions like |synconcealed()| and the other way around. *:mat* *:match* diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 873315c..bfc4645 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -2086,6 +2086,15 @@ To disable syntax highlighting of errors: > let g:vim_json_warnings = 0 +JQ *jq.vim* *jq_quote_highlight* *ft-jq-syntax* + +To disable numbers having their own color add the following to your vimrc: > + hi link jqNumber Normal + +If you want quotes to have different highlighting than strings > + let g:jq_quote_highlight = 1 + + LACE *lace.vim* *ft-lace-syntax* Lace (Language for Assembly of Classes in Eiffel) is case insensitive, but the diff --git a/runtime/doc/tags b/runtime/doc/tags index dcd8db7..8096f5d 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -6515,6 +6515,7 @@ command-block vim9.txt /*command-block* command-line-functions usr_41.txt /*command-line-functions* command-line-window cmdline.txt /*command-line-window* command-mode intro.txt /*command-mode* +comment-install usr_05.txt /*comment-install* compatible-default starting.txt /*compatible-default* compile-changes-5 version5.txt /*compile-changes-5* compile-changes-6 version6.txt /*compile-changes-6* @@ -7291,6 +7292,7 @@ ft-inform-syntax syntax.txt /*ft-inform-syntax* ft-java-plugin filetype.txt /*ft-java-plugin* ft-java-syntax syntax.txt /*ft-java-syntax* ft-javascript-omni insert.txt /*ft-javascript-omni* +ft-jq-syntax syntax.txt /*ft-jq-syntax* ft-json-plugin filetype.txt /*ft-json-plugin* ft-json-syntax syntax.txt /*ft-json-syntax* ft-ksh-syntax syntax.txt /*ft-ksh-syntax* @@ -8408,6 +8410,8 @@ job_start() channel.txt /*job_start()* job_status() channel.txt /*job_status()* job_stop() channel.txt /*job_stop()* join() builtin.txt /*join()* +jq.vim syntax.txt /*jq.vim* +jq_quote_highlight syntax.txt /*jq_quote_highlight* js_decode() builtin.txt /*js_decode()* js_encode() builtin.txt /*js_encode()* jsbterm-mouse options.txt /*jsbterm-mouse* diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index 05239ee..063af9b 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -1,4 +1,4 @@ -*usr_05.txt* For Vim version 9.1. Last change: 2023 Sep 12 +*usr_05.txt* For Vim version 9.1. Last change: 2024 Apr 26 VIM USER MANUAL - by Bram Moolenaar @@ -436,6 +436,18 @@ when Vim starts, add the following line to your vimrc file: > After restarting your Vim, the plugin is active and you can read about it at: > :h editorconfig.txt + +Adding comment package *comment-install* + +Load the plugin with this command: > + packadd comment +< +This way you can use the plugin with the default key bindings `gc` and similar +for commenting (which is a well-established mapping in the Vim community). + +After restarting your Vim, the plugin is active and you can read about it at: > + :h comment.txt + More information about packages can be found here: |packages|. ============================================================================== diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 8e71948..6137cfd 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1096,7 +1096,7 @@ Syntax and highlighting: *syntax-functions* *highlighting-functions* synIDattr() get a specific attribute of a syntax ID synIDtrans() get translated syntax ID synstack() get list of syntax IDs at a specific position - synconcealed() get info about (synax) concealing + synconcealed() get info about (syntax) concealing diff_hlID() get highlight ID for diff mode at a position matchadd() define a pattern to highlight (a "match") matchaddpos() define a list of positions to highlight diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt index c277923..03050ee 100644 --- a/runtime/doc/version9.txt +++ b/runtime/doc/version9.txt @@ -1,4 +1,4 @@ -*version9.txt* For Vim version 9.1. Last change: 2024 Apr 14 +*version9.txt* For Vim version 9.1. Last change: 2024 Apr 26 VIM REFERENCE MANUAL by Bram Moolenaar @@ -41554,6 +41554,7 @@ Enum support for Vim9 script |:enum| Other improvements *new-other-9.2* ------------------ +The comment plugin |comment-install| is included. Changed *changed-9.2* ------- diff --git a/runtime/ftplugin/jq.vim b/runtime/ftplugin/jq.vim new file mode 100644 index 0000000..15cd400 --- /dev/null +++ b/runtime/ftplugin/jq.vim @@ -0,0 +1,18 @@ +" Vim compiler file +" Language: jq +" Maintainer: Vito <vito.blog@gmail.com> +" Last Change: 2024 Apr 17 +" Upstream: https://github.com/vito-c/jq.vim + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = 'setl commentstring<' + +setlocal commentstring=#%s +compiler jq + +let &cpoptions = s:save_cpoptions +unlet s:save_cpoptions diff --git a/runtime/pack/dist/opt/comment/autoload/comment.vim b/runtime/pack/dist/opt/comment/autoload/comment.vim new file mode 100644 index 0000000..9dda266 --- /dev/null +++ b/runtime/pack/dist/opt/comment/autoload/comment.vim @@ -0,0 +1,58 @@ +vim9script + +# Maintainer: Maxim Kim <habamax@gmail.com> +# Last Update: 2024-04-26 +# +# Toggle comments +# Usage: +# Add following mappings to vimrc: +# import autoload 'dist/comment.vim' +# nnoremap <silent> <expr> gc comment.Toggle() +# xnoremap <silent> <expr> gc comment.Toggle() +# nnoremap <silent> <expr> gcc comment.Toggle() .. '_' +export def Toggle(...args: list<string>): string + if len(args) == 0 + &opfunc = matchstr(expand('<stack>'), '[^. ]*\ze[') + return 'g@' + endif + if empty(&cms) || !&ma | return '' | endif + var cms = substitute(substitute(&cms, '\S\zs%s\s*', ' %s', ''), '%s\ze\S', '%s ', '') + var [lnum1, lnum2] = [line("'["), line("']")] + var cms_l = split(escape(cms, '*.'), '\s*%s\s*') + if len(cms_l) == 0 | return '' | endif + if len(cms_l) == 1 | call add(cms_l, '') | endif + var comment = 0 + var indent_min = indent(lnum1) + var indent_start = matchstr(getline(lnum1), '^\s*') + for lnum in range(lnum1, lnum2) + if getline(lnum) =~ '^\s*$' | continue | endif + if indent_min > indent(lnum) + indent_min = indent(lnum) + indent_start = matchstr(getline(lnum), '^\s*') + endif + if getline(lnum) !~ $'^\s*{cms_l[0]}.*{cms_l[1]}$' + comment = 1 + endif + endfor + var lines = [] + var line = '' + for lnum in range(lnum1, lnum2) + if getline(lnum) =~ '^\s*$' + line = getline(lnum) + elseif comment + if exists("g:comment_first_col") || exists("b:comment_first_col") + # handle % with substitute + line = printf(substitute(cms, '%s\@!', '%%', 'g'), getline(lnum)) + else + # handle % with substitute + line = printf(indent_start .. substitute(cms, '%s\@!', '%%', 'g'), + strpart(getline(lnum), strlen(indent_start))) + endif + else + line = substitute(getline(lnum), $'^\s*\zs{cms_l[0]} \?\| \?{cms_l[1]}$', '', 'g') + endif + add(lines, line) + endfor + noautocmd keepjumps setline(lnum1, lines) + return '' +enddef diff --git a/runtime/pack/dist/opt/comment/doc/comment.txt b/runtime/pack/dist/opt/comment/doc/comment.txt new file mode 100644 index 0000000..e2bf755 --- /dev/null +++ b/runtime/pack/dist/opt/comment/doc/comment.txt @@ -0,0 +1,59 @@ +*comment.txt* For Vim version 9.1. Last change: 2024 Apr 26 + + + VIM REFERENCE MANUAL + +Commenting and un-commenting text. + +============================================================================== + +The comment.vim package, allows to toggle comments for a single line, a range +of lines or a selected text object. It defines the following mappings: + + *gcc* +gcc to comment/uncomment current line + *o_gc* +gc{motion} to toggle comments for the selected motion + *gcip* +gcip to comment/uncomment current paragraph + *gcG* +gcG to comment/uncomment from current line till the end of a buffer + *v_gc* +{Visual}gc to comment/uncomment the highlighted lines. + +The plugin uses the buffer-local 'commentstring' option value to add or remove +comment markers to the selected lines. Whether it will comment or un-comment +depends on the first line of the range of lines to act upon. When it matches +a comment marker, the line will be un-commented, if it doesn't, the line will +be commented out. Blank and empty lines are not touched. + +If the mapping does not seem to work, chances are high, that this particular +filetype is either not detected by Vim or the filetype plugin does not set the +'commentstring' option. + +You can simply configure this using the following autocommand (e.g. for legacy +Vim script): > + + autocmd Filetype vim :setlocal commentstring="\ %s + +This example sets the " as start of a comment for legacy Vim Script. For Vim9 +script, you would instead use the "#" char: > + + autocmd Filetype vim :setlocal commentstring=#\ %s + +============================================================================== +Options: + +*g:comment_first_col* +*b:comment_first_col* + By default comment chars are added in front of the line, i.e. if the line + was indented, commented line would stay indented as well. + + However some filetypes require a comment char on the first column, use this option + to change default behaviour. + + Use g:comment_first_col to change it globally or b:comment_first_col to + target specific filetype(s). + +============================================================================== +vim:tw=78:ts=8:fo=tcq2:ft=help: diff --git a/runtime/pack/dist/opt/comment/plugin/comment.vim b/runtime/pack/dist/opt/comment/plugin/comment.vim new file mode 100644 index 0000000..94ac067 --- /dev/null +++ b/runtime/pack/dist/opt/comment/plugin/comment.vim @@ -0,0 +1,9 @@ +vim9script + +# Maintainer: Maxim Kim <habamax@gmail.com> +# Last Update: 2024-04-26 + +import autoload 'comment.vim' +nnoremap <silent> <expr> gc comment.Toggle() +xnoremap <silent> <expr> gc comment.Toggle() +nnoremap <silent> <expr> gcc comment.Toggle() .. '_' diff --git a/runtime/syntax/jq.vim b/runtime/syntax/jq.vim new file mode 100644 index 0000000..272dcb4 --- /dev/null +++ b/runtime/syntax/jq.vim @@ -0,0 +1,130 @@ +" Vim compiler file +" Language: jq +" Maintainer: Vito <vito.blog@gmail.com> +" Last Change: 2024 Apr 17 +" Upstream: https://github.com/vito-c/jq.vim +" +" Quit when a (custom) syntax file was already loaded +if exists('b:current_syntax') + finish +endif + +" syn include @jqHtml syntax/html.vim " Doc comment HTML + +" jqTodo +syntax keyword jqTodo contained TODO FIXME NOTE XXX + +" jqKeywords +syntax keyword jqKeywords and or not empty +syntax keyword jqKeywords try catch +syntax keyword jqKeywords reduce as label break foreach +syntax keyword jqKeywords import include module modulemeta +syntax keyword jqKeywords env nth has in while error stderr debug + +" jqConditional +syntax keyword jqConditional if then elif else end + +" jqConditions +syntax keyword jqCondtions true false null + +" jqSpecials +syntax keyword jqType type +syntax match jqType /[\|;]/ " not really a type I did this for coloring reasons though :help group-name +syntax region jqParentheses start=+(+ end=+)+ fold transparent + +" jq Functions +syntax keyword jqFunction add all any arrays ascii_downcase floor +syntax keyword jqFunction ascii_upcase booleans bsearch builtins capture combinations +syntax keyword jqFunction \contains del delpaths endswith explode +syntax keyword jqFunction finites first flatten format from_entries +syntax keyword jqFunction fromdate fromdateiso8601 fromjson fromstream get_jq_origin +syntax keyword jqFunction get_prog_origin get_search_list getpath gmtime group_by +syntax keyword jqFunction gsub halt halt_error implode index indices infinite +syntax keyword jqFunction input input_filename input_line_number inputs inside +syntax keyword jqFunction isempty isfinite isinfinite isnan isnormal iterables +syntax keyword jqFunction join keys keys_unsorted last leaf_paths +syntax keyword jqFunction length limit localtime ltrimstr map map_values +syntax keyword jqFunction match max max_by min min_by +syntax keyword jqFunction mktime nan normals now +syntax keyword jqFunction nulls numbers objects path paths range +syntax keyword jqFunction recurse recurse_down repeat reverse rindex +syntax keyword jqFunction rtrimstr scalars scalars_or_empty scan select +syntax keyword jqFunction setpath sort sort_by split splits with_entries +syntax keyword jqFunction startswith strflocaltime strftime strings strptime sub +syntax keyword jqFunction test to_entries todate todateiso8601 tojson __loc__ +syntax keyword jqFunction tonumber tostream tostring transpose truncate_stream +syntax keyword jqFunction unique unique_by until utf8bytelength values walk +" TODO: $__loc__ is going to be a pain + +" jq Math Functions +syntax keyword jqFunction acos acosh asin asinh atan atanh cbrt ceil cos cosh +syntax keyword jqFunction erf erfc exp exp10 exp2 expm1 fabs floor gamma j0 j1 +syntax keyword jqFunction lgamma lgamma_r log log10 log1p log2 logb nearbyint +syntax keyword jqFunction pow10 rint round significand sin sinh sqrt tan tanh +syntax keyword jqFunction tgamma trunc y0 y1 +syntax keyword jqFunction atan2 copysign drem fdim fmax fmin fmod frexp hypot +syntax keyword jqFunction jn ldexp modf nextafter nexttoward pow remainder +syntax keyword jqFunction scalb scalbln yn +syntax keyword jqFunction fma + +" jq SQL-style Operators +syntax keyword jqFunction INDEX JOIN IN + +" Macro +syntax match jqMacro "@\%(text\|json\|html\|uri\|[ct]sv\|sh\|base64d\?\)\>" + +" Comments +syntax match jqComment "#.*" contains=jqTodo + +" Variables +syn match jqVariables /$[_A-Za-z0-9]\+/ + +" Definition +syntax keyword jqKeywords def nextgroup=jqNameDefinition skipwhite +syn match jqNameDefinition /\<[_A-Za-z0-9]\+\>/ contained nextgroup=jqPostNameDefinition +syn match jqNameDefinition /`[^`]\+`/ contained nextgroup=jqPostNameDefinition + +" Strings +syn region jqError start=+'+ end=+'\|$\|[;)]\@=+ +syn region jqString matchgroup=jqQuote + \ start=+"+ skip=+\\[\\"]+ end=+"+ + \ contains=@Spell,jqInterpolation +syn region jqInterpolation matchgroup=jqInterpolationDelimiter + \ start=+\%([^\\]\%(\\\\\)*\\\)\@<!\\(+ end=+)+ + \ contained contains=TOP + +" Operators +syn match jqOperator /:\|\([-+*/%<>=]\|\/\/\)=\?\|[!|]=\|?\/\// +"syn region jqRange matchgroup=jqSquareBracket start=+\[+ skip=+:+ end=+\]+ + +" Errors +syn keyword jqError _assign _flatten _modify _nwise _plus _negate _minus _multiply +syn keyword jqError _divide _mod _strindices _equal _notequal _less _greater _lesseq +syn keyword jqError _greatereq _sort_by_impl _group_by_impl _min_by_impl _max_by_impl _match_impl _input +" TODO: these errors should show up when doing def _flatten: as well + +" Numbers +syn match jqNumber /\<0[dDfFlL]\?\>/ " Just a bare 0 +syn match jqNumber /\<[1-9]\d*[dDfFlL]\?\>/ " A multi-digit number - octal numbers with leading 0's are deprecated in Scala + +if !exists('jq_quote_highlight') + highlight def link jqQuote String +else + highlight def link jqQuote Type +endif + +hi def link jqCondtions Boolean +hi def link jqVariables Identifier +hi def link jqNameDefinition Function +hi def link jqTodo Todo +hi def link jqComment Comment +hi def link jqKeywords Keyword +hi def link jqType Type +hi def link jqOperator Operator +hi def link jqFunction Function +hi def link jqMacro Macro +hi def link jqError Error +hi def link jqString String +hi def link jqInterpolationDelimiter Delimiter +hi def link jqConditional Conditional +hi def link jqNumber Number diff --git a/runtime/syntax/json.vim b/runtime/syntax/json.vim index 3f49b0c..f61a17e 100644 --- a/runtime/syntax/json.vim +++ b/runtime/syntax/json.vim @@ -1,6 +1,6 @@ " Vim syntax file " Language: JSON -" Maintainer: vacancy +" Maintainer: Vito <vito.blog@gmail.com> " Previous Maintainer: Eli Parra <eli@elzr.com> " Last Change: 2019 Sep 17 " Version: 0.12 diff --git a/runtime/syntax/shared/debversions.vim b/runtime/syntax/shared/debversions.vim index 4aec246..e18eca9 100644 --- a/runtime/syntax/shared/debversions.vim +++ b/runtime/syntax/shared/debversions.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Debian version information " Maintainer: Debian Vim Maintainers -" Last Change: 2024 Jan 25 +" Last Change: 2024 Apr 27 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/shared/debversions.vim let s:cpo = &cpo @@ -11,7 +11,7 @@ let g:debSharedSupportedVersions = [ \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', 'sid', 'rc-buggy', \ 'bullseye', 'bookworm', 'trixie', 'forky', \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'mantic', 'noble', + \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'mantic', 'noble', 'oracular', \ 'devel' \ ] let g:debSharedUnsupportedVersions = [ diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 70e5770..40dec4c 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -129,7 +129,7 @@ EXCMD(CMD_aboveleft, "aboveleft", ex_wrongmodifier, EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM, ADDR_NONE), EXCMD(CMD_abstract, "abstract", ex_class, - EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, + EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, ADDR_NONE), EXCMD(CMD_all, "all", ex_all, EX_BANG|EX_RANGE|EX_COUNT|EX_TRLBAR, @@ -357,7 +357,7 @@ EXCMD(CMD_clast, "clast", ex_cc, EX_RANGE|EX_COUNT|EX_TRLBAR|EX_BANG, ADDR_UNSIGNED), EXCMD(CMD_class, "class", ex_class, - EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, + EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, ADDR_NONE), EXCMD(CMD_close, "close", ex_close, EX_BANG|EX_RANGE|EX_COUNT|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, @@ -597,7 +597,7 @@ EXCMD(CMD_enew, "enew", ex_edit, EX_BANG|EX_TRLBAR, ADDR_NONE), EXCMD(CMD_enum, "enum", ex_class, - EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, + EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, ADDR_NONE), EXCMD(CMD_eval, "eval", ex_eval, EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK, @@ -759,7 +759,7 @@ EXCMD(CMD_intro, "intro", ex_intro, EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_interface, "interface", ex_class, - EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, + EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, ADDR_NONE), EXCMD(CMD_isearch, "isearch", ex_findpat, EX_BANG|EX_RANGE|EX_DFLALL|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK, diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 6745ecb..24e1daf 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -4687,6 +4687,9 @@ func Test_BufEnter_botline() edit Xxx2 au BufEnter Xxx1 call assert_true(line('w$') > 1) edit Xxx1 + + bwipe! Xxx1 + bwipe! Xxx2 au! BufEnter Xxx1 set hidden&vim endfunc diff --git a/src/testdir/test_textformat.vim b/src/testdir/test_textformat.vim index a9cffd0..5d58486 100644 --- a/src/testdir/test_textformat.vim +++ b/src/testdir/test_textformat.vim @@ -1312,4 +1312,28 @@ func Test_textwdith_overflow() bw! endfunc +func Test_breakindent_reformat() + " Make sure textformatting uses the full width + " of the textwidth and does not consider the indent + " from breakindent into account when calculating the + " line length. Should break at tw 78 and not at 70 + CheckOption breakindent + new + 80vnew + 39vnew + setl ai breakindent tw=78 + let lorem = [ + \ ' Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam luctus', + \ ' lectus sodales, dictum augue vel, molestie augue. Duis sit amet', + \ ' rhoncus justo. Nullam posuere risus semper magna commodo scelerisque.', + \ ' Duis et venenatis sem. In rhoncus augue sed tempor mattis. Mauris id', + \ ' aliquet odio.'] + call setline(1, lorem) + norm! gqap + call assert_equal(lorem, getline(1, '$')) + bw! + bw! + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim index 5957f57..bd06c6e 100644 --- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -67,6 +67,42 @@ def Test_class_basic() END v9.CheckSourceFailure(lines, "E488: Trailing characters: | echo 'done'", 3) + # Additional command after "class name" + lines =<< trim END + vim9script + class Something | var x = 10 + endclass + END + v9.CheckSourceFailure(lines, "E488: Trailing characters: | var x = 10", 2) + + # Additional command after "object variable" + lines =<< trim END + vim9script + class Something + var l: list<number> = [] | var y = 10 + endclass + END + v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", 3) + + # Additional command after "class variable" + lines =<< trim END + vim9script + class Something + static var d = {a: 10} | var y = 10 + endclass + END + v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", 3) + + # Additional command after "object method" + lines =<< trim END + vim9script + class Something + def Foo() | var y = 10 + enddef + endclass + END + v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", 3) + # Try to define a class with the same name as an existing variable lines =<< trim END vim9script @@ -2237,6 +2273,14 @@ def Test_interface_basics() END v9.CheckSourceFailure(lines, 'E1345: Not a valid command in an interface: return 5', 6) + # Additional commands after "interface name" + lines =<< trim END + vim9script + interface Something | var x = 10 | var y = 20 + endinterface + END + v9.CheckSourceFailure(lines, "E488: Trailing characters: | var x = 10", 2) + lines =<< trim END vim9script export interface EnterExit @@ -3233,6 +3277,14 @@ def Test_abstract_class() END v9.CheckSourceFailure(lines, 'E1316: Class can only be defined in Vim9 script', 1) + # Additional commands after "abstract class" + lines =<< trim END + vim9script + abstract class Something | var x = [] + endclass + END + v9.CheckSourceFailure(lines, "E488: Trailing characters: | var x = []", 2) + # Abstract class cannot have a "new" function lines =<< trim END vim9script diff --git a/src/testdir/test_vim9_enum.vim b/src/testdir/test_vim9_enum.vim index 274b556..bc54bee 100644 --- a/src/testdir/test_vim9_enum.vim +++ b/src/testdir/test_vim9_enum.vim @@ -97,7 +97,16 @@ def Test_enum_parse() vim9script enum Something | endenum END - v9.CheckSourceFailure(lines, 'E1420: Missing :endenum', 3) + v9.CheckSourceFailure(lines, 'E488: Trailing characters: | endenum', 2) + + # another command follows the enum name + lines =<< trim END + vim9script + enum Something | var x = 10 + Foo + endenum + END + v9.CheckSourceFailure(lines, 'E488: Trailing characters: | var x = 10', 2) # Try to define an enum with the same name as an existing variable lines =<< trim END diff --git a/src/testdir/test_vim9_typealias.vim b/src/testdir/test_vim9_typealias.vim index 998079c..cf540c2 100644 --- a/src/testdir/test_vim9_typealias.vim +++ b/src/testdir/test_vim9_typealias.vim @@ -172,6 +172,14 @@ def Test_typealias() END v9.CheckSourceSuccess(lines) + # another command follows a type alias + lines =<< trim END + vim9script + type MyType = number | var x = 20 + assert_equal(20, x) + END + v9.CheckSourceSuccess(lines) + # Sourcing a script twice (which will free script local variables) # Uses "lines" from the previous test new diff --git a/src/textformat.c b/src/textformat.c index 41ec2cf..d380899 100644 --- a/src/textformat.c +++ b/src/textformat.c @@ -59,9 +59,11 @@ internal_format( int safe_tw = trim_to_int(8 * (vimlong_T)textwidth); #ifdef FEAT_LINEBREAK int has_lbr = curwin->w_p_lbr; + int has_bri = curwin->w_p_bri; // make sure win_lbr_chartabsize() counts correctly curwin->w_p_lbr = FALSE; + curwin->w_p_bri = FALSE; #endif // When 'ai' is off we don't want a space under the cursor to be @@ -475,6 +477,7 @@ internal_format( #ifdef FEAT_LINEBREAK curwin->w_p_lbr = has_lbr; + curwin->w_p_bri = has_bri; #endif if (!format_only && haveto_redraw) { diff --git a/src/version.c b/src/version.c index 2bd0667..71e56a2 100644 --- a/src/version.c +++ b/src/version.c @@ -705,6 +705,12 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 377, +/**/ + 376, +/**/ + 375, +/**/ 374, /**/ 373, diff --git a/src/vim9class.c b/src/vim9class.c index 52c2f76..4314b52 100644 --- a/src/vim9class.c +++ b/src/vim9class.c @@ -136,6 +136,13 @@ parse_member( fill_evalarg_from_eap(&evalarg, eap, FALSE); (void)skip_expr_concatenate(&init_arg, &expr_start, &expr_end, &evalarg); + init_arg = skipwhite(init_arg); + if (*init_arg != NUL) + { + semsg(_(e_trailing_characters_str), init_arg); + return FAIL; + } + // No type specified for the member. Set it to "any" and the correct // type will be set when the object is instantiated. if (type == NULL) |