aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.emmyrc.json6
-rw-r--r--Makefile25
-rw-r--r--lua/nvim-treesitter/async.lua1
-rw-r--r--lua/nvim-treesitter/indent.lua2
-rw-r--r--lua/nvim-treesitter/install.lua6
5 files changed, 23 insertions, 17 deletions
diff --git a/.emmyrc.json b/.emmyrc.json
index 34d1e0b86..748553cc4 100644
--- a/.emmyrc.json
+++ b/.emmyrc.json
@@ -13,6 +13,12 @@
"diagnostics": {
"disable": [
"unnecessary-if"
+ ],
+ "enables": [
+ "iter-variable-reassign",
+ "non-literal-expressions-in-assert",
+ "incomplete-signature-doc",
+ "missing-global-doc"
]
},
"codeAction": {
diff --git a/Makefile b/Makefile
index 15482e03b..6cab4662d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,4 @@
NVIM_VERSION ?= nightly
-LUALS_VERSION := 3.15.0
DEPDIR ?= .test-deps
CURL ?= curl -sL --create-dirs
@@ -35,18 +34,18 @@ $(NVIM):
tar -xf $(NVIM_TARBALL) -C $@
rm -rf $(NVIM_TARBALL)
-LUALS := $(DEPDIR)/lua-language-server-$(LUALS_VERSION)-$(LUALS_ARCH)
-LUALS_TARBALL := $(LUALS).tar.gz
-LUALS_URL := https://github.com/LuaLS/lua-language-server/releases/download/$(LUALS_VERSION)/$(notdir $(LUALS_TARBALL))
+EMMYLUALS := $(DEPDIR)/emmylua_check-$(LUALS_ARCH)
+EMMYLUALS_TARBALL := $(EMMYLUALS).tar.gz
+EMMYLUALS_URL := https://github.com/emmyluals/emmylua-analyzer-rust/releases/latest/download/$(notdir $(EMMYLUALS_TARBALL))
-.PHONY: luals
-luals: $(LUALS)
+.PHONY: emmyluals
+luals: $(EMMYLUALS)
-$(LUALS):
- $(CURL) $(LUALS_URL) -o $(LUALS_TARBALL)
+$(EMMYLUALS):
+ $(CURL) $(EMMYLUALS_URL) -o $(EMMYLUALS_TARBALL)
mkdir $@
- tar -xf $(LUALS_TARBALL) -C $@
- rm -rf $(LUALS_TARBALL)
+ tar -xf $(EMMYLUALS_TARBALL) -C $@
+ rm -rf $(EMMYLUALS_TARBALL)
STYLUA := $(DEPDIR)/stylua-$(STYLUA_ARCH)
STYLUA_TARBALL := $(STYLUA).zip
@@ -104,10 +103,8 @@ formatlua: $(STYLUA)
$(STYLUA)/stylua .
.PHONY: checklua
-checklua: $(LUALS) $(NVIM)
- VIMRUNTIME=$(NVIM_RUNTIME) $(LUALS)/bin/lua-language-server \
- --configpath=../.luarc.json \
- --check=./
+checklua: $(EMMYLUALS) $(NVIM)
+ VIMRUNTIME=$(NVIM_RUNTIME) $(EMMYLUALS)/emmylua_check --warnings-as-errors .
.PHONY: query
query: formatquery lintquery checkquery
diff --git a/lua/nvim-treesitter/async.lua b/lua/nvim-treesitter/async.lua
index e78c0f964..aaf4627ef 100644
--- a/lua/nvim-treesitter/async.lua
+++ b/lua/nvim-treesitter/async.lua
@@ -1,3 +1,4 @@
+---@meta async vendored file, don't diagnose
local pcall = copcall or pcall
--- @param ... any
diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua
index 6f8e4d8ff..35dd78c35 100644
--- a/lua/nvim-treesitter/indent.lua
+++ b/lua/nvim-treesitter/indent.lua
@@ -97,7 +97,7 @@ local get_indents = memoize(function(bufnr, root, lang)
return map
end
for id, node, metadata in query:iter_captures(root, bufnr) do
- if query.captures[id]:sub(1, 1) ~= '_' then
+ if query.captures[id] and query.captures[id]:sub(1, 1) ~= '_' then
map[query.captures[id]][node:id()] = metadata or {}
end
end
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua
index 1020e7da9..a4cb8fbf0 100644
--- a/lua/nvim-treesitter/install.lua
+++ b/lua/nvim-treesitter/install.lua
@@ -85,7 +85,9 @@ local function join(max_jobs, tasks)
end
for i = 1, max_jobs do
- tasks[i]():await(cb)
+ if tasks[i] then
+ tasks[i]():await(cb)
+ end
end
end)
end
@@ -467,8 +469,8 @@ end
--- Reload the parser table and user modifications in case of update
local function reload_parsers()
- ---@diagnostic disable-next-line:no-unknown
package.loaded['nvim-treesitter.parsers'] = nil
+ ---@diagnostic disable-next-line:duplicate-require
parsers = require('nvim-treesitter.parsers')
vim.api.nvim_exec_autocmds('User', { pattern = 'TSUpdate' })
end