Use cargo build instead of prebuilt binary for tree-sitter-cli manual install
This commit is contained in:
@@ -33,16 +33,23 @@ return {
|
|||||||
local uname = vim.uv.os_uname()
|
local uname = vim.uv.os_uname()
|
||||||
local sysname = (uname.sysname or ""):lower()
|
local sysname = (uname.sysname or ""):lower()
|
||||||
local machine = uname.machine or ""
|
local machine = uname.machine or ""
|
||||||
local os_part = sysname == "darwin" and "macos" or "linux"
|
local is_mac = sysname == "darwin"
|
||||||
local arch_part = ({ x86_64 = "x64", amd64 = "x64", aarch64 = "arm64", arm64 = "arm64" })[machine] or "x64"
|
|
||||||
local asset = "tree-sitter-" .. os_part .. "-" .. arch_part
|
local install_cmd
|
||||||
|
if is_mac then
|
||||||
|
local arch_part = ({ x86_64 = "x64", amd64 = "x64", aarch64 = "arm64", arm64 = "arm64" })[machine] or "x64"
|
||||||
|
local asset = "tree-sitter-macos-" .. arch_part
|
||||||
|
install_cmd = " curl -L https://github.com/tree-sitter/tree-sitter/releases/latest/download/"
|
||||||
|
.. asset
|
||||||
|
.. ".gz | gunzip > ~/.local/bin/tree-sitter && chmod +x ~/.local/bin/tree-sitter"
|
||||||
|
else
|
||||||
|
install_cmd = " cargo install --root ~/.local tree-sitter-cli"
|
||||||
|
end
|
||||||
|
|
||||||
vim.notify(
|
vim.notify(
|
||||||
"tree-sitter CLI not found: skipping install of missing parsers.\n"
|
"tree-sitter CLI not found: skipping install of missing parsers.\n"
|
||||||
.. "Install into ~/.local/bin:\n"
|
.. "Install into ~/.local/bin:\n"
|
||||||
.. " curl -L https://github.com/tree-sitter/tree-sitter/releases/latest/download/"
|
.. install_cmd,
|
||||||
.. asset
|
|
||||||
.. ".gz | gunzip > ~/.local/bin/tree-sitter && chmod +x ~/.local/bin/tree-sitter",
|
|
||||||
vim.log.levels.WARN
|
vim.log.levels.WARN
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user