From fd57f39766c9f26da739214288f90be74223c3cd Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 20 Nov 2024 08:53:12 +0100 Subject: vim-patch:4927dae: runtime(compiler): fix escaping of arguments passed to :CompilerSet See newly added help entry referring to option-backslash closes: vim/vim#16084 https://github.com/vim/vim/commit/4927daef608d4bbcdce8a1098cdeeaed3112c849 Co-authored-by: Konfekt --- runtime/compiler/cppcheck.vim | 4 ++-- runtime/compiler/groff.vim | 4 ++-- runtime/compiler/mypy.vim | 4 ++-- runtime/compiler/pandoc.vim | 4 ++-- runtime/compiler/powershell.vim | 7 ++++--- runtime/compiler/pylint.vim | 3 ++- runtime/compiler/ruff.vim | 3 ++- runtime/compiler/tex.vim | 7 ++++--- 8 files changed, 20 insertions(+), 16 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/cppcheck.vim b/runtime/compiler/cppcheck.vim index 4df12d1714..033613c091 100644 --- a/runtime/compiler/cppcheck.vim +++ b/runtime/compiler/cppcheck.vim @@ -1,7 +1,7 @@ " vim compiler file " Compiler: cppcheck (C++ static checker) " Maintainer: Vincent B. (twinside@free.fr) -" Last Change: 2024 Nov 08 by @Konfekt +" Last Change: 2024 Nov 19 by @Konfekt if exists("current_compiler") | finish | endif let current_compiler = "cppcheck" @@ -25,7 +25,7 @@ let &l:makeprg = 'cppcheck --quiet' \ (filereadable('compile_commands.json') ? '--project=compile_commands.json' : \ (!empty(glob('*'..s:slash..'compile_commands.json', 1, 1)) ? '--project='..glob('*'..s:slash..'compile_commands.json', 1, 1)[0] : \ (empty(&path) ? '' : '-I')..join(map(filter(split(&path, ','), 'isdirectory(v:val)'),'shellescape(v:val)'), ' -I'))))) -exe 'CompilerSet makeprg='..escape(&l:makeprg, ' "') +exe 'CompilerSet makeprg='..escape(&l:makeprg, ' \|"') CompilerSet errorformat= \%f:%l:%c:\ %tarning:\ %m, diff --git a/runtime/compiler/groff.vim b/runtime/compiler/groff.vim index 640146d6a1..3e9ae0488f 100644 --- a/runtime/compiler/groff.vim +++ b/runtime/compiler/groff.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: Groff " Maintainer: Konfekt -" Last Change: 2024 Sep 8 +" Last Change: 2024 Nov 19 " " Expects output file extension, say `:make html` or `:make pdf`. " Supported devices as of Sept 2024 are: (x)html, pdf, ps, dvi, lj4, lbp ... @@ -30,7 +30,7 @@ execute 'CompilerSet makeprg=groff'..escape( \ ' '..s:groff_compiler_lang().. \ ' -K'..get(b:, 'groff_compiler_encoding', get(g:, 'groff_compiler_encoding', 'utf8')).. \ ' '..get(b:, 'groff_compiler_args', get(g:, 'groff_compiler_args', '')).. - \ ' -mom -T$* -- %:S > %:r:S.$*', ' ') + \ ' -mom -T$* -- %:S > %:r:S.$*', ' \|"') " From Gavin Freeborn's https://github.com/Gavinok/vim-troff under Vim License " https://github.com/Gavinok/vim-troff/blob/91017b1423caa80aba541c997909a4f810edd275/compiler/troff.vim#L39 CompilerSet errorformat=%o:\ (%f):%l:%m, diff --git a/runtime/compiler/mypy.vim b/runtime/compiler/mypy.vim index 891488626a..907b98b777 100644 --- a/runtime/compiler/mypy.vim +++ b/runtime/compiler/mypy.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: Mypy (Python static checker) " Maintainer: @Konfekt -" Last Change: 2024 Nov 07 +" Last Change: 2024 Nov 19 if exists("current_compiler") | finish | endif let current_compiler = "mypy" @@ -12,7 +12,7 @@ set cpo&vim " CompilerSet makeprg=mypy let &l:makeprg = 'mypy --show-column-numbers ' \ ..get(b:, 'mypy_makeprg_params', get(g:, 'mypy_makeprg_params', '--strict --ignore-missing-imports')) -exe 'CompilerSet makeprg='..escape(&l:makeprg, ' "') +exe 'CompilerSet makeprg='..escape(&l:makeprg, ' \|"') CompilerSet errorformat=%f:%l:%c:\ %t%*[^:]:\ %m let &cpo = s:cpo_save diff --git a/runtime/compiler/pandoc.vim b/runtime/compiler/pandoc.vim index 6c15e104c3..5d90a518c9 100644 --- a/runtime/compiler/pandoc.vim +++ b/runtime/compiler/pandoc.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: Pandoc " Maintainer: Konfekt -" Last Change: 2024 Sep 8 +" Last Change: 2024 Nov 19 " " Expects output file extension, say `:make html` or `:make pdf`. " Passes additional arguments to pandoc, say `:make html --self-contained`. @@ -56,7 +56,7 @@ execute 'CompilerSet makeprg=pandoc'..escape( \ ' '..s:PandocLang().. \ ' --from='..s:PandocFiletype(&filetype).. \ ' '..get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', '')).. - \ ' --output %:r:S.$* -- %:S', ' ') + \ ' --output %:r:S.$* -- %:S', ' \|"') CompilerSet errorformat=\"%f\",\ line\ %l:\ %m let &cpo = s:keepcpo diff --git a/runtime/compiler/powershell.vim b/runtime/compiler/powershell.vim index 821fea4085..3d37d7c847 100644 --- a/runtime/compiler/powershell.vim +++ b/runtime/compiler/powershell.vim @@ -3,8 +3,9 @@ " URL: https://github.com/PProvost/vim-ps1 " Contributors: Enno Nagel " Last Change: 2024 Mar 29 -" 2024 Apr 03 by The Vim Project (removed :CompilerSet definition) -" 2024 Apr 05 by The Vim Project (avoid leaving behind g:makeprg) +" 2024 Apr 03 by the Vim Project (removed :CompilerSet definition) +" 2024 Apr 05 by the Vim Project (avoid leaving behind g:makeprg) +" 2024 Nov 19 by the Vim Project (properly escape makeprg setting) if exists("current_compiler") finish @@ -49,7 +50,7 @@ let s:makeprg = g:ps1_makeprg_cmd .. ' %:p:S' " + CategoryInfo : ObjectNotFound: (Write-Ouput:String) [], CommandNotFoundException " + FullyQualifiedErrorId : CommandNotFoundException -execute 'CompilerSet makeprg=' .. escape(s:makeprg, ' ') +execute 'CompilerSet makeprg=' .. escape(s:makeprg, ' \|"') " Showing error in context with underlining. CompilerSet errorformat=%+G+%m diff --git a/runtime/compiler/pylint.vim b/runtime/compiler/pylint.vim index 4c9c23e125..96abf315ab 100644 --- a/runtime/compiler/pylint.vim +++ b/runtime/compiler/pylint.vim @@ -2,6 +2,7 @@ " Compiler: Pylint for Python " Maintainer: Daniel Moch " Last Change: 2024 Nov 07 by The Vim Project (added params variable) +" 2024 Nov 19 by the Vim Project (properly escape makeprg setting) if exists("current_compiler") | finish | endif let current_compiler = "pylint" @@ -13,7 +14,7 @@ set cpo&vim let &l:makeprg = 'pylint ' . \ '--output-format=text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" --reports=no ' . \ get(b:, "pylint_makeprg_params", get(g:, "pylint_makeprg_params", '--jobs=0')) -exe 'CompilerSet makeprg='..escape(&l:makeprg, ' "') +exe 'CompilerSet makeprg='..escape(&l:makeprg, ' \|"') CompilerSet errorformat=%A%f:%l:%c:%t:\ %m,%A%f:%l:\ %m,%A%f:(%l):\ %m,%-Z%p^%.%#,%-G%.%# let &cpo = s:cpo_save diff --git a/runtime/compiler/ruff.vim b/runtime/compiler/ruff.vim index 11a69740d8..318f4fe5cb 100644 --- a/runtime/compiler/ruff.vim +++ b/runtime/compiler/ruff.vim @@ -2,6 +2,7 @@ " Compiler: Ruff (Python linter) " Maintainer: @pbnj-dragon " Last Change: 2024 Nov 07 +" 2024 Nov 19 by the Vim Project (properly escape makeprg setting) if exists("current_compiler") | finish | endif let current_compiler = "ruff" @@ -12,7 +13,7 @@ set cpo&vim " CompilerSet makeprg=ruff let &l:makeprg= 'ruff check --output-format=concise ' \ ..get(b:, 'ruff_makeprg_params', get(g:, 'ruff_makeprg_params', '--preview')) -exe 'CompilerSet makeprg='..escape(&l:makeprg, ' "') +exe 'CompilerSet makeprg='..escape(&l:makeprg, ' \|"') CompilerSet errorformat=%f:%l:%c:\ %m,%f:%l:\ %m,%f:%l:%c\ -\ %m,%f: let &cpo = s:cpo_save diff --git a/runtime/compiler/tex.vim b/runtime/compiler/tex.vim index 282b3a0588..bc1623729a 100644 --- a/runtime/compiler/tex.vim +++ b/runtime/compiler/tex.vim @@ -3,8 +3,9 @@ " Maintainer: Artem Chuprina " Contributors: Enno Nagel " Last Change: 2024 Mar 29 -" 2024 Apr 03 by The Vim Project (removed :CompilerSet definition) -" 2024 Apr 05 by The Vim Project (avoid leaving behind g:makeprg) +" 2024 Apr 03 by the Vim Project (removed :CompilerSet definition) +" 2024 Apr 05 by the Vim Project (avoid leaving behind g:makeprg) +" 2024 Nov 19 by the Vim Project (properly escape makeprg setting) if exists("current_compiler") finish @@ -27,7 +28,7 @@ if exists('b:tex_ignore_makefile') || exists('g:tex_ignore_makefile') || let current_compiler = "latex" endif let s:makeprg=current_compiler .. ' -interaction=nonstopmode' - execute 'CompilerSet makeprg=' .. escape(s:makeprg, ' ') + execute 'CompilerSet makeprg=' .. escape(s:makeprg, ' \|"') else let current_compiler = 'make' endif -- cgit From 8d7d225caa12e5a25f6853a54a2fd6d144342d3c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 29 Nov 2024 08:54:47 +0800 Subject: vim-patch:65311c6: runtime(compiler): include spotbugs Java linter closes: vim/vim#16001 https://github.com/vim/vim/commit/65311c6f472de67b368d83441ca5e93da86161f4 Co-authored-by: Konfekt Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com> --- runtime/compiler/javac.vim | 8 +- runtime/compiler/maven.vim | 2 +- runtime/compiler/spotbugs.vim | 189 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 192 insertions(+), 7 deletions(-) create mode 100644 runtime/compiler/spotbugs.vim (limited to 'runtime/compiler') diff --git a/runtime/compiler/javac.vim b/runtime/compiler/javac.vim index 9bd4cdf270..53cd772ed8 100644 --- a/runtime/compiler/javac.vim +++ b/runtime/compiler/javac.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: Java Development Kit Compiler " Maintainer: Doug Kearns -" Last Change: 2024 Jun 14 +" Last Change: 2024 Nov 19 (enable local javac_makeprg_params) if exists("current_compiler") finish @@ -11,11 +11,7 @@ let current_compiler = "javac" let s:cpo_save = &cpo set cpo&vim -if exists("g:javac_makeprg_params") - execute $'CompilerSet makeprg=javac\ {escape(g:javac_makeprg_params, ' \|"')}' -else - CompilerSet makeprg=javac -endif +execute $'CompilerSet makeprg=javac\ {escape(get(b:, 'javac_makeprg_params', get(g:, 'javac_makeprg_params', '')), ' \|"')}' CompilerSet errorformat=%E%f:%l:\ error:\ %m, \%W%f:%l:\ warning:\ %m, diff --git a/runtime/compiler/maven.vim b/runtime/compiler/maven.vim index ef8d8a6fb2..72e74e301d 100644 --- a/runtime/compiler/maven.vim +++ b/runtime/compiler/maven.vim @@ -14,7 +14,7 @@ if exists("current_compiler") endif let current_compiler = "maven" -CompilerSet makeprg=mvn\ --batch-mode +execute $'CompilerSet makeprg=mvn\ --batch-mode\ {escape(get(b:, 'maven_makeprg_params', get(g:, 'maven_makeprg_params', '')), ' \|"')}' " Error message for POM CompilerSet errorformat=[FATAL]\ Non-parseable\ POM\ %f:\ %m%\\s%\\+@%.%#line\ %l\\,\ column\ %c%.%#, diff --git a/runtime/compiler/spotbugs.vim b/runtime/compiler/spotbugs.vim new file mode 100644 index 0000000000..72a5084976 --- /dev/null +++ b/runtime/compiler/spotbugs.vim @@ -0,0 +1,189 @@ +" Vim compiler file +" Compiler: Spotbugs (Java static checker; needs javac compiled classes) +" Maintainer: @konfekt and @zzzyxwvut +" Last Change: 2024 Nov 27 + +if exists('g:current_compiler') || bufname() !~# '\.java\=$' || wordcount().chars < 9 + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Unfortunately Spotbugs does not output absolute paths, so you need to +" pass the directory of the files being checked as `-sourcepath` parameter. +" The regex, auxpath and glob try to include all dependent classes of the +" current buffer. See https://github.com/spotbugs/spotbugs/issues/856 + +" FIXME: When "search()" is used with the "e" flag, it makes no _further_ +" progress after claiming an EOL match (i.e. "\_" or "\n", but not "$"). +" XXX: Omit anonymous class declarations +let s:keywords = '\C\<\%(\.\@1' +" Capture ";" for counting a class file directory (see s:package_dir_heads below) +let s:package_names = '\C\ 0 + let name_attr = synIDattr(synID(lnum, (col('.') - 1), 0), 'name') + if name_attr ==# 'javaClassDecl' + let tokens = matchlist(getline(lnum)..getline(lnum + 1), s:type_names) + if !empty(tokens) | call add(type_names, tokens[1]) | endif + elseif name_attr ==# 'javaExternal' + let tokens = matchlist(getline(lnum)..getline(lnum + 1), s:package_names) + if !empty(tokens) | let s:package = tokens[1] | endif + endif + let lnum = search(s:keywords, 'eW') + endwhile + return type_names + endfunction + +else + function! s:GetDeclaredTypeNames() abort + if bufname() =~# '\<\%(module\|package\)-info\.java\=$' + return [expand('%:t:r')] + endif + " Undo the unsetting of &hls, see below + if &hls + defer execute('set hls') + endif + " Possibly restore the current values for registers '"' and "y", see below + defer call('setreg', ['"', getreg('"'), getregtype('"')]) + defer call('setreg', ['y', getreg('y'), getregtype('y')]) + defer execute('silent bwipeout') + " Copy buffer contents for modification + silent %y y + new + " Apply ":help scratch-buffer" effects and match "$" in Java (generated) + " type names (see s:type_names) + setlocal iskeyword+=$ buftype=nofile bufhidden=hide noswapfile nohls + 0put y + " Discard text blocks and strings + silent keeppatterns %s/\\\@ 0 + let line = getline(lnum) + if line =~# '\' + let tokens = matchlist(line..getline(lnum + 1), s:package_names) + if !empty(tokens) | let s:package = tokens[1] | endif + else + let tokens = matchlist(line..getline(lnum + 1), s:type_names) + if !empty(tokens) | call add(type_names, tokens[1]) | endif + endif + let lnum = search(s:keywords, 'eW') + endwhile + return type_names + endfunction +endif + +if has('win32') + + function! s:GlobClassFiles(src_type_name) abort + return glob(a:src_type_name..'$*.class', 1, 1) + endfunction + +else + function! s:GlobClassFiles(src_type_name) abort + return glob(a:src_type_name..'\$*.class', 1, 1) + endfunction +endif + +if exists('g:spotbugs_properties') && + \ (has_key(g:spotbugs_properties, 'sourceDirPath') && + \ has_key(g:spotbugs_properties, 'classDirPath')) || + \ (has_key(g:spotbugs_properties, 'testSourceDirPath') && + \ has_key(g:spotbugs_properties, 'testClassDirPath')) + +function! s:FindClassFiles(src_type_name) abort + let class_files = [] + " Match pairwise the components of source and class pathnames + for [src_dir, bin_dir] in filter([ + \ [get(g:spotbugs_properties, 'sourceDirPath', ''), + \ get(g:spotbugs_properties, 'classDirPath', '')], + \ [get(g:spotbugs_properties, 'testSourceDirPath', ''), + \ get(g:spotbugs_properties, 'testClassDirPath', '')]], + \ '!(empty(v:val[0]) || empty(v:val[1]))') + " Since only the rightmost "src" is sought, while there can be any number of + " such filenames, no "fnamemodify(a:src_type_name, ':p:s?src?bin?')" is used + let tail_idx = strridx(a:src_type_name, src_dir) + " No such directory or no such inner type (i.e. without "$") + if tail_idx < 0 | continue | endif + " Substitute "bin_dir" for the rightmost "src_dir" + let candidate_type_name = strpart(a:src_type_name, 0, tail_idx).. + \ bin_dir.. + \ strpart(a:src_type_name, (tail_idx + strlen(src_dir))) + for candidate in insert(s:GlobClassFiles(candidate_type_name), + \ candidate_type_name..'.class') + if filereadable(candidate) | call add(class_files, shellescape(candidate)) | endif + endfor + if !empty(class_files) | break | endif + endfor + return class_files +endfunction + +else +function! s:FindClassFiles(src_type_name) abort + let class_files = [] + for candidate in insert(s:GlobClassFiles(a:src_type_name), + \ a:src_type_name..'.class') + if filereadable(candidate) | call add(class_files, shellescape(candidate)) | endif + endfor + return class_files +endfunction +endif + +function! s:CollectClassFiles() abort + " Get a platform-independent pathname prefix, cf. "expand('%:p:h')..'/'" + let pathname = expand('%:p') + let tail_idx = strridx(pathname, expand('%:t')) + let src_pathname = strpart(pathname, 0, tail_idx) + let all_class_files = [] + " Get all type names in the current buffer and let the filename globbing + " discover inner type names from arbitrary type names + for type_name in s:GetDeclaredTypeNames() + call extend(all_class_files, s:FindClassFiles(src_pathname..type_name)) + endfor + return all_class_files +endfunction + +" Expose class files for removal etc. +let b:spotbugs_class_files = s:CollectClassFiles() +let s:package_dir_heads = repeat(':h', (1 + strlen(substitute(s:package, '[^.;]', '', 'g')))) +let g:current_compiler = 'spotbugs' +" CompilerSet makeprg=spotbugs +let &l:makeprg = 'spotbugs'..(has('win32') ? '.bat' : '')..' '.. + \ get(b:, 'spotbugs_makeprg_params', get(g:, 'spotbugs_makeprg_params', '-workHard -experimental')).. + \ ' -textui -emacs -auxclasspath %:p'..s:package_dir_heads..':S -sourcepath %:p'..s:package_dir_heads..':S '.. + \ join(b:spotbugs_class_files, ' ') +" Emacs expects doubled line numbers +setlocal errorformat=%f:%l:%*[0-9]\ %m,%f:-%*[0-9]:-%*[0-9]\ %m + +" " This compiler is meant to be used for a single buffer only +" exe 'CompilerSet makeprg='..escape(&l:makeprg, ' \|"') +" exe 'CompilerSet errorformat='..escape(&l:errorformat, ' \|"') + +delfunction s:CollectClassFiles +delfunction s:FindClassFiles +delfunction s:GlobClassFiles +delfunction s:GetDeclaredTypeNames +let &cpo = s:cpo_save +unlet s:package_dir_heads s:package s:package_names s:type_names s:keywords s:cpo_save + +" vim: set foldmethod=syntax shiftwidth=2 expandtab: -- cgit From fd865fbd9229ddd4856d8913b0e452deb0bba872 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 30 Nov 2024 11:12:38 +0100 Subject: vim-patch:dd21c89: runtime(compiler): update eslint compiler compact formatter is no longer distributed with eslint, so: - switch to '--format stylish' in makeprg - update 'errorformat' for the 'stylish' format output fixes: vim/vim#16126 closes: vim/vim#16137 https://github.com/vim/vim/commit/dd21c8962680ba726ac1bf78ae106a4b6071450f Co-authored-by: Romain Lafourcade --- runtime/compiler/eslint.vim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/eslint.vim b/runtime/compiler/eslint.vim index db7a665991..0414817900 100644 --- a/runtime/compiler/eslint.vim +++ b/runtime/compiler/eslint.vim @@ -1,13 +1,12 @@ " Vim compiler file " Compiler: ESLint for JavaScript " Maintainer: Romain Lafourcade -" Last Change: 2020 August 20 -" 2024 Apr 03 by The Vim Project (removed :CompilerSet definition) +" Last Change: 2024 Nov 30 if exists("current_compiler") finish endif let current_compiler = "eslint" -CompilerSet makeprg=npx\ eslint\ --format\ compact -CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m,%-G%.%# +CompilerSet makeprg=npx\ eslint\ --format\ stylish +CompilerSet errorformat=%-P%f,\%\\s%#%l:%c\ %#\ %trror\ \ %m,\%\\s%#%l:%c\ %#\ %tarning\ \ %m,\%-Q,\%-G%.%#, -- cgit From 9d174a7dace3004a069f474ed9c8ba4f3b97c5d8 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 30 Nov 2024 12:08:46 +0100 Subject: vim-patch:9.1.0898: runtime(compiler): pytest compiler not included Problem: runtime(compiler): pytest compiler not included Solution: include pytest compiler, update the compiler completion test (Konfekt) closes: vim/vim#16130 https://github.com/vim/vim/commit/3c2596a9e967910143d41fbb9615614ab36d43a7 Co-authored-by: Konfekt --- runtime/compiler/pytest.vim | 103 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 runtime/compiler/pytest.vim (limited to 'runtime/compiler') diff --git a/runtime/compiler/pytest.vim b/runtime/compiler/pytest.vim new file mode 100644 index 0000000000..7fc189932c --- /dev/null +++ b/runtime/compiler/pytest.vim @@ -0,0 +1,103 @@ +" Vim compiler file +" Compiler: Pytest (Python testing framework) +" Maintainer: @Konfekt and @mgedmin +" Last Change: 2024 Nov 28 + +if exists("current_compiler") | finish | endif +let current_compiler = "pytest" + +let s:cpo_save = &cpo +set cpo&vim + +" CompilerSet makeprg=pytest +if has('unix') + execute $'CompilerSet makeprg=/usr/bin/env\ PYTHONWARNINGS=ignore\ pytest\ {escape(get(b:, 'pytest_makeprg_params', get(g:, 'pytest_makeprg_params', '--tb=short --quiet')), ' \|"')}' +elseif has('win32') + execute $'CompilerSet makeprg=set\ PYTHONWARNINGS=ignore\ &&\ pytest\ {escape(get(b:, 'pytest_makeprg_params', get(g:, 'pytest_makeprg_params', '--tb=short --quiet')), ' \|"')}' +else + CompilerSet makeprg=pytest\ --tb=short\ --quiet + execute $'CompilerSet makeprg=pytest\ {escape(get(b:, 'pytest_makeprg_params', get(g:, 'pytest_makeprg_params', '--tb=short --quiet')), ' \|"')}' +endif + +" Pytest syntax errors {{{2 + +" Reset error format so that sourcing .vimrc again and again doesn't grow it +" without bounds +setlocal errorformat& + +" For the record, the default errorformat is this: +" +" %*[^"]"%f"%*\D%l: %m +" "%f"%*\D%l: %m +" %-G%f:%l: (Each undeclared identifier is reported only once +" %-G%f:%l: for each function it appears in.) +" %-GIn file included from %f:%l:%c: +" %-GIn file included from %f:%l:%c\, +" %-GIn file included from %f:%l:%c +" %-GIn file included from %f:%l +" %-G%*[ ]from %f:%l:%c +" %-G%*[ ]from %f:%l: +" %-G%*[ ]from %f:%l\, +" %-G%*[ ]from %f:%l +" %f:%l:%c:%m +" %f(%l):%m +" %f:%l:%m +" "%f"\, line %l%*\D%c%*[^ ] %m +" %D%*\a[%*\d]: Entering directory %*[`']%f' +" %X%*\a[%*\d]: Leaving directory %*[`']%f' +" %D%*\a: Entering directory %*[`']%f' +" %X%*\a: Leaving directory %*[`']%f' +" %DMaking %*\a in %f +" %f|%l| %m +" +" and sometimes it misfires, so let's fix it up a bit +" (TBH I don't even know what compiler produces filename(lineno) so why even +" have it?) +setlocal errorformat-=%f(%l):%m + +" Sometimes Vim gets confused about ISO-8601 timestamps and thinks they're +" filenames; this is a big hammer that ignores anything filename-like on lines +" that start with at least two spaces, possibly preceded by a number and +" optional punctuation +setlocal errorformat^=%+G%\\d%#%.%\\=\ \ %.%# + +" Similar, but when the entire line starts with a date +setlocal errorformat^=%+G\\d\\d\\d\\d-\\d\\d-\\d\\d\ \\d\\d:\\d\\d%.%# + +" make: *** [Makefile:14: target] Error 1 +setlocal errorformat^=%+Gmake:\ ***\ %.%# + +" FAILED tests.py::test_with_params[YYYY-MM-DD:HH:MM:SS] - Exception: bla bla +setlocal errorformat^=%+GFAILED\ %.%# + +" AssertionError: assert ...YYYY-MM-DD:HH:MM:SS... +setlocal errorformat^=%+GAssertionError:\ %.%# + +" --- /path/to/file:before YYYY-MM-DD HH:MM:SS.ssssss +setlocal errorformat^=---%f:%m + +" +++ /path/to/file:before YYYY-MM-DD HH:MM:SS.ssssss +setlocal errorformat^=+++%f:%m + +" Sometimes pytest prepends an 'E' marker at the beginning of a traceback line +setlocal errorformat+=E\ %#File\ \"%f\"\\,\ line\ %l%.%# + +" Python tracebacks (unittest + doctest output) {{{2 + +" This collapses the entire traceback into just the last file+lineno, +" which is convenient when you want to jump to the line that failed (and not +" the top-level entry point), but it makes it impossible to see the full +" traceback, which sucks. +""setlocal errorformat+= +"" \File\ \"%f\"\\,\ line\ %l%.%#, +"" \%C\ %.%#, +"" \%-A\ \ File\ \"unittest%.py\"\\,\ line\ %.%#, +"" \%-A\ \ File\ \"%f\"\\,\ line\ 0%.%#, +"" \%A\ \ File\ \"%f\"\\,\ line\ %l%.%#, +"" \%Z%[%^\ ]%\\@=%m +setlocal errorformat+=File\ \"%f\"\\,\ line\ %l\\,%#%m + +exe 'CompilerSet errorformat='..escape(&l:errorformat, ' \|"') + +let &cpo = s:cpo_save +unlet s:cpo_save -- cgit From 4182e98752105eb62b412e1fb065923694e57d4d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 9 Dec 2024 20:37:36 +0100 Subject: vim-patch:b66cac1: runtime(typst): add definition lists to formatlistpat, update maintainer closes: vim/vim#16192 https://github.com/vim/vim/commit/b66cac1a8ed8636a38e867226f5bb621c96ff322 Co-authored-by: Luca Saccarola --- runtime/compiler/typst.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/typst.vim b/runtime/compiler/typst.vim index 33e55818e9..13699f4675 100644 --- a/runtime/compiler/typst.vim +++ b/runtime/compiler/typst.vim @@ -1,7 +1,8 @@ " Vim compiler file " Language: Typst -" Maintainer: Gregory Anders -" Last Change: 2024-07-14 +" Previous Maintainer: Gregory Anders +" Maintainer: Luca Saccarola +" Last Change: 2024 Dec 09 " Based on: https://github.com/kaarmu/typst.vim if exists('current_compiler') -- cgit From 48c09ed4d9edd92a7c665a62aed04e8597088e60 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 27 Dec 2024 16:26:03 +0100 Subject: vim-patch:6c57c30: runtime(compiler): include a basic bash syntax checker compiler See @saccarosium 's suggestion at https://github.com/vim/vim/pull/16311#issuecomment-2563447885 closes: vim/vim#16314 https://github.com/vim/vim/commit/6c57c30ad43f5e0d040f7d432ceb5d61fc6ab651 Co-authored-by: Konfekt --- runtime/compiler/bash.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 runtime/compiler/bash.vim (limited to 'runtime/compiler') diff --git a/runtime/compiler/bash.vim b/runtime/compiler/bash.vim new file mode 100644 index 0000000000..cbd76ae410 --- /dev/null +++ b/runtime/compiler/bash.vim @@ -0,0 +1,12 @@ +" Vim compiler file +" Compiler: Bash Syntax Checker +" Maintainer: @konfekt +" Last Change: 2024 Dec 27 + +if exists("current_compiler") + finish +endif +let current_compiler = "bash" + +CompilerSet makeprg=bash\ -n +CompilerSet errorformat=%f:\ line\ %l:\ %m -- cgit From d7426bc9e99a44e5c79a3645aa74fc2a300e3ae6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 17 Dec 2024 09:06:26 +0800 Subject: vim-patch:9.1.0935: SpotBugs compiler can be improved MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: SpotBugs compiler can be improved Solution: runtime(compiler): Improve defaults and error handling for SpotBugs; update test_compiler.vim (Aliaksei Budavei) runtime(compiler): Improve defaults and error handling for SpotBugs * Keep "spotbugs#DefaultPreCompilerTestAction()" defined but do not assign its Funcref to the "PreCompilerTestAction" key of "g:spotbugs_properties": there are no default and there can only be introduced arbitrary "*sourceDirPath" entries; therefore, this assignment is confusing at best, given that the function's implementation delegates to whatever "PreCompilerAction" is. * Allow for the possibility of relative source pathnames passed as arguments to Vim for the Javac default actions, and the necessity to have them properly reconciled when the current working directory is changed. * Do not expect users to remember or know that new source files ‘must be’ ":argadd"'d to be then known to the Javac default actions; so collect the names of Java-file buffers and Java-file Vim arguments; and let users providing the "@sources" file-lists in the "g:javac_makeprg_params" variable update these file-lists themselves. * Strive to not leave behind a fire-once Syntax ":autocmd" for a Java buffer whenever an arbitrary pre-compile action errors out. * Only attempt to run a post-compiler action in the absence of failures for a pre-compiler action. Note that warnings and failures are treated alike (?!) by the Javac compiler, so when previews are tried out with "--enable-preview", remember about passing "-Xlint:-preview" too to also let SpotBugs have a go. * Properly group conditional operators when testing for key entries in a user-defined variable. * Also test whether "javaExternal" is defined when choosing an implementation for source-file parsing. * Two commands are provided to toggle actions for buffer-local autocommands: - SpotBugsRemoveBufferAutocmd; - SpotBugsDefineBufferAutocmd. For example, try this from "~/.vim/after/ftplugin/java.vim": ------------------------------------------------------------ if exists(':SpotBugsDefineBufferAutocmd') == 2 SpotBugsDefineBufferAutocmd BufWritePost SigUSR1 endif ------------------------------------------------------------ And ":doautocmd java_spotbugs User" can be manually used at will. closes: vim/vim#16140 https://github.com/vim/vim/commit/368ef5a48c7a41af7fe2c32a5d5659e23aff63d0 Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com> --- runtime/compiler/spotbugs.vim | 153 ++++++++++++++++++++++++++++++------------ 1 file changed, 109 insertions(+), 44 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/spotbugs.vim b/runtime/compiler/spotbugs.vim index 72a5084976..10d164b6af 100644 --- a/runtime/compiler/spotbugs.vim +++ b/runtime/compiler/spotbugs.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: Spotbugs (Java static checker; needs javac compiled classes) " Maintainer: @konfekt and @zzzyxwvut -" Last Change: 2024 Nov 27 +" Last Change: 2024 Dec 14 if exists('g:current_compiler') || bufname() !~# '\.java\=$' || wordcount().chars < 9 finish @@ -24,8 +24,9 @@ let s:type_names = '\C\<\%(\.\@1 Date: Sat, 28 Dec 2024 07:32:08 +0800 Subject: vim-patch:9.1.0967: SpotBugs compiler setup can be further improved Problem: SpotBugs compiler can be further improved Solution: Introduce event-driven primitives for SpotBugs (Aliaksei Budavei) closes: vim/vim#16258 https://github.com/vim/vim/commit/2e252474c4df5018b9819d86ebb70bf3b1b1a1af Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com> --- runtime/compiler/spotbugs.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/spotbugs.vim b/runtime/compiler/spotbugs.vim index 10d164b6af..8ed45f8ee0 100644 --- a/runtime/compiler/spotbugs.vim +++ b/runtime/compiler/spotbugs.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: Spotbugs (Java static checker; needs javac compiled classes) -" Maintainer: @konfekt and @zzzyxwvut -" Last Change: 2024 Dec 14 +" Maintainers: @konfekt and @zzzyxwvut +" Last Change: 2024 Dec 20 if exists('g:current_compiler') || bufname() !~# '\.java\=$' || wordcount().chars < 9 finish -- cgit