diff options
-rw-r--r-- | .github/scripts/remove-reviewers.js | 16 | ||||
-rw-r--r-- | .github/workflows/remove-reviewers-on-draft.yml | 17 | ||||
-rw-r--r-- | runtime/doc/api.txt | 4 | ||||
-rw-r--r-- | runtime/filetype.vim | 5 | ||||
-rw-r--r-- | runtime/ftplugin/query.lua | 6 | ||||
-rw-r--r-- | runtime/indent/query.lua | 6 | ||||
-rw-r--r-- | runtime/lua/vim/filetype.lua | 4 | ||||
-rw-r--r-- | src/nvim/api/autocmd.c | 28 | ||||
-rw-r--r-- | src/nvim/api/extmark.c | 4 | ||||
-rw-r--r-- | src/nvim/autocmd.c | 5 | ||||
-rw-r--r-- | src/nvim/testdir/test_filetype.vim | 1 | ||||
-rw-r--r-- | test/busted/outputHandlers/nvim.lua | 2 | ||||
-rw-r--r-- | test/functional/api/autocmd_spec.lua | 8 |
13 files changed, 91 insertions, 15 deletions
diff --git a/.github/scripts/remove-reviewers.js b/.github/scripts/remove-reviewers.js new file mode 100644 index 0000000000..631f08e57d --- /dev/null +++ b/.github/scripts/remove-reviewers.js @@ -0,0 +1,16 @@ +module.exports = async ({github, context}) => { + const requestedReviewers = await github.rest.pulls.listRequestedReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number + }); + + const reviewers = requestedReviewers.data.users.map(e => e.login) + + github.rest.pulls.removeRequestedReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + reviewers: reviewers + }); +} diff --git a/.github/workflows/remove-reviewers-on-draft.yml b/.github/workflows/remove-reviewers-on-draft.yml new file mode 100644 index 0000000000..64474618b8 --- /dev/null +++ b/.github/workflows/remove-reviewers-on-draft.yml @@ -0,0 +1,17 @@ +name: "Remove reviewers" +on: + pull_request_target: + types: [converted_to_draft, closed] +jobs: + remove-reviewers: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: actions/checkout@v2 + - name: 'Remove reviewers' + uses: actions/github-script@v6 + with: + script: | + const script = require('./.github/scripts/remove-reviewers.js') + await script({github, context}) diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 24ef230844..b383c5eaef 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -2453,9 +2453,9 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts}) local pos = a.nvim_win_get_cursor(0) local ns = a.nvim_create_namespace('my-plugin') -- Create new extmark at line 1, column 1. - local m1 = a.nvim_buf_set_extmark(0, ns, 0, 0, 0, {}) + local m1 = a.nvim_buf_set_extmark(0, ns, 0, 0, {}) -- Create new extmark at line 3, column 1. - local m2 = a.nvim_buf_set_extmark(0, ns, 0, 2, 0, {}) + local m2 = a.nvim_buf_set_extmark(0, ns, 0, 2, {}) -- Get extmarks only from line 3. local ms = a.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {}) -- Get all marks in this buffer + namespace. diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 9df89674e3..65e0b49e61 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1273,6 +1273,9 @@ au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl " Oracle config file au BufNewFile,BufRead *.ora setf ora +" Org +au BufNewFile,BufRead *.org,*.org_archive setf org + " Packet filter conf au BufNewFile,BufRead pf.conf setf pf @@ -1728,7 +1731,7 @@ au BufNewFile,BufRead .zshrc,.zshenv,.zlogin,.zlogout,.zcompdump setf zsh au BufNewFile,BufRead *.zsh setf zsh " Scheme -au BufNewFile,BufRead *.scm,*.ss,*.sld,*.rkt,*.rktd,*.rktl setf scheme +au BufNewFile,BufRead *.scm,*.ss,*.sld,*.rkt,*.rktd,*.rktl setf scheme " Screen RC au BufNewFile,BufRead .screenrc,screenrc setf screen diff --git a/runtime/ftplugin/query.lua b/runtime/ftplugin/query.lua new file mode 100644 index 0000000000..c1694961af --- /dev/null +++ b/runtime/ftplugin/query.lua @@ -0,0 +1,6 @@ +-- Neovim filetype plugin file +-- Language: Tree-sitter query +-- Last Change: 2022 Mar 29 + +-- it's a lisp! +vim.cmd [[ runtime! ftplugin/lisp.vim ]] diff --git a/runtime/indent/query.lua b/runtime/indent/query.lua new file mode 100644 index 0000000000..55cb73e62b --- /dev/null +++ b/runtime/indent/query.lua @@ -0,0 +1,6 @@ +-- Neovim indent file +-- Language: Tree-sitter query +-- Last Change: 2022 Mar 29 + +-- it's a lisp! +vim.cmd [[ runtime! indent/lisp.vim ]] diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index ab71de54f8..927ef36391 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -438,6 +438,8 @@ local extension = { opam = "opam", ["or"] = "openroad", ora = "ora", + org = "org", + org_archive = "org", pxsl = "papp", papp = "papp", pxml = "papp", @@ -1424,6 +1426,8 @@ local pattern = { return "git" end end, + -- Neovim only + [".*/queries/.*%.scm"] = "query", -- tree-sitter queries -- END PATTERN } -- luacheck: pop diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c index 00a418367f..57f392f98e 100644 --- a/src/nvim/api/autocmd.c +++ b/src/nvim/api/autocmd.c @@ -535,10 +535,16 @@ cleanup: /// NOTE: Only autocommands created via the API have an id. /// @param id Integer The id returned by nvim_create_autocmd /// @see |nvim_create_autocmd()| -void nvim_del_autocmd(Integer id) +void nvim_del_autocmd(Integer id, Error *err) FUNC_API_SINCE(9) { - autocmd_delete_id(id); + if (id <= 0) { + api_set_error(err, kErrorTypeException, "Invalid autocmd id"); + return; + } + if (!autocmd_delete_id(id)) { + api_set_error(err, kErrorTypeException, "Failed to delete autocmd"); + } } /// Clear all autocommands that match the corresponding {opts}. To delete @@ -678,11 +684,15 @@ Integer nvim_create_augroup(uint64_t channel_id, String name, Dict(create_augrou /// @param id Integer The id of the group. /// @see |nvim_del_augroup_by_name()| /// @see |nvim_create_augroup()| -void nvim_del_augroup_by_id(Integer id) +void nvim_del_augroup_by_id(Integer id, Error *err) FUNC_API_SINCE(9) { - char *name = augroup_name((int)id); - augroup_del(name, false); + TRY_WRAP({ + try_start(); + char *name = augroup_name((int)id); + augroup_del(name, false); + try_end(err); + }); } /// Delete an autocommand group by name. @@ -691,10 +701,14 @@ void nvim_del_augroup_by_id(Integer id) /// this group will also be deleted and cleared. This group will no longer exist. /// @param name String The name of the group. /// @see |autocommand-groups| -void nvim_del_augroup_by_name(String name) +void nvim_del_augroup_by_name(String name, Error *err) FUNC_API_SINCE(9) { - augroup_del(name.data, false); + TRY_WRAP({ + try_start(); + augroup_del(name.data, false); + try_end(err); + }); } /// Execute all autocommands for {event} that match the corresponding diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c index 797b64e2af..8dca37a321 100644 --- a/src/nvim/api/extmark.c +++ b/src/nvim/api/extmark.c @@ -259,9 +259,9 @@ ArrayOf(Integer) nvim_buf_get_extmark_by_id(Buffer buffer, Integer ns_id, /// local pos = a.nvim_win_get_cursor(0) /// local ns = a.nvim_create_namespace('my-plugin') /// -- Create new extmark at line 1, column 1. -/// local m1 = a.nvim_buf_set_extmark(0, ns, 0, 0, 0, {}) +/// local m1 = a.nvim_buf_set_extmark(0, ns, 0, 0, {}) /// -- Create new extmark at line 3, column 1. -/// local m2 = a.nvim_buf_set_extmark(0, ns, 0, 2, 0, {}) +/// local m2 = a.nvim_buf_set_extmark(0, ns, 0, 2, {}) /// -- Get extmarks only from line 3. /// local ms = a.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {}) /// -- Get all marks in this buffer + namespace. diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index d4af05b961..c0a22d058c 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -2350,17 +2350,20 @@ int autocmd_delete_event(int group, event_T event, char_u *pat) /// Deletes an autocmd by ID. /// Only autocmds created via the API have IDs associated with them. There /// is no way to delete a specific autocmd created via :autocmd -void autocmd_delete_id(int64_t id) +bool autocmd_delete_id(int64_t id) { + assert(id > 0); FOR_ALL_AUEVENTS(event) { FOR_ALL_AUPATS_IN_EVENT(event, ap) { for (AutoCmd *ac = ap->cmds; ac != NULL; ac = ac->next) { if (ac->id == id) { aucmd_del(ac); + return true; } } } } + return false; } // =========================================================================== diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 839d160e39..dd08d8bd09 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -381,6 +381,7 @@ let s:filename_checks = { \ 'opam': ['opam', 'file.opam', 'file.opam.template'], \ 'openroad': ['file.or'], \ 'ora': ['file.ora'], + \ 'org': ['file.org', 'file.org_archive'], \ 'pamconf': ['/etc/pam.conf', '/etc/pam.d/file', 'any/etc/pam.conf', 'any/etc/pam.d/file'], \ 'pamenv': ['/etc/security/pam_env.conf', '/home/user/.pam_environment', '.pam_environment', 'pam_env.conf'], \ 'papp': ['file.papp', 'file.pxml', 'file.pxsl'], diff --git a/test/busted/outputHandlers/nvim.lua b/test/busted/outputHandlers/nvim.lua index 0e9801b94b..5e9c52e0bd 100644 --- a/test/busted/outputHandlers/nvim.lua +++ b/test/busted/outputHandlers/nvim.lua @@ -1,5 +1,4 @@ local pretty = require 'pl.pretty' -local global_helpers = require('test.helpers') -- Colors are disabled by default. #15610 local colors = setmetatable({}, {__index = function() return function(s) return s == nil and '' or tostring(s) end end}) @@ -192,7 +191,6 @@ return function(options) local tests = (testCount == 1 and 'test' or 'tests') local files = (fileCount == 1 and 'file' or 'files') io.write(globalTeardown) - io.write(global_helpers.read_nvim_log(nil, true)) io.write(suiteEndString:format(testCount, tests, fileCount, files, elapsedTime_ms)) io.write(getSummaryString()) io.flush() diff --git a/test/functional/api/autocmd_spec.lua b/test/functional/api/autocmd_spec.lua index 80fcb51677..b4a9a4f01f 100644 --- a/test/functional/api/autocmd_spec.lua +++ b/test/functional/api/autocmd_spec.lua @@ -809,6 +809,14 @@ describe('autocmd api', function() eq(2, get_executed_count(), "No additional counts") end) + it('can delete non-existent groups with pcall', function() + eq(false, exec_lua[[return pcall(vim.api.nvim_del_augroup_by_name, 'noexist')]]) + eq('Vim:E367: No such group: "noexist"', pcall_err(meths.del_augroup_by_name, 'noexist')) + + eq(false, exec_lua[[return pcall(vim.api.nvim_del_augroup_by_id, -12342)]]) + eq('Vim:E367: No such group: "--Deleted--"', pcall_err(meths.del_augroup_by_id, -12312)) + end) + it('groups work with once', function() local augroup = "TestGroup" |