diff options
-rw-r--r-- | .github/workflows/labeler.yml | 19 | ||||
-rw-r--r-- | .github/workflows/reviews.yml | 118 | ||||
-rw-r--r-- | ci/reviews.js | 80 | ||||
-rw-r--r-- | runtime/doc/api.txt | 27 | ||||
-rw-r--r-- | runtime/doc/lsp.txt | 4 | ||||
-rw-r--r-- | runtime/doc/lua.txt | 23 |
6 files changed, 133 insertions, 138 deletions
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 08f0ce1763..736b8ae630 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -31,14 +31,17 @@ jobs: - name: "Extract commit scope and add as label" run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')" || true - upload-pr-number: + request-reviewer: + if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false runs-on: ubuntu-latest + needs: ["triage", "type-scope"] + permissions: + pull-requests: write steps: - - name: Save PR number - run: | - mkdir -p pr - echo ${{ github.event.number }} > pr/pr_number - - uses: actions/upload-artifact@v2 + - run: wget https://raw.githubusercontent.com/neovim/neovim/master/ci/reviews.js + - name: 'Request reviewers' + uses: actions/github-script@v6 with: - name: pr_number - path: pr/ + script: | + const script = require('./reviews.js') + await script({github, context}) diff --git a/.github/workflows/reviews.yml b/.github/workflows/reviews.yml index bd2dd8759d..2da7365821 100644 --- a/.github/workflows/reviews.yml +++ b/.github/workflows/reviews.yml @@ -2,9 +2,6 @@ name: "Request reviews" on: pull_request_target: types: [labeled, ready_for_review] - workflow_run: - workflows: [Pull Request Labeler] - types: [completed] jobs: request-reviewer: if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false @@ -12,119 +9,10 @@ jobs: permissions: pull-requests: write steps: - - if: github.event_name == 'workflow_run' - name: 'Download artifact with PR number' - uses: actions/github-script@v6 - with: - script: | - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == "pr_number" - })[0]; - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data)); - - - if: github.event_name == 'workflow_run' - name: 'Unzip artifact' - run: unzip pr_number.zip - + - run: wget https://raw.githubusercontent.com/neovim/neovim/master/ci/reviews.js - name: 'Request reviewers' uses: actions/github-script@v6 with: script: | - // The number of the pull request that triggered this run. If label - // was added manually by a person the number will be stored in current - // context, otherwise the number will be stored in a text file that - // was stored as an artifact from previous workflow. - - const fs = require('fs') - const pr_number = context.issue.number || Number(fs.readFileSync('./pr_number')) - - const pr_data = await github.rest.pulls.get({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: pr_number - }) - const labels = pr_data.data.labels.map(e => e.name) - - const reviewers = new Set() - if (labels.includes('api')) { - reviewers.add("bfredl") - reviewers.add("gpanders") - reviewers.add("muniter") - } - - if (labels.includes('ci')) { - reviewers.add("jamessan") - } - - if (labels.includes('diagnostic')) { - reviewers.add("gpanders") - } - - if (labels.includes('distribution')) { - reviewers.add("jamessan") - } - - if (labels.includes('documentation')) { - reviewers.add("clason") - } - - if (labels.includes('extmarks')) { - reviewers.add("bfredl") - } - - if (labels.includes('filetype')) { - reviewers.add("clason") - reviewers.add("gpanders") - } - - if (labels.includes('gui')) { - reviewers.add("glacambre") - reviewers.add("smolck") - } - - if (labels.includes('lsp')) { - reviewers.add("mfussenegger") - reviewers.add("mjlbach") - } - - if (labels.includes('treesitter')) { - reviewers.add("bfredl") - reviewers.add("vigoux") - } - - if (labels.includes('typo')) { - reviewers.add("dundargoc") - } - - if (labels.includes('ui')) { - reviewers.add("bfredl") - } - - if (labels.includes('vim-patch')) { - reviewers.add("janlazo") - reviewers.add("seandewar") - reviewers.add("zeertzjq") - } - - // Remove person that opened the PR since they can't review themselves - const pr_opener = pr_data.data.user.login - reviewers.delete(pr_opener) - - github.rest.pulls.requestReviewers({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: pr_number, - reviewers: Array.from(reviewers) - }); + const script = require('./reviews.js') + await script({github, context}) diff --git a/ci/reviews.js b/ci/reviews.js new file mode 100644 index 0000000000..3e8e07976a --- /dev/null +++ b/ci/reviews.js @@ -0,0 +1,80 @@ +module.exports = async ({github, context}) => { + const pr_data = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number + }) + const labels = pr_data.data.labels.map(e => e.name) + + const reviewers = new Set() + if (labels.includes('api')) { + reviewers.add("bfredl") + reviewers.add("gpanders") + reviewers.add("muniter") + } + + if (labels.includes('ci')) { + reviewers.add("jamessan") + } + + if (labels.includes('diagnostic')) { + reviewers.add("gpanders") + } + + if (labels.includes('distribution')) { + reviewers.add("jamessan") + } + + if (labels.includes('documentation')) { + reviewers.add("clason") + } + + if (labels.includes('extmarks')) { + reviewers.add("bfredl") + } + + if (labels.includes('filetype')) { + reviewers.add("clason") + reviewers.add("gpanders") + } + + if (labels.includes('gui')) { + reviewers.add("glacambre") + reviewers.add("smolck") + } + + if (labels.includes('lsp')) { + reviewers.add("mfussenegger") + reviewers.add("mjlbach") + } + + if (labels.includes('treesitter')) { + reviewers.add("bfredl") + reviewers.add("vigoux") + } + + if (labels.includes('typo')) { + reviewers.add("dundargoc") + } + + if (labels.includes('ui')) { + reviewers.add("bfredl") + } + + if (labels.includes('vim-patch')) { + reviewers.add("janlazo") + reviewers.add("seandewar") + reviewers.add("zeertzjq") + } + + // Remove person that opened the PR since they can't review themselves + const pr_opener = pr_data.data.user.login + reviewers.delete(pr_opener) + + github.rest.pulls.requestReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + reviewers: Array.from(reviewers) + }); +} diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 7bae5bb94b..7a5aeee603 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -855,7 +855,7 @@ nvim_exec_lua({code}, {args}) *nvim_exec_lua()* Return: ~ Return value of Lua code if present or NIL. -nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()* +nvim_feedkeys({keys}, {mode}, {escape_ks}) *nvim_feedkeys()* Sends input-keys to Nvim, subject to various quirks controlled by `mode` flags. This is a blocking call, unlike |nvim_input()|. @@ -863,23 +863,25 @@ nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()* On execution error: does not fail, but updates v:errmsg. To input sequences like <C-o> use |nvim_replace_termcodes()| - (typically with escape_csi=true) to replace |keycodes|, then + (typically with escape_ks=false) to replace |keycodes|, then pass the result to nvim_feedkeys(). Example: > :let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true) - :call nvim_feedkeys(key, 'n', v:true) + :call nvim_feedkeys(key, 'n', v:false) < Parameters: ~ - {keys} to be typed - {mode} behavior flags, see |feedkeys()| - {escape_csi} If true, escape K_SPECIAL/CSI bytes in - `keys` + {keys} to be typed + {mode} behavior flags, see |feedkeys()| + {escape_ks} If true, escape K_SPECIAL bytes in `keys` + This should be false if you already used + |nvim_replace_termcodes()|, and true + otherwise. See also: ~ feedkeys() - vim_strsave_escape_csi + vim_strsave_escape_ks nvim_get_all_options_info() *nvim_get_all_options_info()* Gets the option information for all options. @@ -1538,14 +1540,13 @@ nvim_set_current_win({window}) *nvim_set_current_win()* Parameters: ~ {window} Window handle -nvim_set_hl({ns_id}, {name}, {val}) *nvim_set_hl()* +nvim_set_hl({ns_id}, {name}, {*val}) *nvim_set_hl()* Set a highlight group. - TODO: ns_id = 0, should modify :highlight namespace TODO val - should take update vs reset flag - Parameters: ~ - {ns_id} number of namespace for this highlight + {ns_id} number of namespace for this highlight. Use value + 0 to set a highlight group in the global ( + `:highlight` ) namespace. {name} highlight group name, like ErrorMsg {val} highlight definition map, like |nvim_get_hl_by_name|. in addition the following diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index f6fcbe8fb9..d717759444 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1225,8 +1225,8 @@ on_publish_diagnostics({_}, {result}, {ctx}, {config}) }, -- Use a function to dynamically turn signs off -- and on, using buffer local variables - signs = function(bufnr, client_id) - return vim.bo[bufnr].show_signs == false + signs = function(namespace, bufnr) + return vim.b[bufnr].show_signs == true end, -- Disable a feature update_in_insert = false, diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 77f1dad6c7..1a2d845281 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1763,6 +1763,13 @@ Lua module: ui *lua-ui* input({opts}, {on_confirm}) *vim.ui.input()* Prompts the user for input + Example: > + + vim.ui.input({ prompt = 'Enter value for shiftwidth: ' }, function(input) + vim.o.shiftwidth = tonumber(input) + end) +< + Parameters: ~ {opts} table Additional options. See |input()| • prompt (string|nil) Text of the prompt. @@ -1786,6 +1793,22 @@ select({items}, {opts}, {on_choice}) *vim.ui.select()* Prompts the user to pick a single item from a collection of entries + Example: > + + vim.ui.select({ 'tabs', 'spaces' }, { + prompt = 'Select tabs or spaces:', + format_item = function(item) + return "I'd like to choose " .. item + end, + }, function(choice) + if choice == 'spaces' then + vim.o.expandtab = true + else + vim.o.expandtab = false + end + end) +< + Parameters: ~ {items} table Arbitrary items {opts} table Additional options |