-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmise.toml
More file actions
89 lines (73 loc) · 2.52 KB
/
mise.toml
File metadata and controls
89 lines (73 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
[tools]
# Lua formatter
stylua = "latest"
# Lua linter
"aqua:Kampfkarren/selene" = { version = "latest", os = ["macos", "linux/x64"] }
# Treesitter CLI (required by nvim-treesitter for parser compilation)
tree-sitter = "latest"
# ------------------------------------------------------------------------------
[env]
# ------------------------------------------------------------------------------
# ==============================================================================
# Compile Ruler
# ==============================================================================
[tasks.ruler] # command: mise run ruler
description = "Compile ruler to AGENTS.md"
run = "bunx @intellectronica/ruler apply"
[tasks.clean-unsupported-ts-parsers] # command: mise run clean-unsupported-ts-parsers
description = "Remove installed nvim-treesitter parsers that are no longer supported"
run = '''
tmp_vim="${TMPDIR:-/tmp}/nvim-clean-unsupported-ts-parsers.vim"
cat > "$tmp_vim" <<'EOF'
lua << LUA
local config = require("nvim-treesitter.config")
local available = {}
for _, lang in ipairs(config.get_available()) do
available[lang] = true
end
local unsupported = {}
for _, lang in ipairs(config.get_installed()) do
if not available[lang] then
table.insert(unsupported, lang)
end
end
table.sort(unsupported)
if #unsupported == 0 then
print("No unsupported nvim-treesitter parsers found")
vim.cmd.quitall()
return
end
local parser_dir = config.get_install_dir("parser")
local parser_info_dir = config.get_install_dir("parser-info")
local query_dir = config.get_install_dir("queries")
for _, lang in ipairs(unsupported) do
local removed = {}
for _, parser in ipairs(vim.fn.globpath(parser_dir, lang .. ".*", false, true)) do
if vim.fn.delete(parser) == 0 then
table.insert(removed, parser)
end
end
local revision = vim.fs.joinpath(parser_info_dir, lang .. ".revision")
if vim.fn.filereadable(revision) == 1 and vim.fn.delete(revision) == 0 then
table.insert(removed, revision)
end
local queries = vim.fs.joinpath(query_dir, lang)
if vim.fn.isdirectory(queries) == 1 and vim.fn.delete(queries, "rf") == 0 then
table.insert(removed, queries)
end
if #removed == 0 then
print(("No files removed for unsupported parser: %s"):format(lang))
else
print(("Removed unsupported parser: %s"):format(lang))
for _, path in ipairs(removed) do
print(" " .. path)
end
end
end
vim.cmd.quitall()
LUA
EOF
export NVIM_LOG_FILE="${NVIM_LOG_FILE:-${TMPDIR:-/tmp}/nvim-clean-unsupported-ts-parsers.log}"
nvim --headless -i NONE -S "$tmp_vim"
rm -f "$tmp_vim"
'''