aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-04-26 06:01:04 -0700
committerGitHub <noreply@github.com>2025-04-26 06:01:04 -0700
commit85e09220a878b19e62eec98872db4c74f711d167 (patch)
tree84460d3ee438c5a168675f1a94949c6d8eae972c
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-85e09220a878b19e62eec98872db4c74f711d167.tar
nvim-lspconfig-85e09220a878b19e62eec98872db4c74f711d167.tar.gz
nvim-lspconfig-85e09220a878b19e62eec98872db4c74f711d167.tar.bz2
nvim-lspconfig-85e09220a878b19e62eec98872db4c74f711d167.tar.lz
nvim-lspconfig-85e09220a878b19e62eec98872db4c74f711d167.tar.xz
nvim-lspconfig-85e09220a878b19e62eec98872db4c74f711d167.tar.zst
nvim-lspconfig-85e09220a878b19e62eec98872db4c74f711d167.zip
ci: check legacy configs, drop "comment" #3781
- Disallow adding new legacy configs. - Drop the "comment" CI job. It is over-engineered, and adds redundant comments on PRs.
-rw-r--r--.github/ci/lint.sh21
-rw-r--r--.github/workflows/comment-config-changes.yml19
-rw-r--r--.github/workflows/lint.yml2
-rw-r--r--lsp/ts_ls.lua8
4 files changed, 27 insertions, 23 deletions
diff --git a/.github/ci/lint.sh b/.github/ci/lint.sh
index 39cb0d3a..4f4f49b5 100644
--- a/.github/ci/lint.sh
+++ b/.github/ci/lint.sh
@@ -8,6 +8,25 @@ set -e
REF_BRANCH="$1"
PR_BRANCH="$2"
+_fail() {
+ echo
+ printf "lint.sh: %s\n" "$@"
+ exit 1
+}
+
+_check_generated_docs() {
+ if ! git diff "${REF_BRANCH}"..."${PR_BRANCH}" --exit-code -- doc/configs.md doc/configs.txt; then
+ _fail '`configs.md` or `configs.txt` will be regenerated by the docgen CI process. Edit the Lua source file instead.' \
+ ' For details on generating documentation, see: https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#generating-docs'
+ fi
+}
+
+_check_legacy_configs() {
+ if ! git diff "${REF_BRANCH}"..."${PR_BRANCH}" --exit-code -- lua/lspconfig/configs/ ; then
+ _fail 'Configs in `lua/lspconfig/configs/*` are deprecated. Add or update configs in `lsp/*` instead.'
+ fi
+}
+
# Enforce buffer-local commands.
_check_cmd_buflocal() {
if git grep -P 'nvim_create_user_command' -- 'lsp/*.lua' ; then
@@ -85,6 +104,8 @@ _check_deprecated_utils() {
fi
}
+_check_generated_docs
+_check_legacy_configs
_check_cmd_buflocal
_check_brief_placement
_check_lsp_cmd_prefix
diff --git a/.github/workflows/comment-config-changes.yml b/.github/workflows/comment-config-changes.yml
deleted file mode 100644
index 5bcc8008..00000000
--- a/.github/workflows/comment-config-changes.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-name: "Check changes to config"
-on: [pull_request_target]
-jobs:
- check-config-changes:
- runs-on: ubuntu-latest
- permissions:
- pull-requests: write
- env:
- PR_NUMBER: ${{ github.event.pull_request.number }}
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- steps:
- - uses: actions/checkout@v4
- with:
- fetch-depth: 0
- ref: ${{ github.event.pull_request.head.sha }}
- - run: |
- if ! git diff origin/$GITHUB_BASE_REF...$(git branch --show-current) --exit-code -- doc/configs.md doc/configs.txt; then
- gh pr comment $PR_NUMBER --body 'Note that `configs.md` or `configs.txt` will be regenerated by the docgen CI process. Edit the Lua source file instead. For details on generating documentation, see: https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#generating-docs'
- fi
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 20b9b6ae..208b0d48 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -9,7 +9,7 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
- deprecated-functions:
+ lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
diff --git a/lsp/ts_ls.lua b/lsp/ts_ls.lua
index 37f30f1e..c3e8e1b9 100644
--- a/lsp/ts_ls.lua
+++ b/lsp/ts_ls.lua
@@ -29,7 +29,9 @@
--- }
--- ```
---
---- Source actions such as organizing imports and removing unused code are available via `:LspTypescriptSourceAction`.
+--- Use the `:LspTypescriptSourceAction` command to see "whole file" ("source") code-actions such as:
+--- - organize imports
+--- - remove unused code
---
--- ### Vue support
---
@@ -83,7 +85,7 @@ return {
handlers = {
-- handle rename request for certain code actions like extracting functions / types
['_typescript.rename'] = function(_, result, ctx)
- local client = vim.lsp.get_client_by_id(ctx.client_id)
+ local client = assert(vim.lsp.get_client_by_id(ctx.client_id))
vim.lsp.util.show_document({
uri = result.textDocument.uri,
range = {
@@ -96,7 +98,7 @@ return {
end,
},
on_attach = function(client)
- -- ts_ls provides code actions that have a prefix `source.` that apply to the whole file. These will only appear in
+ -- ts_ls provides `source.*` code actions that apply to the whole file. These only appear in
-- `vim.lsp.buf.code_action()` if specified in `context.only`.
vim.api.nvim_buf_create_user_command(0, 'LspTypescriptSourceAction', function()
local source_actions = vim.tbl_filter(function(action)