From de672b6d7a3a8e4bd46878525f243368a849e89f Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Thu, 3 Feb 2022 16:28:27 +0100 Subject: chore(gen_vimdoc): remove duplicate extmark.c entry --- scripts/gen_vimdoc.py | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 3e9fb21039..61fa5971a4 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -96,7 +96,6 @@ CONFIG = { 'win_config.c', 'tabpage.c', 'ui.c', - 'extmark.c', ], # List of files/directories for doxygen to read, separated by blanks 'files': os.path.join(base_dir, 'src/nvim/api'), -- cgit From 03e189d1a1d34353c9385ab499e158b57c792024 Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Wed, 2 Feb 2022 21:20:50 +0100 Subject: chore(gen_vimdoc): correct minimum python version --- scripts/gen_vimdoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 61fa5971a4..36768953f9 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -52,7 +52,7 @@ import logging from xml.dom import minidom -MIN_PYTHON_VERSION = (3, 5) +MIN_PYTHON_VERSION = (3, 6) if sys.version_info < MIN_PYTHON_VERSION: print("requires Python {}.{}+".format(*MIN_PYTHON_VERSION)) -- cgit From 4d349330a7bbaa66512fd5ac359a5d761101e774 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 8 Feb 2022 10:07:00 +0800 Subject: chore(vim-patch.sh): use piping instead of here string for `while read` Using a here string can cause an error if there are no missing patches: `./scripts/vim-patch.sh: line 580: runtime_commits: bad array subscript` Using piping doesn't cause the error. --- scripts/vim-patch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 1c265f0f40..67a2cc96fd 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -576,13 +576,13 @@ show_vimpatches() { runtime_commits[$commit]=1 done - while read -r vim_commit; do + list_missing_vimpatches 1 "$@" | while read -r vim_commit; do if [[ "${runtime_commits[$vim_commit]-}" ]]; then printf ' • %s (+runtime)\n' "${vim_commit}" else printf ' • %s\n' "${vim_commit}" fi - done <<< "$(list_missing_vimpatches 1 "$@")" + done cat << EOF -- cgit From f50a9a4288012663acb4705538e82dea9a0b655c Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Fri, 11 Feb 2022 19:47:59 +0100 Subject: ci(commitlint): allow first non-space character to be a quote --- scripts/lintcommit.lua | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/lintcommit.lua b/scripts/lintcommit.lua index 0a7da4d4ef..6871858a0b 100644 --- a/scripts/lintcommit.lua +++ b/scripts/lintcommit.lua @@ -94,10 +94,24 @@ local function validate_commit(commit_message) return [[Description ends with a period (".").]] end - -- Check that description has exactly one whitespace after colon, followed by - -- a lowercase letter and then any number of letters. - if not string.match(after_colon, '^ %l%a*') then - return [[There should be one whitespace after the colon and the first letter should lowercase.]] + -- Check that description starts with a whitespace. + if after_colon:sub(1,1) ~= " " then + return [[There should be a whitespace after the colon.]] + end + + -- Check that description doesn't start with multiple whitespaces. + if after_colon:sub(1,2) == " " then + return [[There should only be one whitespace after the colon.]] + end + + -- Check that first character after space isn't uppercase. + if string.match(after_colon:sub(2,2), '%u') then + return [[First character should not be uppercase.]] + end + + -- Check that description isn't just whitespaces + if vim.trim(after_colon) == "" then + return [[Description shouldn't be empty.]] end return nil @@ -168,12 +182,14 @@ function M._test() ['ci(tui)!: message with scope and breaking change'] = true, ['vim-patch:8.2.3374: Pyret files are not recognized (#15642)'] = true, ['vim-patch:8.1.1195,8.2.{3417,3419}'] = true, + ['revert: "ci: use continue-on-error instead of "|| true""'] = true, [':no type before colon 1'] = false, [' :no type before colon 2'] = false, [' :no type before colon 3'] = false, ['ci(empty description):'] = false, - ['ci(whitespace as description): '] = false, + ['ci(only whitespace as description): '] = false, ['docs(multiple whitespaces as description): '] = false, + ['revert(multiple whitespaces and then characters as description): description'] = false, ['ci no colon after type'] = false, ['test: extra space after colon'] = false, ['ci: tab after colon'] = false, -- cgit From 991e472881bf29805982b402c1a010cde051ded3 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 28 May 2021 15:45:34 -0400 Subject: feat(lua): add api and lua autocmds --- scripts/gen_vimdoc.py | 1 + scripts/uncrustify.sh | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100755 scripts/uncrustify.sh (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 36768953f9..7b6d974181 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -95,6 +95,7 @@ CONFIG = { 'window.c', 'win_config.c', 'tabpage.c', + 'autocmd.c', 'ui.c', ], # List of files/directories for doxygen to read, separated by blanks diff --git a/scripts/uncrustify.sh b/scripts/uncrustify.sh new file mode 100755 index 0000000000..ac5d542c29 --- /dev/null +++ b/scripts/uncrustify.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -e + +# Check that you have uncrustify +hash uncrustify + +COMMITISH="${1:-master}" +for file in $(git diff --diff-filter=d --name-only $COMMITISH | grep '\.[ch]$'); do + uncrustify -c src/uncrustify.cfg -l C --replace --no-backup "$file" +done -- cgit From 0ec92bb4634ef19798eef065fdef3d6afb43ccc5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 5 Mar 2022 10:11:31 +0800 Subject: feat(vim-patch.sh): support additional args for -s This allows creating a draft vim-patch PR. --- scripts/vim-patch.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 67a2cc96fd..591c658e6b 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -36,7 +36,7 @@ usage() { echo " can be a Vim version (8.0.xxx) or a Git hash." echo " -P {vim-revision} Download, generate and apply a Vim patch." echo " -g {vim-revision} Download a Vim patch." - echo " -s Create a vim-patch pull request." + echo " -s [pr args] Create a vim-patch pull request." echo " -r {pr-number} Review a vim-patch pull request." echo " -V Clone the Vim source code to \$VIM_SOURCE_DIR." echo @@ -329,7 +329,8 @@ stage_patch() { * Do this only for _related_ patches (otherwise it increases the size of the pull request, making it harder to review) - When you are done, try "%s -s" to create the pull request. + When you are done, try "%s -s" to create the pull request, + or "%s -s --draft" to create a draft pull request. See the wiki for more information: * https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim @@ -338,13 +339,19 @@ stage_patch() { } gh_pr() { - gh pr create --title "$1" --body "$2" + local pr_title + local pr_body + pr_title="$1" + pr_body="$2" + shift 2 + gh pr create --title "${pr_title}" --body "${pr_body}" "$@" } git_hub_pr() { local pr_message pr_message="$(printf '%s\n\n%s\n' "$1" "$2")" - git hub pull new -m "${pr_message}" + shift 2 + git hub pull new -m "${pr_message}" "$@" } submit_pr() { @@ -408,7 +415,7 @@ submit_pr() { fi echo "Creating pull request." - if output="$($submit_fn "$pr_title" "$pr_body" 2>&1)"; then + if output="$($submit_fn "$pr_title" "$pr_body" "$@" 2>&1)"; then msg_ok "$output" else msg_err "$output" @@ -799,7 +806,8 @@ while getopts "hlLmMVp:P:g:r:s" opt; do exit 0 ;; s) - submit_pr + shift # remove opt + submit_pr "$@" exit 0 ;; V) -- cgit From 80e6f81862d943b2d31639a0e437b6abdff3373c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 6 Mar 2022 21:16:21 +0800 Subject: docs(lua): reference runtime/lua/vim/_editor.lua --- scripts/gen_vimdoc.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 7b6d974181..af49d57492 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -124,7 +124,7 @@ CONFIG = { 'filename': 'lua.txt', 'section_start_token': '*lua-vim*', 'section_order': [ - 'vim.lua', + '_editor.lua', 'shared.lua', 'uri.lua', 'ui.lua', @@ -132,7 +132,7 @@ CONFIG = { 'keymap.lua', ], 'files': ' '.join([ - os.path.join(base_dir, 'src/nvim/lua/vim.lua'), + os.path.join(base_dir, 'runtime/lua/vim/_editor.lua'), os.path.join(base_dir, 'runtime/lua/vim/shared.lua'), os.path.join(base_dir, 'runtime/lua/vim/uri.lua'), os.path.join(base_dir, 'runtime/lua/vim/ui.lua'), @@ -144,9 +144,18 @@ CONFIG = { 'section_name': { 'lsp.lua': 'core', }, - 'section_fmt': lambda name: f'Lua module: {name.lower()}', - 'helptag_fmt': lambda name: f'*lua-{name.lower()}*', - 'fn_helptag_fmt': lambda fstem, name: f'*{fstem}.{name}()*', + 'section_fmt': lambda name: ( + 'Lua module: vim' + if name.lower() == '_editor' + else f'Lua module: {name.lower()}'), + 'helptag_fmt': lambda name: ( + '*lua-vim*' + if name.lower() == '_editor' + else f'*lua-{name.lower()}*'), + 'fn_helptag_fmt': lambda fstem, name: ( + f'*vim.{name}()*' + if fstem.lower() == '_editor' + else f'*{fstem}.{name}()*'), 'module_override': { # `shared` functions are exposed on the `vim` module. 'shared': 'vim', -- cgit From 46a0cec3a63e76fa0cd7006021240acb14e1d0b5 Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Mon, 7 Mar 2022 23:24:50 +0100 Subject: chore(stripdecls): remove unused and no longer functional script --- scripts/stripdecls.py | 140 -------------------------------------------------- 1 file changed, 140 deletions(-) delete mode 100755 scripts/stripdecls.py (limited to 'scripts') diff --git a/scripts/stripdecls.py b/scripts/stripdecls.py deleted file mode 100755 index b4ac34dcfe..0000000000 --- a/scripts/stripdecls.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/python -# vim: set fileencoding=utf-8: - -from __future__ import print_function, unicode_literals, division - -from clang.cindex import Index, CursorKind -from collections import namedtuple, OrderedDict, defaultdict -import sys -import os - - -DECL_KINDS = { - CursorKind.FUNCTION_DECL, -} - - -Strip = namedtuple('Strip', 'start_line start_column end_line end_column') - - -def main(progname, cfname, only_static, move_all): - cfname = os.path.abspath(os.path.normpath(cfname)) - - hfname1 = os.path.splitext(cfname)[0] + os.extsep + 'h' - hfname2 = os.path.splitext(cfname)[0] + '_defs' + os.extsep + 'h' - - files_to_modify = (cfname, hfname1, hfname2) - - index = Index.create() - src_dirname = os.path.join(os.path.dirname(__file__), '..', 'src') - src_dirname = os.path.abspath(os.path.normpath(src_dirname)) - relname = os.path.join(src_dirname, 'nvim') - unit = index.parse(cfname, args=('-I' + src_dirname, - '-DUNIX', - '-DEXITFREE', - '-DFEAT_USR_CMDS', - '-DFEAT_CMDL_COMPL', - '-DFEAT_COMPL_FUNC', - '-DPROTO', - '-DUSE_MCH_ERRMSG')) - cursor = unit.cursor - - tostrip = defaultdict(OrderedDict) - definitions = set() - - for child in cursor.get_children(): - if not (child.location and child.location.file): - continue - fname = os.path.abspath(os.path.normpath(child.location.file.name)) - if fname not in files_to_modify: - continue - if child.kind not in DECL_KINDS: - continue - if only_static and next(child.get_tokens()).spelling == 'static': - continue - - if child.is_definition() and fname == cfname: - definitions.add(child.spelling) - else: - stripdict = tostrip[fname] - assert(child.spelling not in stripdict) - stripdict[child.spelling] = Strip( - child.extent.start.line, - child.extent.start.column, - child.extent.end.line, - child.extent.end.column, - ) - - for (fname, stripdict) in tostrip.items(): - if not move_all: - for name in set(stripdict) - definitions: - stripdict.pop(name) - - if not stripdict: - continue - - if fname.endswith('.h'): - is_h_file = True - include_line = next(reversed(stripdict.values())).start_line + 1 - else: - is_h_file = False - include_line = next(iter(stripdict.values())).start_line - - lines = None - generated_existed = os.path.exists(fname + '.generated.h') - with open(fname, 'rb') as F: - lines = list(F) - - stripped = [] - - for name, position in reversed(stripdict.items()): - sl = slice(position.start_line - 1, position.end_line) - if is_h_file: - include_line -= sl.stop - sl.start - stripped += lines[sl] - lines[sl] = () - - if not generated_existed: - lines[include_line:include_line] = [ - '#ifdef INCLUDE_GENERATED_DECLARATIONS\n', - '# include "{0}.generated.h"\n'.format( - os.path.relpath(fname, relname)), - '#endif\n', - ] - - with open(fname, 'wb') as F: - F.writelines(lines) - - -if __name__ == '__main__': - progname = sys.argv[0] - args = sys.argv[1:] - if not args or '--help' in args: - print('Usage:') - print('') - print(' {0} [--static [--all]] file.c...'.format(progname)) - print('') - print('Stripts all declarations from file.c, file.h and file_defs.h.') - print('If --static argument is given then only static declarations are') - print('stripped. Declarations are stripped only if corresponding') - print('definition is found unless --all argument was given.') - print('') - print('Note: it is assumed that static declarations starts with "static"') - print(' keyword.') - sys.exit(0 if args else 1) - - if args[0] == '--static': - only_static = True - args = args[1:] - else: - only_static = False - - if args[0] == '--all': - move_all = True - args = args[1:] - else: - move_all = False - - for cfname in args: - print('Processing {0}'.format(cfname)) - main(progname, cfname, only_static, move_all) -- cgit From 2d28c40ef9842ab7cfb9b307bfc07b1d11c7aca8 Mon Sep 17 00:00:00 2001 From: Daiki Mizukami Date: Sun, 13 Mar 2022 21:03:38 +0900 Subject: refactor(gen_vimdoc): detect `section_start_token` automatically --- scripts/gen_vimdoc.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index af49d57492..2b119bc589 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -84,8 +84,6 @@ CONFIG = { 'api': { 'mode': 'c', 'filename': 'api.txt', - # String used to find the start of the generated part of the doc. - 'section_start_token': '*api-global*', # Section ordering. 'section_order': [ 'vim.c', @@ -122,7 +120,6 @@ CONFIG = { 'lua': { 'mode': 'lua', 'filename': 'lua.txt', - 'section_start_token': '*lua-vim*', 'section_order': [ '_editor.lua', 'shared.lua', @@ -171,7 +168,6 @@ CONFIG = { 'lsp': { 'mode': 'lua', 'filename': 'lsp.txt', - 'section_start_token': '*lsp-core*', 'section_order': [ 'lsp.lua', 'buf.lua', @@ -214,7 +210,6 @@ CONFIG = { 'diagnostic': { 'mode': 'lua', 'filename': 'diagnostic.txt', - 'section_start_token': '*diagnostic-api*', 'section_order': [ 'diagnostic.lua', ], @@ -231,7 +226,6 @@ CONFIG = { 'treesitter': { 'mode': 'lua', 'filename': 'treesitter.txt', - 'section_start_token': '*lua-treesitter-core*', 'section_order': [ 'treesitter.lua', 'language.lua', @@ -1096,6 +1090,7 @@ def main(config, args): raise RuntimeError( 'found new modules "{}"; update the "section_order" map'.format( set(sections).difference(CONFIG[target]['section_order']))) + first_section_tag = sections[CONFIG[target]['section_order'][0]][1] docs = '' @@ -1121,7 +1116,7 @@ def main(config, args): doc_file = os.path.join(base_dir, 'runtime', 'doc', CONFIG[target]['filename']) - delete_lines_below(doc_file, CONFIG[target]['section_start_token']) + delete_lines_below(doc_file, first_section_tag) with open(doc_file, 'ab') as fp: fp.write(docs.encode('utf8')) -- cgit From cf4786ddfae40a3a0d00e52f4861a2c7ee19e243 Mon Sep 17 00:00:00 2001 From: Daiki Mizukami Date: Sun, 13 Mar 2022 21:13:42 +0900 Subject: chore(gen_vimdoc): call `delete_lines_below` only if the file exists Previously, `delete_lines_below` would raise `FileNotFoundError` when adding a new file to `CONFIG` and you had to manually write a file with help tag of the first section as placeholder. This change relieves you of that need. --- scripts/gen_vimdoc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 2b119bc589..a537f80aca 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -1116,7 +1116,8 @@ def main(config, args): doc_file = os.path.join(base_dir, 'runtime', 'doc', CONFIG[target]['filename']) - delete_lines_below(doc_file, first_section_tag) + if os.path.exists(doc_file): + delete_lines_below(doc_file, first_section_tag) with open(doc_file, 'ab') as fp: fp.write(docs.encode('utf8')) -- cgit From 334a16c79113eec1cb9024a71631e1baa4473582 Mon Sep 17 00:00:00 2001 From: Daiki Mizukami Date: Sun, 13 Mar 2022 21:30:06 +0900 Subject: refactor(gen_vimdoc): simplify `files` in `CONFIG` --- scripts/gen_vimdoc.py | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index a537f80aca..433fec828e 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -96,8 +96,8 @@ CONFIG = { 'autocmd.c', 'ui.c', ], - # List of files/directories for doxygen to read, separated by blanks - 'files': os.path.join(base_dir, 'src/nvim/api'), + # List of files/directories for doxygen to read, relative to `base_dir` + 'files': ['src/nvim/api'], # file patterns used by doxygen 'file_patterns': '*.h *.c', # Only function with this prefix are considered @@ -128,14 +128,14 @@ CONFIG = { 'filetype.lua', 'keymap.lua', ], - 'files': ' '.join([ - os.path.join(base_dir, 'runtime/lua/vim/_editor.lua'), - os.path.join(base_dir, 'runtime/lua/vim/shared.lua'), - os.path.join(base_dir, 'runtime/lua/vim/uri.lua'), - os.path.join(base_dir, 'runtime/lua/vim/ui.lua'), - os.path.join(base_dir, 'runtime/lua/vim/filetype.lua'), - os.path.join(base_dir, 'runtime/lua/vim/keymap.lua'), - ]), + 'files': [ + 'runtime/lua/vim/_editor.lua', + 'runtime/lua/vim/shared.lua', + 'runtime/lua/vim/uri.lua', + 'runtime/lua/vim/ui.lua', + 'runtime/lua/vim/filetype.lua', + 'runtime/lua/vim/keymap.lua', + ], 'file_patterns': '*.lua', 'fn_name_prefix': '', 'section_name': { @@ -181,10 +181,10 @@ CONFIG = { 'sync.lua', 'protocol.lua', ], - 'files': ' '.join([ - os.path.join(base_dir, 'runtime/lua/vim/lsp'), - os.path.join(base_dir, 'runtime/lua/vim/lsp.lua'), - ]), + 'files': [ + 'runtime/lua/vim/lsp', + 'runtime/lua/vim/lsp.lua', + ], 'file_patterns': '*.lua', 'fn_name_prefix': '', 'section_name': {'lsp.lua': 'lsp'}, @@ -213,7 +213,7 @@ CONFIG = { 'section_order': [ 'diagnostic.lua', ], - 'files': os.path.join(base_dir, 'runtime/lua/vim/diagnostic.lua'), + 'files': ['runtime/lua/vim/diagnostic.lua'], 'file_patterns': '*.lua', 'fn_name_prefix': '', 'section_name': {'diagnostic.lua': 'diagnostic'}, @@ -233,10 +233,10 @@ CONFIG = { 'highlighter.lua', 'languagetree.lua', ], - 'files': ' '.join([ - os.path.join(base_dir, 'runtime/lua/vim/treesitter.lua'), - os.path.join(base_dir, 'runtime/lua/vim/treesitter/'), - ]), + 'files': [ + 'runtime/lua/vim/treesitter.lua', + 'runtime/lua/vim/treesitter/', + ], 'file_patterns': '*.lua', 'fn_name_prefix': '', 'section_name': {}, @@ -1000,7 +1000,8 @@ def main(config, args): stderr=(subprocess.STDOUT if debug else subprocess.DEVNULL)) p.communicate( config.format( - input=CONFIG[target]['files'], + input=' '.join( + [f'"{file}"' for file in CONFIG[target]['files']]), output=output_dir, filter=filter_cmd, file_patterns=CONFIG[target]['file_patterns']) -- cgit From be2def41006f1f6395be546cc95c3ada32e7966a Mon Sep 17 00:00:00 2001 From: Daiki Mizukami Date: Sun, 13 Mar 2022 21:36:46 +0900 Subject: chore(gen_vimdoc): fall back to `brief_desc_node` when `desc_node` is empty --- scripts/gen_vimdoc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 433fec828e..1b7f88cb2a 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -843,7 +843,9 @@ def extract_from_xml(filename, target, width): 'seealso': [], } if fmt_vimhelp: - fn['desc_node'] = desc # HACK :( + # HACK :( + fn['desc_node'] = desc + fn['brief_desc_node'] = brief_desc for m in paras: if 'text' in m: @@ -891,6 +893,8 @@ def fmt_doxygen_xml_as_vimhelp(filename, target): # Generate Vim :help for parameters. if fn['desc_node']: doc = fmt_node_as_vimhelp(fn['desc_node']) + if not doc and fn['brief_desc_node']: + doc = fmt_node_as_vimhelp(fn['brief_desc_node']) if not doc: doc = 'TODO: Documentation' -- cgit From ecc36c3d1c3952541eb1ad667850573ecedd4d36 Mon Sep 17 00:00:00 2001 From: Daiki Mizukami Date: Sun, 13 Mar 2022 21:48:14 +0900 Subject: docs: remove extra whitespaces --- scripts/gen_vimdoc.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 1b7f88cb2a..7152f1005f 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -343,14 +343,6 @@ def self_or_child(n): return n.childNodes[0] -def clean_text(text): - """Cleans text. - - Only cleans superfluous whitespace at the moment. - """ - return ' '.join(text.split()).strip() - - def clean_lines(text): """Removes superfluous lines. @@ -371,12 +363,12 @@ def get_text(n, preformatted=False): if n.nodeName == 'computeroutput': for node in n.childNodes: text += get_text(node) - return '`{}` '.format(text) + return '`{}`'.format(text) for node in n.childNodes: if node.nodeType == node.TEXT_NODE: - text += node.data if preformatted else clean_text(node.data) + text += node.data elif node.nodeType == node.ELEMENT_NODE: - text += ' ' + get_text(node, preformatted) + text += get_text(node, preformatted) return text -- cgit From 00effff56944d5b59440dcdb5e3496d49a76d3e2 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 18 Mar 2022 04:47:08 +0000 Subject: vim-patch:8.1.1693: syntax coloring and highlighting is in one big file (#17721) Problem: Syntax coloring and highlighting is in one big file. Solution: Move the highlighting to a separate file. (Yegappan Lakshmanan, closes vim/vim#4674) https://github.com/vim/vim/commit/f9cc9f209ede9f15959e4c2351e970477c139614 Name the new file highlight_group.c instead. Co-authored-by: zeertzjq --- scripts/vim-patch.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 591c658e6b..c68ab3a751 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -236,6 +236,10 @@ preprocess_patch() { LC_ALL=C sed -e 's/\( [ab]\/src\/nvim\)\/session\(\.[ch]\)/\1\/ex_session\2/g' \ "$file" > "$file".tmp && mv "$file".tmp "$file" + # Rename highlight.c to highlight_group.c + LC_ALL=C sed -e 's/\( [ab]\/src\/nvim\)\/highlight\(\.[ch]\)/\1\/highlight_group\2/g' \ + "$file" > "$file".tmp && mv "$file".tmp "$file" + # Rename test_urls.vim to check_urls.vim LC_ALL=C sed -e 's@\( [ab]\)/runtime/doc/test\(_urls.vim\)@\1/scripts/check\2@g' \ "$file" > "$file".tmp && mv "$file".tmp "$file" -- cgit From 0d2674a3c5a6472c425355a29183dcf221a6409b Mon Sep 17 00:00:00 2001 From: Abraham Francis Date: Thu, 7 Apr 2022 21:11:48 +0530 Subject: ci: add script to bump versions (#17884) * ci: add script for bumping dependencies * docs: add usage information for bump-deps.sh --- scripts/bump-deps.sh | 104 +++++++++++++++ scripts/bump_deps.lua | 343 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 447 insertions(+) create mode 100755 scripts/bump-deps.sh create mode 100644 scripts/bump_deps.lua (limited to 'scripts') diff --git a/scripts/bump-deps.sh b/scripts/bump-deps.sh new file mode 100755 index 0000000000..85c7f72700 --- /dev/null +++ b/scripts/bump-deps.sh @@ -0,0 +1,104 @@ +#!/usr/bin/env bash +set -e +set -u +# Use privileged mode, which e.g. skips using CDPATH. +set -p + +# Ensure that the user has a bash that supports -A +if [[ "${BASH_VERSINFO[0]}" -lt 4 ]]; then + echo >&2 "error: script requires bash 4+ (you have ${BASH_VERSION})." + exit 1 +fi + +readonly NVIM_SOURCE_DIR="${NVIM_SOURCE_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" +readonly VIM_SOURCE_DIR_DEFAULT="${NVIM_SOURCE_DIR}/.vim-src" +readonly VIM_SOURCE_DIR="${VIM_SOURCE_DIR:-${VIM_SOURCE_DIR_DEFAULT}}" +BASENAME="$(basename "${0}")" +readonly BASENAME + +usage() { + echo "Bump Neovim dependencies" + echo + echo "Usage: ${BASENAME} [ -h | --pr | --branch= | --dep= ]" + echo + echo "Options:" + echo " -h show this message and exit." + echo " --pr submit pr for bumping deps." + echo " --branch= create a branch bump- from current branch." + echo " --dep= bump to a specific release or tag." + echo + echo "Dependency Options:" + echo " --version= bump to a specific release or tag." + echo " --commit= bump to a specific commit." + echo " --HEAD bump to a current head." + echo + echo " is one of:" + echo " \"LuaJIT\", \"libuv\", \"Luv\", \"tree-sitter\"" +} + +# Checks if a program is in the user's PATH, and is executable. +check_executable() { + test -x "$(command -v "${1}")" +} + +require_executable() { + if ! check_executable "${1}"; then + echo >&2 "${BASENAME}: '${1}' not found in PATH or not executable." + exit 1 + fi +} + +require_executable "nvim" + +if [ $# -eq 0 ]; then + usage + exit 1 +fi + +PARSED_ARGS=$(getopt -a -n "$BASENAME" -o h --long pr,branch:,dep:,version:,commit:,HEAD -- "$@") + +DEPENDENCY="" +eval set -- "$PARSED_ARGS" +while :; do + case "$1" in + -h) + usage + exit 0 + ;; + --pr) + nvim -es +"lua require('scripts.bump_deps').submit_pr()" + exit 0 + ;; + --branch) + DEP=$2 + nvim -es +"lua require('scripts.bump_deps').create_branch('$DEP')" + exit 0 + ;; + --dep) + DEPENDENCY=$2 + shift 2 + ;; + --version) + VERSION=$2 + nvim -es +"lua require('scripts.bump_deps').version('$DEPENDENCY', '$VERSION')" + exit 0 + ;; + --commit) + COMMIT=$2 + nvim -es +"lua require('scripts.bump_deps').commit('$DEPENDENCY', '$COMMIT')" + exit 0 + ;; + --HEAD) + nvim -es +"lua require('scripts.bump_deps').head('$DEPENDENCY')" + exit 0 + ;; + *) + break + ;; + esac +done + +usage +exit 1 + +# vim: et sw=2 diff --git a/scripts/bump_deps.lua b/scripts/bump_deps.lua new file mode 100644 index 0000000000..2ecbb2e658 --- /dev/null +++ b/scripts/bump_deps.lua @@ -0,0 +1,343 @@ +-- Usage: +-- # bump to version +-- nvim -es +"lua require('scripts.bump_deps').version(dependency, version_tag)" +-- +-- # bump to commit +-- nvim -es +"lua require('scripts.bump_deps').commit(dependency, commit_hash)" +-- +-- # bump to HEAD +-- nvim -es +"lua require('scripts.bump_deps').head(dependency)" +-- +-- # submit PR +-- nvim -es +"lua require('scripts.bump_deps').submit_pr()" +-- +-- # create branch +-- nvim -es +"lua require('scripts.bump_deps').create_branch()" + +local M = {} + +local _trace = false +local required_branch_prefix = "bump-" +local commit_prefix = "build(deps): " + +-- Print message +local function p(s) + vim.cmd("set verbose=1") + vim.api.nvim_echo({ { s, "" } }, false, {}) + vim.cmd("set verbose=0") +end + +local function die() + p("") + vim.cmd("cquit 1") +end + +-- Executes and returns the output of `cmd`, or nil on failure. +-- if die_on_fail is true, process dies with die_msg on failure +-- +-- Prints `cmd` if `trace` is enabled. +local function _run(cmd, die_on_fail, die_msg) + if _trace then + p("run: " .. vim.inspect(cmd)) + end + local rv = vim.trim(vim.fn.system(cmd)) or "" + if vim.v.shell_error ~= 0 then + if die_on_fail then + if _trace then + p(rv) + end + p(die_msg) + die() + end + return nil + end + return rv +end + +-- Run a command, return nil on failure +local function run(cmd) + return _run(cmd, false, "") +end + +-- Run a command, die on failure with err_msg +local function run_die(cmd, err_msg) + return _run(cmd, true, err_msg) +end + +local function require_executable(cmd) + local cmd_path = run_die({ "command", "-v", cmd }, cmd .. " not found!") + run_die({ "test", "-x", cmd_path }, cmd .. " is not executable") +end + +local function rm_file_if_present(path_to_file) + run({ "rm", "-f", path_to_file }) +end + +local nvim_src_dir = vim.fn.getcwd() +local temp_dir = nvim_src_dir .. "/tmp" +run({ "mkdir", "-p", temp_dir }) + +local function get_dependency(dependency_name) + local dependency_table = { + ["LuaJIT"] = { + repo = "LuaJIT/LuaJIT", + symbol = "LUAJIT", + }, + ["libuv"] = { + repo = "libuv/libuv", + symbol = "LIBUV", + }, + ["Luv"] = { + repo = "luvit/luv", + symbol = "LUV", + }, + ["tree-sitter"] = { + repo = "tree-sitter/tree-sitter", + symbol = "TREESITTER", + }, + } + local dependency = dependency_table[dependency_name] + if dependency == nil then + p("Not a dependency: " .. dependency_name) + die() + end + dependency.name = dependency_name + return dependency +end + +local function get_gh_commit_sha(repo, ref) + require_executable("gh") + + local sha = run_die( + { "gh", "api", "repos/" .. repo .. "/commits/" .. ref, "--jq", ".sha" }, + "Failed to get commit hash from GitHub. Not a valid ref?" + ) + return sha +end + +local function get_archive_info(repo, ref) + require_executable("curl") + + local archive_name = ref .. ".tar.gz" + local archive_path = temp_dir .. "/" .. archive_name + local archive_url = "https://github.com/" .. repo .. "/archive/" .. archive_name + + rm_file_if_present(archive_path) + run_die({ "curl", "-sL", archive_url, "-o", archive_path }, "Failed to download archive from GitHub") + + local archive_sha = run({ "sha256sum", archive_path }):gmatch("%w+")() + return { url = archive_url, sha = archive_sha } +end + +local function write_cmakelists_line(symbol, kind, value) + require_executable("sed") + + local cmakelists_path = nvim_src_dir .. "/" .. "third-party/CMakeLists.txt" + run_die({ + "sed", + "-i", + "-e", + "s/set(" .. symbol .. "_" .. kind .. ".*$" .. "/set(" .. symbol .. "_" .. kind .. " " .. value .. ")" .. "/", + cmakelists_path, + }, "Failed to write " .. cmakelists_path) +end + +local function explicit_create_branch(dep) + require_executable("git") + + local checked_out_branch = run({ "git", "rev-parse", "--abbrev-ref", "HEAD" }) + if checked_out_branch ~= "master" then + p("Not on master!") + die() + end + run_die({ "git", "checkout", "-b", "bump-" .. dep }, "git failed to create branch") +end + +local function verify_branch(new_branch_suffix) + require_executable("git") + + local checked_out_branch = run({ "git", "rev-parse", "--abbrev-ref", "HEAD" }) + if not checked_out_branch:match("^" .. required_branch_prefix) then + p("Current branch '" .. checked_out_branch .. "' doesn't seem to start with " .. required_branch_prefix) + p("Checking out to bump-" .. new_branch_suffix) + explicit_create_branch(new_branch_suffix) + end +end + +local function update_cmakelists(dependency, archive, comment) + require_executable("git") + + verify_branch(dependency.name) + + local changed_file = nvim_src_dir .. "/" .. "third-party/CMakeLists.txt" + + p("Updating " .. dependency.name .. " to " .. archive.url .. "\n") + write_cmakelists_line(dependency.symbol, "URL", archive.url:gsub("/", "\\/")) + write_cmakelists_line(dependency.symbol, "SHA256", archive.sha) + run_die( + { "git", "commit", changed_file, "-m", commit_prefix .. "bump " .. dependency.name .. " to " .. comment }, + "git failed to commit" + ) +end + +local function verify_cmakelists_committed() + require_executable("git") + + local cmakelists_path = nvim_src_dir .. "/" .. "third-party/CMakeLists.txt" + run_die({ "git", "diff", "--quiet", "HEAD", "--", cmakelists_path }, cmakelists_path .. " has uncommitted changes") +end + +local function warn_luv_symbol() + p("warning: " .. get_dependency("Luv").symbol .. "_VERSION will not be updated") +end + +-- return first 9 chars of commit +local function short_commit(commit) + return string.sub(commit, 1, 9) +end + +-- TODO: remove hardcoded fork +local function gh_pr(pr_title, pr_body) + require_executable("gh") + + local pr_url = run_die({ + "gh", + "pr", + "create", + "--title", + pr_title, + "--body", + pr_body, + }, "Failed to create PR") + return pr_url +end + +local function find_git_remote(fork) + require_executable("git") + + local remotes = run({ "git", "remote", "-v" }) + local git_remote = "" + for remote in remotes:gmatch("[^\r\n]+") do + local words = {} + for word in remote:gmatch("%w+") do + table.insert(words, word) + end + local match = words[1]:match("/github.com[:/]neovim/neovim/") + if fork == "fork" then + match = not match + end + if match and words[3] == "(fetch)" then + git_remote = words[0] + break + end + end + if git_remote == "" then + git_remote = "origin" + end + return git_remote +end + +local function create_pr(pr_title, pr_body) + require_executable("git") + + local push_first = true + + local checked_out_branch = run({ "git", "rev-parse", "--abbrev-ref", "HEAD" }) + if push_first then + local push_remote = run({ "git", "config", "--get", "branch." .. checked_out_branch .. ".pushRemote" }) + if push_remote == nil then + push_remote = run({ "git", "config", "--get", "remote.pushDefault" }) + if push_remote == nil then + push_remote = run({ "git", "config", "--get", "branch." .. checked_out_branch .. ".remote" }) + if push_remote == nil or push_remote == find_git_remote(nil) then + push_remote = find_git_remote("fork") + end + end + end + + p("Pushing to " .. push_remote .. "/" .. checked_out_branch) + run_die({ "git", "push", push_remote, checked_out_branch }, "Git failed to push") + end + + local pr_url = gh_pr(pr_title, pr_body) + p("\nCreated PR: " .. pr_url .. "\n") +end + +function M.commit(dependency_name, commit) + local dependency = get_dependency(dependency_name) + verify_cmakelists_committed() + local commit_sha = get_gh_commit_sha(dependency.repo, commit) + if commit_sha ~= commit then + p("Not a commit: " .. commit .. ". Did you mean version?") + die() + end + local archive = get_archive_info(dependency.repo, commit) + if dependency_name == "Luv" then + warn_luv_symbol() + end + update_cmakelists(dependency, archive, short_commit(commit)) +end + +function M.version(dependency_name, version) + local dependency = get_dependency(dependency_name) + verify_cmakelists_committed() + local commit_sha = get_gh_commit_sha(dependency.repo, version) + if commit_sha == version then + p("Not a version: " .. version .. ". Did you mean commit?") + die() + end + local archive = get_archive_info(dependency.repo, version) + if dependency_name == "Luv" then + write_cmakelists_line(dependency.symbol, "VERSION", version) + end + update_cmakelists(dependency, archive, version) +end + +function M.head(dependency_name) + local dependency = get_dependency(dependency_name) + verify_cmakelists_committed() + local commit_sha = get_gh_commit_sha(dependency.repo, "HEAD") + local archive = get_archive_info(dependency.repo, commit_sha) + if dependency_name == "Luv" then + warn_luv_symbol() + end + update_cmakelists(dependency, archive, "HEAD - " .. short_commit(commit_sha)) +end + +function M.create_branch(dep) + explicit_create_branch(dep) +end + +function M.submit_pr() + require_executable("git") + + verify_branch("deps") + + local nvim_remote = find_git_remote(nil) + local relevant_commit = run_die({ + "git", + "log", + "--grep=" .. commit_prefix, + "--reverse", + "--format='%s'", + nvim_remote .. "/master..HEAD", + "-1", + }, "Failed to fetch commits") + + local pr_title + local pr_body + + if relevant_commit == "" then + pr_title = commit_prefix .. "bump some dependencies" + pr_body = "bump some dependencies" + else + relevant_commit = relevant_commit:gsub("'", "") + pr_title = relevant_commit + pr_body = relevant_commit:gsub(commit_prefix:gsub("%(", "%%("):gsub("%)", "%%)"), "") + end + pr_body = pr_body .. "\n\n(add explanations if needed)" + p(pr_title .. "\n" .. pr_body .. "\n") + create_pr(pr_title, pr_body) +end + +return M -- cgit From 8f95f3ea0612d1887f68c9663ee6bc831168a04e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 11 Apr 2022 14:41:26 +0800 Subject: fix(vim-patch.sh): fix N/A files patterns (#18073) --- scripts/vim-patch.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index c68ab3a751..57f51d9d46 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -190,8 +190,8 @@ preprocess_patch() { 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/\<\%('"${na_files}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" # Remove *.proto, Make*, INSTALL*, gui_*, beval.*, some if_*, gvim, libvterm, tee, VisVim, xpm, xxd - local na_src='auto\|configure.*\|GvimExt\|libvterm\|proto\|tee\|VisVim\|xpm\|xxd\|Make*\|INSTALL*\|beval.*\|gui_*\|if_lua\|if_mzsch\|if_olepp\|if_ole\|if_perl\|if_py\|if_ruby\|if_tcl\|if_xcmdsrv' - 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%(testdir/\)\@/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%(testdir/\)\@@norm! d/\v(^diff)|%$ ' +w +q "$file" # Remove unwanted Vim doc files. local na_doc='channel\.txt\|netbeans\.txt\|os_\w\+\.txt\|term\.txt\|todo\.txt\|version\d\.txt\|vim9\.txt\|sponsor\.txt\|intro\.txt\|tags' @@ -201,19 +201,18 @@ preprocess_patch() { 2>/dev/null $nvim --cmd 'set dir=/tmp' +'%s/^@@.*\n.*For Vim version.*Last change.*\n.*For Vim version.*Last change.*//' +w +q "$file" # Remove gui, option, setup, screen dumps, testdir/Make_*.mak files - local na_src_testdir='gen_opt_test.vim\|gui_.*\|Make_amiga.mak\|Make_dos.mak\|Make_ming.mak\|Make_vms.mms\|dumps/.*.dump\|setup_gui.vim' + local na_src_testdir='gen_opt_test\.vim\|gui_.*\|Make_amiga\.mak\|Make_dos\.mak\|Make_ming\.mak\|Make_vms\.mms\|dumps/.*\.dump\|setup_gui\.vim' 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<\%('"${na_src_testdir}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" # Remove testdir/test_*.vim files - local na_src_testdir='balloon.*\|channel.*\|crypt.vim\|gui.*\|job_fails.vim\|json.vim\|mzscheme.vim\|netbeans.*\|paste.vim\|popupwin.*\|restricted.vim\|shortpathname.vim\|tcl.vim\|terminal.*\|xxd.vim' + local na_src_testdir='balloon.*\|channel.*\|crypt\.vim\|gui.*\|job_fails\.vim\|json\.vim\|mzscheme\.vim\|netbeans.*\|paste\.vim\|popupwin.*\|restricted\.vim\|shortpathname\.vim\|tcl\.vim\|terminal.*\|xxd\.vim' 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\@norm! d/\v(^diff)|%$ ' +w +q "$file" # Remove version.c #7555 - local na_po='version.c' - 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\<\%('${na_po}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\<\%(version\.c\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" # Remove some *.po files. #5622 - local na_po='sjiscorr.c\|ja.sjis.po\|ko.po\|pl.cp1250.po\|pl.po\|ru.cp1251.po\|uk.cp1251.po\|zh_CN.cp936.po\|zh_CN.po\|zh_TW.po' + local na_po='sjiscorr\.c\|ja\.sjis\.po\|ko\.po\|pl\.cp1250\.po\|pl\.po\|ru\.cp1251\.po\|uk\.cp1251\.po\|zh_CN\.cp936\.po\|zh_CN\.po\|zh_TW\.po' 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/po/\<\%('${na_po}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" # Remove vimrc_example.vim @@ -241,11 +240,11 @@ preprocess_patch() { "$file" > "$file".tmp && mv "$file".tmp "$file" # Rename test_urls.vim to check_urls.vim - LC_ALL=C sed -e 's@\( [ab]\)/runtime/doc/test\(_urls.vim\)@\1/scripts/check\2@g' \ + LC_ALL=C sed -e 's@\( [ab]\)/runtime/doc/test\(_urls\.vim\)@\1/scripts/check\2@g' \ "$file" > "$file".tmp && mv "$file".tmp "$file" # Rename path to check_colors.vim - LC_ALL=C sed -e 's@\( [ab]/runtime\)/colors/\(tools/check_colors.vim\)@\1/\2@g' \ + LC_ALL=C sed -e 's@\( [ab]/runtime\)/colors/\(tools/check_colors\.vim\)@\1/\2@g' \ "$file" > "$file".tmp && mv "$file".tmp "$file" } -- cgit From e63e5d1dbd3dd4711efa0ecf9e844ff308b370a6 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 15 Apr 2022 12:35:06 +0200 Subject: docs: typo fixes (#17859) Co-authored-by: Elias Alves Moura Co-authored-by: venkatesh Co-authored-by: zeertzjq Co-authored-by: Vikas Raj <24727447+numToStr@users.noreply.github.com> Co-authored-by: Steve Vermeulen Co-authored-by: Evgeni Chasnovski Co-authored-by: rwxd Co-authored-by: casswedson <58050969+casswedson@users.noreply.github.com> --- scripts/lua2dox.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/lua2dox.lua b/scripts/lua2dox.lua index d110e34c6a..c32370517c 100644 --- a/scripts/lua2dox.lua +++ b/scripts/lua2dox.lua @@ -295,7 +295,7 @@ function TStream_Write.writelnTail(this,Line) table.insert(this.tailLine,Line) end ---! \brief outout tail lines +--! \brief output tail lines function TStream_Write.write_tailLines(this) for _,line in ipairs(this.tailLine) do TCore_IO_writeln(line) -- cgit From 933274c438107adadde5ff854340ed1fae18d3fe Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Mon, 25 Apr 2022 03:51:22 +0200 Subject: fix/PVS #17863 * fix(PVS/V002): disable rule completely V002: "Some diagnostic messages may contain incorrect line number in this file." This particular check seems unreliable. It says on their website https://pvs-studio.com/en/docs/warnings/v002/ that this warning occurs when there are multiline pragmas, but there are none in extmark.c. * fix(PVS/V756): ignore "counter is not used inside a nested loop" warning The nested loop starts with "AutoCmd *ac = ap->cmds" so "ap" is definitely used. * fix(PVS/V560): disable "a part of conditional expression is always true" * fix(PVS/V614): potentially uninitialized variable 'blen' used --- scripts/pvscheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index 195a76763f..a931231fbd 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -380,7 +380,7 @@ run_analysis() {( --sourcetree-root . || true rm -rf PVS-studio.{xml,err,tsk,html.d} - local plog_args="PVS-studio.log --srcRoot . --excludedCodes V011,V1042,V1051,V1074" + local plog_args="PVS-studio.log --srcRoot . --excludedCodes V011,V1042,V1051,V1074,V002" plog-converter $plog_args --renderTypes xml --output PVS-studio.xml plog-converter $plog_args --renderTypes errorfile --output PVS-studio.err plog-converter $plog_args --renderTypes tasklist --output PVS-studio.tsk -- cgit From 7502f1cae0abe9dfdf71e39b8812f269f5ed83b7 Mon Sep 17 00:00:00 2001 From: ii14 <59243201+ii14@users.noreply.github.com> Date: Sun, 1 May 2022 01:16:16 +0200 Subject: docs(api): more API attributes #18336 --- scripts/gen_vimdoc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 7152f1005f..f37198e96a 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -271,8 +271,10 @@ param_exclude = ( # Annotations are displayed as line items after API function descriptions. annotation_map = { - 'FUNC_API_FAST': '{fast}', + 'FUNC_API_FAST': '|api-fast|', 'FUNC_API_CHECK_TEXTLOCK': 'not allowed when |textlock| is active', + 'FUNC_API_REMOTE_ONLY': '|RPC| only', + 'FUNC_API_LUA_ONLY': '|vim.api| only', } -- cgit From 5fc251daebe2eda9e2bf032db877e4183065753f Mon Sep 17 00:00:00 2001 From: Dundar Goc Date: Sun, 1 May 2022 17:53:22 +0200 Subject: build(gen_vimdoc): abort if doxygen version is too old There have been a few instances where developers got confused as to why their generated documentation differs from the one generated by the CI. More often than not, the reason is that their doxygen version is older than 1.9.0, which is the current minimum version. Having a simple version check will help save future developers avoid this problem. --- scripts/gen_vimdoc.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index f37198e96a..8d38382405 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -53,11 +53,19 @@ import logging from xml.dom import minidom MIN_PYTHON_VERSION = (3, 6) +MIN_DOXYGEN_VERSION = (1, 9, 0) if sys.version_info < MIN_PYTHON_VERSION: print("requires Python {}.{}+".format(*MIN_PYTHON_VERSION)) sys.exit(1) +doxygen_version = tuple([int(i) for i in subprocess.check_output(["doxygen", "-v"], + universal_newlines=True).split('.')]) + +if doxygen_version < MIN_DOXYGEN_VERSION: + print("requires Doxygen {}.{}.{}+".format(*MIN_DOXYGEN_VERSION)) + sys.exit(1) + # DEBUG = ('DEBUG' in os.environ) INCLUDE_C_DECL = ('INCLUDE_C_DECL' in os.environ) INCLUDE_DEPRECATED = ('INCLUDE_DEPRECATED' in os.environ) -- cgit From 649cdc14ba1f352c14179bd177f6156bd322cbed Mon Sep 17 00:00:00 2001 From: Dundar Goc Date: Mon, 2 May 2022 10:58:40 +0200 Subject: ci(gen_vimdoc): handle edge case when checking doxygen version When checking the version of the doxygen installed from conda the output has the following format: 1.9.2 (ee54ebd4f0ad83d9c44f19a459146de64d0ffba2*) This would cause an error in the "Missing API docs" CI job. This fix will correctly parse the doxygen version for both stable releases ("1.9.2") as well as the version with the git commit hash attached. --- scripts/gen_vimdoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 8d38382405..101f0cf5ff 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -60,7 +60,7 @@ if sys.version_info < MIN_PYTHON_VERSION: sys.exit(1) doxygen_version = tuple([int(i) for i in subprocess.check_output(["doxygen", "-v"], - universal_newlines=True).split('.')]) + universal_newlines=True).split()[0].split('.')]) if doxygen_version < MIN_DOXYGEN_VERSION: print("requires Doxygen {}.{}.{}+".format(*MIN_DOXYGEN_VERSION)) -- cgit From 59162584b1d03e7739afb5116ad96e2c16c7b271 Mon Sep 17 00:00:00 2001 From: Dundar Goc Date: Mon, 2 May 2022 11:14:34 +0200 Subject: build(gen_vimdoc): print user's doxygen version if it's too old @theHamsta suggested in https://github.com/neovim/neovim/pull/18348#discussion_r862594173 to also print the users doxygen version if the version is too old. --- scripts/gen_vimdoc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 101f0cf5ff..57b46a381e 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -63,7 +63,8 @@ doxygen_version = tuple([int(i) for i in subprocess.check_output(["doxygen", "-v universal_newlines=True).split()[0].split('.')]) if doxygen_version < MIN_DOXYGEN_VERSION: - print("requires Doxygen {}.{}.{}+".format(*MIN_DOXYGEN_VERSION)) + print("\nRequires doxygen {}.{}.{}+".format(*MIN_DOXYGEN_VERSION)) + print("Your doxygen version is {}.{}.{}\n".format(*doxygen_version)) sys.exit(1) # DEBUG = ('DEBUG' in os.environ) -- cgit From c24b442e310f06c3ad9d4763b09bc9cb7dbaca62 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Thu, 12 May 2022 01:08:25 +0100 Subject: fix(runtime/genvimvim): omit s[ubstitute] from vimCommand #18480 It's special cased by the vimSubst syntax group, and isn't present in Vim's vimCommand group. For example, this fixes `call s:Foo()` highlighting `:` as Error in Nvim, as the `s` is parsed as vimCommand rather than as vimUserFunc since `contains=vimCommand` was added to vimUserFunc (and vimFunc) in a rt update. Interestingly, `g:`, `l:`, etc. have the same issues due to :global, :list, etc. Vim also has that problem, so it should ideally be fixed upstream. We could also omit g[lobal] from vimCommand and rely on vimGlobal instead, but it doesn't work in some cases, like when there's a `:` before the command. Also, Vim matches only `g` in vimCommand for some reason, which doesn't produce any highlight for `:global/foo/bar` (with Nvim you at least get some highlights on the `global` bit despite the leading `:`). Also, remove special handling of :py3 in syntax/vim.vim, as the generator seems to have no problems finding it. --- scripts/genvimvim.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/genvimvim.lua b/scripts/genvimvim.lua index ff60b6cce7..7e9d649cb4 100644 --- a/scripts/genvimvim.lua +++ b/scripts/genvimvim.lua @@ -44,12 +44,13 @@ local function cmd_kw(prev_cmd, cmd) end -- Exclude these from the vimCommand keyword list, they are handled specially --- in syntax/vim.vim (vimAugroupKey, vimAutoCmd). #9327 -local function is_autocmd_cmd(cmd) +-- in syntax/vim.vim (vimAugroupKey, vimAutoCmd, vimSubst). #9327 +local function is_special_cased_cmd(cmd) return (cmd == 'augroup' or cmd == 'autocmd' or cmd == 'doautocmd' - or cmd == 'doautoall') + or cmd == 'doautoall' + or cmd == 'substitute') end local vimcmd_start = 'syn keyword vimCommand contained ' @@ -60,7 +61,7 @@ for _, cmd_desc in ipairs(ex_cmds.cmds) do w('\n' .. vimcmd_start) end local cmd = cmd_desc.command - if cmd:match('%w') and cmd ~= 'z' and not is_autocmd_cmd(cmd) then + if cmd:match('%w') and cmd ~= 'z' and not is_special_cased_cmd(cmd) then w(' ' .. cmd_kw(prev_cmd, cmd)) end prev_cmd = cmd -- cgit From 3a91adabda43376638e0edc80f54181258c98dea Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 12 May 2022 20:19:29 +0800 Subject: refactor: rename keymap.{c,h} to keycodes.{c,h} (#18535) Most code in keymap.h is for keycode definitions, while most code in keymap.c is for the parsing and conversion of keycodes. The name "keymap" may also make people think these two files are for mappings, while in fact keycodes are used even when no mappings are involved, so "keycodes" should be a better file name than "keymap". --- scripts/vim-patch.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 57f51d9d46..e7e8f0b274 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -239,6 +239,10 @@ preprocess_patch() { LC_ALL=C sed -e 's/\( [ab]\/src\/nvim\)\/highlight\(\.[ch]\)/\1\/highlight_group\2/g' \ "$file" > "$file".tmp && mv "$file".tmp "$file" + # Rename keymap.h to keycodes.h + LC_ALL=C sed -e 's/\( [ab]\/src\/nvim\)\/keymap\.h/\1\/keycodes.h/g' \ + "$file" > "$file".tmp && mv "$file".tmp "$file" + # Rename test_urls.vim to check_urls.vim LC_ALL=C sed -e 's@\( [ab]\)/runtime/doc/test\(_urls\.vim\)@\1/scripts/check\2@g' \ "$file" > "$file".tmp && mv "$file".tmp "$file" -- cgit From a1b663cce861a76f78d65aa538426d0cf635c379 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 12 May 2022 16:02:46 +0200 Subject: build(lua2dox): add parenthesis around parameter types in documentation (#18532) This will check if the string after the variable in a @param is either "number", "string", "table", "boolean" and "function" and if so add a parenthesis around it. This will help separate the variable type with the following text. Had all our functions been annotated with emmylua then a more robust solution might have been preferable (such as always assuming the third string is parameter type without making any checks). I believe however this is a clear improvement over the current situation and will suffice for now. --- scripts/lua2dox.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'scripts') diff --git a/scripts/lua2dox.lua b/scripts/lua2dox.lua index c32370517c..6a206066b8 100644 --- a/scripts/lua2dox.lua +++ b/scripts/lua2dox.lua @@ -403,6 +403,29 @@ function TLua2DoX_filter.readfile(this,AppStamp,Filename) if string.sub(line, 3, 3) == '@' or string.sub(line, 1, 4) == '---@' then -- it's a magic comment state = 'in_magic_comment' local magic = string.sub(line, 4 + offset) + + local magic_split = string_split(magic, ' ') + + local type_index = 2 + if magic_split[1] == 'param' then + type_index = type_index + 1 + end + + if magic_split[type_index] == 'number' or + magic_split[type_index] == 'number|nil' or + magic_split[type_index] == 'string' or + magic_split[type_index] == 'string|nil' or + magic_split[type_index] == 'table' or + magic_split[type_index] == 'table|nil' or + magic_split[type_index] == 'boolean' or + magic_split[type_index] == 'boolean|nil' or + magic_split[type_index] == 'function' or + magic_split[type_index] == 'function|nil' + then + magic_split[type_index] = '(' .. magic_split[type_index] .. ')' + end + magic = table.concat(magic_split, ' ') + outStream:writeln('/// @' .. magic) fn_magic = checkComment4fn(fn_magic,magic) elseif string.sub(line,3,3)=='-' then -- it's a nonmagic doc comment -- cgit From 2875d45e79b80878af45c91702914f4f0d0e3dca Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 13 May 2022 14:37:33 +0200 Subject: ci(commitlint): ignore "fixup" commits #18556 --- scripts/lintcommit.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/lintcommit.lua b/scripts/lintcommit.lua index 6871858a0b..34d1263ff4 100644 --- a/scripts/lintcommit.lua +++ b/scripts/lintcommit.lua @@ -45,8 +45,13 @@ end -- Returns nil if the given commit message is valid, or returns a string -- message explaining why it is invalid. local function validate_commit(commit_message) - local commit_split = vim.split(commit_message, ":") + -- Return nil if the commit message starts with "fixup" as it signifies it's + -- a work in progress and shouldn't be linted yet. + if vim.startswith(commit_message, "fixup") then + return nil + end + local commit_split = vim.split(commit_message, ":") -- Return nil if the type is vim-patch since most of the normal rules don't -- apply. if commit_split[1] == "vim-patch" then @@ -183,6 +188,9 @@ function M._test() ['vim-patch:8.2.3374: Pyret files are not recognized (#15642)'] = true, ['vim-patch:8.1.1195,8.2.{3417,3419}'] = true, ['revert: "ci: use continue-on-error instead of "|| true""'] = true, + ['fixup'] = true, + ['fixup: commit message'] = true, + ['fixup! commit message'] = true, [':no type before colon 1'] = false, [' :no type before colon 2'] = false, [' :no type before colon 3'] = false, -- cgit From b1b58020094a2ffa85e40194b8beb2945396610a Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 15 May 2022 11:23:56 +0200 Subject: build(gen_vimdoc): eliminate non-constant global variables (#17781) --- scripts/gen_vimdoc.py | 73 ++++++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 42 deletions(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 57b46a381e..755749cef6 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -79,13 +79,11 @@ LOG_LEVELS = { ] } -fmt_vimhelp = False # HACK text_width = 78 script_path = os.path.abspath(__file__) base_dir = os.path.dirname(os.path.dirname(script_path)) out_dir = os.path.join(base_dir, 'tmp-{target}-doc') filter_cmd = '%s %s' % (sys.executable, script_path) -seen_funcs = set() msgs = [] # Messages to show on exit. lua2dox_filter = os.path.join(base_dir, 'scripts', 'lua2dox_filter') @@ -287,11 +285,6 @@ annotation_map = { } -# Tracks `xrefsect` titles. As of this writing, used only for separating -# deprecated functions. -xrefs = set() - - # Raises an error with details about `o`, if `cond` is in object `o`, # or if `cond()` is callable and returns True. def debug_this(o, cond=True): @@ -485,10 +478,8 @@ def update_params_map(parent, ret_map, width=62): return ret_map -def render_node(n, text, prefix='', indent='', width=62): +def render_node(n, text, prefix='', indent='', width=62, fmt_vimhelp=False): """Renders a node as Vim help text, recursively traversing all descendants.""" - global fmt_vimhelp - global has_seen_preformatted def ind(s): return s if fmt_vimhelp else '' @@ -566,7 +557,7 @@ def render_node(n, text, prefix='', indent='', width=62): return text -def para_as_map(parent, indent='', width=62): +def para_as_map(parent, indent='', width=62, fmt_vimhelp=False): """Extracts a Doxygen XML node to a map. Keys: @@ -599,7 +590,8 @@ def para_as_map(parent, indent='', width=62): last = '' if is_inline(parent): # Flatten inline text from a tree of non-block nodes. - text = doc_wrap(render_node(parent, ""), indent=indent, width=width) + text = doc_wrap(render_node(parent, "", fmt_vimhelp=fmt_vimhelp), + indent=indent, width=width) else: prev = None # Previous node for child in parent.childNodes: @@ -615,7 +607,8 @@ def para_as_map(parent, indent='', width=62): elif kind == 'see': groups['seealso'].append(child) elif kind in ('note', 'warning'): - text += render_node(child, text, indent=indent, width=width) + text += render_node(child, text, indent=indent, + width=width, fmt_vimhelp=fmt_vimhelp) else: raise RuntimeError('unhandled simplesect: {}\n{}'.format( child.nodeName, child.toprettyxml(indent=' ', newl='\n'))) @@ -628,7 +621,8 @@ def para_as_map(parent, indent='', width=62): and ' ' != text[-1]): text += ' ' - text += render_node(child, text, indent=indent, width=width) + text += render_node(child, text, indent=indent, width=width, + fmt_vimhelp=fmt_vimhelp) prev = child chunks['text'] += text @@ -639,10 +633,12 @@ def para_as_map(parent, indent='', width=62): update_params_map(child, ret_map=chunks['params'], width=width) for child in groups['return']: chunks['return'].append(render_node( - child, '', indent=indent, width=width)) + child, '', indent=indent, width=width, fmt_vimhelp=fmt_vimhelp)) for child in groups['seealso']: chunks['seealso'].append(render_node( - child, '', indent=indent, width=width)) + child, '', indent=indent, width=width, fmt_vimhelp=fmt_vimhelp)) + + xrefs = set() for child in groups['xrefs']: # XXX: Add a space (or any char) to `title` here, otherwise xrefs # ("Deprecated" section) acts very weird... @@ -652,10 +648,10 @@ def para_as_map(parent, indent='', width=62): chunks['xrefs'].append(doc_wrap(xrefdesc, prefix='{}: '.format(title), width=width) + '\n') - return chunks + return chunks, xrefs -def fmt_node_as_vimhelp(parent, width=62, indent=''): +def fmt_node_as_vimhelp(parent, width=62, indent='', fmt_vimhelp=False): """Renders (nested) Doxygen nodes as Vim :help text. NB: Blank lines in a docstring manifest as tags. @@ -678,7 +674,7 @@ def fmt_node_as_vimhelp(parent, width=62, indent=''): return True for child in parent.childNodes: - para = para_as_map(child, indent, width) + para, _ = para_as_map(child, indent, width, fmt_vimhelp) # Generate text from the gathered items. chunks = [para['text']] @@ -702,19 +698,16 @@ def fmt_node_as_vimhelp(parent, width=62, indent=''): return clean_lines('\n'.join(rendered_blocks).strip()) -def extract_from_xml(filename, target, width): +def extract_from_xml(filename, target, width, fmt_vimhelp): """Extracts Doxygen info as maps without formatting the text. Returns two maps: 1. Functions 2. Deprecated functions - The `fmt_vimhelp` global controls some special cases for use by + The `fmt_vimhelp` variable controls some special cases for use by fmt_doxygen_xml_as_vimhelp(). (TODO: ugly :) """ - global xrefs - global fmt_vimhelp - xrefs.clear() fns = {} # Map of func_name:docstring. deprecated_fns = {} # Map of func_name:docstring. @@ -821,16 +814,22 @@ def extract_from_xml(filename, target, width): signature = prefix + suffix signature += vimtag.rjust(width - len(signature)) + # Tracks `xrefsect` titles. As of this writing, used only for separating + # deprecated functions. + xrefs_all = set() paras = [] brief_desc = find_first(member, 'briefdescription') if brief_desc: for child in brief_desc.childNodes: - paras.append(para_as_map(child)) + para, xrefs = para_as_map(child) + xrefs_all.update(xrefs) desc = find_first(member, 'detaileddescription') if desc: for child in desc.childNodes: - paras.append(para_as_map(child)) + para, xrefs = para_as_map(child) + paras.append(para) + xrefs_all.update(xrefs) log.debug( textwrap.indent( re.sub(r'\n\s*\n+', '\n', @@ -846,7 +845,6 @@ def extract_from_xml(filename, target, width): 'seealso': [], } if fmt_vimhelp: - # HACK :( fn['desc_node'] = desc fn['brief_desc_node'] = brief_desc @@ -865,18 +863,16 @@ def extract_from_xml(filename, target, width): if INCLUDE_C_DECL: fn['c_decl'] = c_decl - if 'Deprecated' in str(xrefs): + if 'Deprecated' in str(xrefs_all): deprecated_fns[name] = fn elif name.startswith(CONFIG[target]['fn_name_prefix']): fns[name] = fn - xrefs.clear() - fns = collections.OrderedDict(sorted( fns.items(), key=lambda key_item_tuple: key_item_tuple[0].lower())) deprecated_fns = collections.OrderedDict(sorted(deprecated_fns.items())) - return (fns, deprecated_fns) + return fns, deprecated_fns def fmt_doxygen_xml_as_vimhelp(filename, target): @@ -886,16 +882,14 @@ def fmt_doxygen_xml_as_vimhelp(filename, target): 1. Vim help text for functions found in `filename`. 2. Vim help text for deprecated functions. """ - global fmt_vimhelp - fmt_vimhelp = True fns_txt = {} # Map of func_name:vim-help-text. deprecated_fns_txt = {} # Map of func_name:vim-help-text. - fns, _ = extract_from_xml(filename, target, width=text_width) + fns, _ = extract_from_xml(filename, target, text_width, True) for name, fn in fns.items(): # Generate Vim :help for parameters. if fn['desc_node']: - doc = fmt_node_as_vimhelp(fn['desc_node']) + doc = fmt_node_as_vimhelp(fn['desc_node'], fmt_vimhelp=True) if not doc and fn['brief_desc_node']: doc = fmt_node_as_vimhelp(fn['brief_desc_node']) if not doc: @@ -948,14 +942,9 @@ def fmt_doxygen_xml_as_vimhelp(filename, target): func_doc = "\n".join(split_lines) - if 'Deprecated' in xrefs: - deprecated_fns_txt[name] = func_doc - elif name.startswith(CONFIG[target]['fn_name_prefix']): + if name.startswith(CONFIG[target]['fn_name_prefix']): fns_txt[name] = func_doc - xrefs.clear() - - fmt_vimhelp = False return ('\n\n'.join(list(fns_txt.values())), '\n\n'.join(list(deprecated_fns_txt.values()))) @@ -1059,7 +1048,7 @@ def main(config, args): xmlfile = os.path.join(base, '{}.xml'.format(compound.getAttribute('refid'))) # Extract unformatted (*.mpack). - fn_map, _ = extract_from_xml(xmlfile, target, width=9999) + fn_map, _ = extract_from_xml(xmlfile, target, 9999, False) # Extract formatted (:help). functions_text, deprecated_text = fmt_doxygen_xml_as_vimhelp( os.path.join(base, '{}.xml'.format( -- cgit From b2799518c7b7f93001e23016c0b8e5a3096afac0 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Mon, 16 May 2022 01:45:34 +0200 Subject: feat(terminfo): bump built-in terminfo entries (#18570) Removes NOLINT, which is pointless for the generated terminfo_defs.h. Adds `uncrustify:off`, so it is not uncrustify which complains about the same things (too long lines, no space after comma) instead. --- scripts/update_terminfo.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/update_terminfo.sh b/scripts/update_terminfo.sh index 0cfc230ca6..8a0937cc8c 100755 --- a/scripts/update_terminfo.sh +++ b/scripts/update_terminfo.sh @@ -64,6 +64,8 @@ cat > "$target" <> "$target" cat >> "$target" < Date: Tue, 17 May 2022 14:42:48 +0200 Subject: feat(lintcommit): remove "chore", add "dist" #18594 "chore" is never necessary, choose "fix" or "feat" if nothing else applies. --- scripts/lintcommit.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/lintcommit.lua b/scripts/lintcommit.lua index 34d1263ff4..16326cfe66 100644 --- a/scripts/lintcommit.lua +++ b/scripts/lintcommit.lua @@ -78,7 +78,7 @@ local function validate_commit(commit_message) -- Check if type is correct local type = vim.split(before_colon, "%(")[1] - local allowed_types = {'build', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'test', 'chore', 'vim-patch'} + local allowed_types = {'build', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'test', 'dist', 'vim-patch'} if not vim.tbl_contains(allowed_types, type) then return string.format( 'Invalid commit type "%s". Allowed types are:\n %s', @@ -181,7 +181,7 @@ function M._test() ['refactor: normal message'] = true, ['revert: normal message'] = true, ['test: normal message'] = true, - ['chore: normal message'] = true, + ['dist: normal message'] = true, ['ci(window): message with scope'] = true, ['ci!: message with breaking change'] = true, ['ci(tui)!: message with scope and breaking change'] = true, @@ -205,10 +205,10 @@ function M._test() ['ci :extra space before colon'] = false, ['refactor(): empty scope'] = false, ['ci( ): whitespace as scope'] = false, - ['chore: period at end of sentence.'] = false, + ['ci: period at end of sentence.'] = false, ['ci: Starting sentence capitalized'] = false, ['unknown: using unknown type'] = false, - ['chore: you\'re saying this commit message just goes on and on and on and on and on and on for way too long?'] = false, + ['ci: you\'re saying this commit message just goes on and on and on and on and on and on for way too long?'] = false, } local failed = 0 -- cgit From eb623a1c45bab279e202b718f52543da92baaabd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 25 May 2022 10:31:32 +0800 Subject: docs: add missing termdebug docs from Vim runtime updates https://github.com/vim/vim/commit/388a5d4f20b4b64341d1604aa238cab85827b892 https://github.com/vim/vim/commit/4466ad6baa22485abb1147aca3340cced4778a66 https://github.com/vim/vim/commit/6aa57295cfbe8f21c15f0671e45fd53cf990d404 Rename terminal.txt to nvim_terminal_emulator.txt in vim-patch.sh. --- scripts/vim-patch.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index e7e8f0b274..8235949156 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -243,6 +243,10 @@ preprocess_patch() { LC_ALL=C sed -e 's/\( [ab]\/src\/nvim\)\/keymap\.h/\1\/keycodes.h/g' \ "$file" > "$file".tmp && mv "$file".tmp "$file" + # Rename terminal.txt to nvim_terminal_emulator.txt + LC_ALL=C sed -e 's/\( [ab]\/runtime\/doc\)\/terminal\.txt/\1\/nvim_terminal_emulator.txt/g' \ + "$file" > "$file".tmp && mv "$file".tmp "$file" + # Rename test_urls.vim to check_urls.vim LC_ALL=C sed -e 's@\( [ab]\)/runtime/doc/test\(_urls\.vim\)@\1/scripts/check\2@g' \ "$file" > "$file".tmp && mv "$file".tmp "$file" -- cgit From c43e2874c083d66a563f262f7fb7d7ec84bce814 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 28 May 2022 09:49:58 -0700 Subject: fix(vim-patch.sh) In scripts/vim-patch.sh line 335: printf ' ^-- SC2183 (warning): This format string has 4 variables, but is passed 3 arguments. In scripts/vim-patch.sh line 597: list_missing_vimpatches 1 "$@" | while read -r vim_commit; do ^--------^ SC2030 (info): Modification of vim_commit is local (to subshell caused by pipeline) In scripts/vim-patch.sh line 626: done < <(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --name-only -r "${vim_commit}" -- . ':!src/version.c') ^-----------^ SC2031 (info): vim_commit was modified in a subshell. That change might be lost. For more information: https://www.shellcheck.net/wiki/SC2183 -- This format string has 4 variable... https://www.shellcheck.net/wiki/SC2030 -- Modification of vim_commit is loc... https://www.shellcheck.net/wiki/SC2031 -- vim_commit was modified in a subs... --- scripts/vim-patch.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 8235949156..472b79cbf4 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -4,6 +4,8 @@ set -e set -u # Use privileged mode, which e.g. skips using CDPATH. set -p +# https://www.shellcheck.net/wiki/SC2031 +shopt -s lastpipe # Ensure that the user has a bash that supports -A if [[ "${BASH_VERSINFO[0]}" -lt 4 ]]; then @@ -345,7 +347,7 @@ stage_patch() { See the wiki for more information: * https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim -' "${vim_version}" "${BASENAME}" "${BASENAME}" +' "${vim_version}" "${BASENAME}" "${BASENAME}" "${BASENAME}" return $ret } -- cgit From 67cbaf58c41a3db19c5014587e72d06be9e3d58e Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Sun, 15 May 2022 14:38:19 -0600 Subject: feat(fs): add vim.fs.parents() vim.fs.parents() is a Lua iterator that returns the next parent directory of the given file or directory on each iteration. --- scripts/gen_vimdoc.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 755749cef6..790c2ba52d 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -134,6 +134,7 @@ CONFIG = { 'ui.lua', 'filetype.lua', 'keymap.lua', + 'fs.lua', ], 'files': [ 'runtime/lua/vim/_editor.lua', @@ -142,6 +143,7 @@ CONFIG = { 'runtime/lua/vim/ui.lua', 'runtime/lua/vim/filetype.lua', 'runtime/lua/vim/keymap.lua', + 'runtime/lua/vim/fs.lua', ], 'file_patterns': '*.lua', 'fn_name_prefix': '', @@ -167,6 +169,7 @@ CONFIG = { 'ui': 'vim.ui', 'filetype': 'vim.filetype', 'keymap': 'vim.keymap', + 'fs': 'vim.fs', }, 'append_only': [ 'shared.lua', -- cgit From 214f866fe50737152f87ec04824f5e0f1d39edc2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 5 Jun 2022 20:39:56 +0800 Subject: fix(terminfo): disable smglr for vtpcon and conemu (#18855) --- scripts/windows.ti | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/windows.ti b/scripts/windows.ti index 4f4832b786..c3a367e6d4 100644 --- a/scripts/windows.ti +++ b/scripts/windows.ti @@ -34,7 +34,7 @@ conemu|ANIS X3.64 and Xterm 256 colors for ConEmu with libuv, smcup=\E[?1049h, rmir@, rmkx@, rmm@, rs1@, rs2@, setab=\E[48;5;%p1%dm, setaf=\E[38;5;%p1%dm, sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p6%t;1%;m, - sgr0=\E[0m, smam@, smir@, smkx@, smm@, tbc@, u6@, u7@, u8@, u9@, + sgr0=\E[0m, smam@, smglr@, smir@, smkx@, smm@, tbc@, u6@, u7@, u8@, u9@, Cr@, Cs@, Ms@, XM@, kDC3@, kDC4@, kDC5@, kDC6@, kDC7@, kDN@, kDN3@, kDN4@, kDN5@, kDN6@, kDN7@, kEND3@, kEND4@, kEND5@, kEND6@, kEND7@, @@ -57,7 +57,7 @@ vtpcon|ANIS emulation for console virtual terminal sequence with libuv, mc0@, mc4@, mc5@, meml@, memu@, oc@, rmam@, rmcup=\E[?1049l, smcup=\E[?1049h, rmir@, rmkx@, rmm@, rs1@, rs2@, sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p6%t;1%;m, - sgr0=\E[0m, smam@, smir@, smkx@, smm@, tbc@, u6@, u7@, u8@, u9@, + sgr0=\E[0m, smam@, smglr@, smir@, smkx@, smm@, tbc@, u6@, u7@, u8@, u9@, Cr@, Cs@, Ms@, XM@, kDC3@, kDC4@, kDC5@, kDC6@, kDC7@, kDN@, kDN3@, kDN4@, kDN5@, kDN6@, kDN7@, kEND3@, kEND4@, kEND5@, kEND6@, kEND7@, -- cgit From 612944c5863caabc7b71b66c9deb73a983c69803 Mon Sep 17 00:00:00 2001 From: bfredl Date: Sun, 12 Jun 2022 19:26:43 +0200 Subject: refactor(api): update vimdoc --- scripts/gen_vimdoc.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 790c2ba52d..220b099df5 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -95,6 +95,8 @@ CONFIG = { 'section_order': [ 'vim.c', 'vimscript.c', + 'command.c', + 'options.c', 'buffer.c', 'extmark.c', 'window.c', -- cgit From 504d7decbdef55d58e62217a0a54cbee2a0944cc Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 15 Jun 2022 09:20:32 +0200 Subject: vim-patch:8c1b8cb2e0b5 (#18966) Update runtime files https://github.com/vim/vim/commit/8c1b8cb2e0b52d0853f85c2096a2f22dbc57a788 --- scripts/genvimvim.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/genvimvim.lua b/scripts/genvimvim.lua index 7e9d649cb4..868084a583 100644 --- a/scripts/genvimvim.lua +++ b/scripts/genvimvim.lua @@ -44,12 +44,13 @@ local function cmd_kw(prev_cmd, cmd) end -- Exclude these from the vimCommand keyword list, they are handled specially --- in syntax/vim.vim (vimAugroupKey, vimAutoCmd, vimSubst). #9327 +-- in syntax/vim.vim (vimAugroupKey, vimAutoCmd, vimGlobal, vimSubst). #9327 local function is_special_cased_cmd(cmd) return (cmd == 'augroup' or cmd == 'autocmd' or cmd == 'doautocmd' or cmd == 'doautoall' + or cmd == 'global' or cmd == 'substitute') end -- cgit From 7718b758461265d8966468c104ce5454538471e2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 23 Jun 2022 21:17:11 +0800 Subject: refactor: move some mapping-related code to a separate file (#19061) This marks the following Vim patches as ported: vim-patch:8.1.1785: map functionality mixed with character input Problem: Map functionality mixed with character input. Solution: Move the map functionality to a separate file. (Yegappan Lakshmanan, closes vim/vim#4740) Graduate the +localmap feature. https://github.com/vim/vim/commit/b66bab381c8ba71fd6e92327d1d34c6f8a65f2a7 vim-patch:8.2.3643: header for source file is outdated Problem: Header for source file is outdated. Solution: Make the header more accurate. (closes vim/vim#9186) https://github.com/vim/vim/commit/a3f83feb63eae5464a620ae793c002eb45f7a838 Also cherry-pick a change for mappings from patch 8.2.0807. Rename map_clear_mode() to do_mapclear(). --- scripts/vim-patch.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 472b79cbf4..d5424f51ab 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -233,6 +233,10 @@ preprocess_patch() { LC_ALL=C sed -e 's/\( [ab]\/src\/nvim\)\/userfunc\.c/\1\/eval\/userfunc\.c/g' \ "$file" > "$file".tmp && mv "$file".tmp "$file" + # Rename map.c to mapping.c + LC_ALL=C sed -e 's/\( [ab]\/src\/nvim\)\/map\(\.[ch]\)/\1\/mapping\2/g' \ + "$file" > "$file".tmp && mv "$file".tmp "$file" + # Rename session.c to ex_session.c LC_ALL=C sed -e 's/\( [ab]\/src\/nvim\)\/session\(\.[ch]\)/\1\/ex_session\2/g' \ "$file" > "$file".tmp && mv "$file".tmp "$file" -- cgit From ece2960f1b2994c58c7978435309e46d241307ac Mon Sep 17 00:00:00 2001 From: Axis <77634274+blankRiot96@users.noreply.github.com> Date: Sat, 25 Jun 2022 15:33:02 +0530 Subject: build(gen_vimdoc): remove needless list creation and unused variable (#19079) build(gen_vimdoc): remove needless list creation --- scripts/gen_vimdoc.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/gen_vimdoc.py b/scripts/gen_vimdoc.py index 220b099df5..22fd155d32 100755 --- a/scripts/gen_vimdoc.py +++ b/scripts/gen_vimdoc.py @@ -59,8 +59,8 @@ if sys.version_info < MIN_PYTHON_VERSION: print("requires Python {}.{}+".format(*MIN_PYTHON_VERSION)) sys.exit(1) -doxygen_version = tuple([int(i) for i in subprocess.check_output(["doxygen", "-v"], - universal_newlines=True).split()[0].split('.')]) +doxygen_version = tuple((int(i) for i in subprocess.check_output(["doxygen", "-v"], + universal_newlines=True).split()[0].split('.'))) if doxygen_version < MIN_DOXYGEN_VERSION: print("\nRequires doxygen {}.{}.{}+".format(*MIN_DOXYGEN_VERSION)) @@ -1096,7 +1096,6 @@ def main(config, args): docs = '' - i = 0 for filename in CONFIG[target]['section_order']: try: title, helptag, section_doc = sections.pop(filename) @@ -1104,7 +1103,6 @@ def main(config, args): msg(f'warning: empty docs, skipping (target={target}): {filename}') msg(f' existing docs: {sections.keys()}') continue - i += 1 if filename not in CONFIG[target]['append_only']: docs += sep docs += '\n%s%s' % (title, -- cgit From f05a2891d3da9f9fcd9c7457ca0c2a54ff65078b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 27 Jun 2022 03:08:59 -0700 Subject: build: rename build-related dirs Problem: Dirs "config", "packaging", and "third-party" are all closely related but this is not obvious from the layout. This adds friction for new contributors. Solution: - rename config/ to cmake.config/ - rename test/config/ to test/cmakeconfig/ because it is used in Lua tests: require('test.cmakeconfig.paths'). - rename packaging/ to cmake.packaging/ - rename third-party/ to cmake.deps/ (parallel with .deps/) --- scripts/bump_deps.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/bump_deps.lua b/scripts/bump_deps.lua index 2ecbb2e658..17e3fd35d6 100644 --- a/scripts/bump_deps.lua +++ b/scripts/bump_deps.lua @@ -132,7 +132,7 @@ end local function write_cmakelists_line(symbol, kind, value) require_executable("sed") - local cmakelists_path = nvim_src_dir .. "/" .. "third-party/CMakeLists.txt" + local cmakelists_path = nvim_src_dir .. "/" .. "cmake.deps/CMakeLists.txt" run_die({ "sed", "-i", @@ -169,7 +169,7 @@ local function update_cmakelists(dependency, archive, comment) verify_branch(dependency.name) - local changed_file = nvim_src_dir .. "/" .. "third-party/CMakeLists.txt" + local changed_file = nvim_src_dir .. "/" .. "cmake.deps/CMakeLists.txt" p("Updating " .. dependency.name .. " to " .. archive.url .. "\n") write_cmakelists_line(dependency.symbol, "URL", archive.url:gsub("/", "\\/")) @@ -183,7 +183,7 @@ end local function verify_cmakelists_committed() require_executable("git") - local cmakelists_path = nvim_src_dir .. "/" .. "third-party/CMakeLists.txt" + local cmakelists_path = nvim_src_dir .. "/" .. "cmake.deps/CMakeLists.txt" run_die({ "git", "diff", "--quiet", "HEAD", "--", cmakelists_path }, cmakelists_path .. " has uncommitted changes") end -- cgit From 4c0c6f8428681c7ceef1148abe40b7d06079449c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 27 Jun 2022 12:30:27 -0700 Subject: build: move unicode/ to src/unicode/ --- scripts/download-unicode-files.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/download-unicode-files.sh b/scripts/download-unicode-files.sh index 12474d3c1e..4482cefa34 100755 --- a/scripts/download-unicode-files.sh +++ b/scripts/download-unicode-files.sh @@ -4,7 +4,7 @@ set -e data_files="UnicodeData.txt CaseFolding.txt EastAsianWidth.txt" emoji_files="emoji-data.txt" -UNIDIR_DEFAULT=unicode +UNIDIR_DEFAULT=src/unicode DOWNLOAD_URL_BASE_DEFAULT='http://unicode.org/Public' if test x$1 = 'x--help' ; then @@ -39,5 +39,5 @@ done ( cd "$UNIDIR" - git commit -m "Update unicode files" -- $files + git commit -m "feat: update unicode tables" -- $files ) -- cgit From 912dbbdd77f382d90e4d8ef8ffa483037248b83a Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Thu, 14 Jul 2022 09:12:27 +0200 Subject: build: gracefully handle error in git-version #19289 - only update git-version if both of these conditions are met: - `git` command succeeds - `versiondef_git.h` would change (SHA1-diff) - else print a status/warning message also move version generation out of Lua into cmake. --- scripts/update_version_stamp.lua | 54 ---------------------------------------- 1 file changed, 54 deletions(-) delete mode 100755 scripts/update_version_stamp.lua (limited to 'scripts') diff --git a/scripts/update_version_stamp.lua b/scripts/update_version_stamp.lua deleted file mode 100755 index 0342e08f31..0000000000 --- a/scripts/update_version_stamp.lua +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env lua --- --- Script to update the Git version stamp during build. --- This is called via the custom update_version_stamp target in --- src/nvim/CMakeLists.txt. --- --- arg[1]: file in which to update the version string --- arg[2]: prefix to use always ("vX.Y.Z") - -local function die(msg) - io.stderr:write(string.format('%s: %s\n', arg[0], msg)) - -- No error, fall back to using generated "-dev" version. - os.exit(0) -end - -local function iswin() - return package.config:sub(1,1) == '\\' -end - -if #arg ~= 2 then - die(string.format("Expected two args, got %d", #arg)) -end - -local versiondeffile = arg[1] -local prefix = arg[2] - -local dev_null = iswin() and 'NUL' or '/dev/null' -local described = io.popen('git describe --first-parent --dirty 2>'..dev_null):read('*l') -if not described then - described = io.popen('git describe --first-parent --tags --always --dirty'):read('*l') -end -if not described then - io.open(versiondeffile, 'w'):write('\n') - die('git-describe failed, using empty include file.') -end - --- `git describe` annotates the most recent tagged release; for pre-release --- builds we append that to the dev version -local with_prefix = prefix -if prefix:match('-dev$') ~= nil then - with_prefix = prefix .. '+' .. described:gsub('^v%d+%.%d+%.%d+-', '') -end - --- Read existing include file. -local current = io.open(versiondeffile, 'r') -if current then - current = current:read('*l') -end - --- Write new include file, if different. -local new = '#define NVIM_VERSION_MEDIUM "'..with_prefix..'"' -if current ~= new then - io.open(versiondeffile, 'w'):write(new .. '\n') -end -- cgit